From d3bf3d7a2c018a3b83fe2a90027a33f582f1fd9a Mon Sep 17 00:00:00 2001
From: ArthurHoaro
Date: Thu, 4 Apr 2013 18:58:28 +0200
Subject: [PATCH] =?UTF-8?q?Si=20j'en=20oublie=20la=20moiti=E9=20en=20route?=
=?UTF-8?q?...=20#3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
0.3/index.php | 61 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 39 insertions(+), 22 deletions(-)
diff --git a/0.3/index.php b/0.3/index.php
index 16026c9..7a484cd 100755
--- a/0.3/index.php
+++ b/0.3/index.php
@@ -109,10 +109,9 @@ function create_from_opml($opml) {
foreach( $opml->body->outline as $outline ) {
if ( !empty( $outline['title'] ) && !empty( $outline['text'] ) && !empty( $outline['xmlUrl']) && !empty( $outline['htmlUrl'] )) {
- $rssurl = DetectRedirect(escape( $outline['xmlUrl']));
- if( isset($rssurl['error']) )
- $error[] = $rssurl['error'];
- else {
+ try {
+ $rssurl = DetectRedirect(escape( $outline['xmlUrl']));
+
$sitename = escape( $outline['title'] );
$siteurl = escape($outline['htmlUrl']);
$sitetype = escape($outline['text']); if ( $sitetype == 'generic' or $sitetype == 'microblog' or $sitetype == 'shaarli') { } else { $sitetype = 'generic'; }
@@ -122,6 +121,9 @@ function create_from_opml($opml) {
if( empty ( $error ))
$success[] = 'Autoblog "'. $sitename .'" crée avec succès. → afficher l\'autoblog.';
}
+ catch (Exception $e) {
+ $error[] = $e->getMessage();
+ }
}
}
}
@@ -418,10 +420,9 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG
}
else {
if(isset($_GET['add']) && $_GET['add'] === '1' && !empty($_GET['siteurl']) && !empty($_GET['sitename'])) {
- $rssurl = DetectRedirect(escape($_GET['rssurl']));
- if( isset($rssurl['error']) )
- $form .= 'Erreur : '. $rssurl['error'] .'
';
- else {
+ try {
+ $rssurl = DetectRedirect(escape($_GET['rssurl']));
+
$siteurl = escape($_GET['siteurl']);
$sitename = escape($_GET['sitename']);
$sitetype = updateType($siteurl); // Disabled input doesn't send POST data
@@ -439,13 +440,14 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG
$form .= '';
}
}
- $form .= 'Fermer la fenêtre.
';
+ catch (Exception $e) {
+ $form .= $e->getMessage();
+ }
+ $form .= 'Fermer la fenêtre.
';
}
else {
- $rssurl = DetectRedirect(escape($_GET['rssurl']));
- if( isset($rssurl['error']) )
- $form .= 'Erreur : '. $rssurl['error'] .'
Fermer la fenêtre.
';
- else {
+ try {
+ $rssurl = DetectRedirect(escape($_GET['rssurl']));
$datafeed = file_get_contents($rssurl);
if( $datafeed !== false ) {
$siteurl = get_link_from_datafeed($datafeed);
@@ -466,6 +468,9 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG
$form .= 'URL du flux RSS incorrecte.
Fermer la fenêtre.
';
}
}
+ catch (Exception $e) {
+ $form .= $e->getMessage() .'
Fermer la fenêtre.';
+ }
}
}
$form .= '