From b36c06088c4eab8771917dc0d612867349f557d8 Mon Sep 17 00:00:00 2001 From: Oros Date: Mon, 4 Mar 2013 21:40:43 +0100 Subject: [PATCH] Petits correctifs de bug. modified: functions.php modified: index.php --- 0.3/functions.php | 3 +++ 0.3/index.php | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/0.3/functions.php b/0.3/functions.php index acc01d6..9a83b1c 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -19,6 +19,9 @@ function NoProtocolSiteURL($url) { function DetectRedirect($url) { + if(parse_url($url, PHP_URL_HOST)==FALSE) { + die('Not a URL'); + } $response = get_headers($url, 1); if(!empty($response['Location'])) { $response2 = get_headers($response['Location'], 1); diff --git a/0.3/index.php b/0.3/index.php index 60c103e..d71c8d4 100755 --- a/0.3/index.php +++ b/0.3/index.php @@ -278,7 +278,7 @@ if (isset($_GET['sitemap'])) foreach($subdirs as $unit) { if(is_dir($unit)) { $unit=substr($unit, 2); - $proto=$_SERVER['HTTPS']?"https://":"http://"; + $proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://"; echo ''.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."\n"; echo ''.date('c', filemtime($unit))."\n"; echo 'hourly'; @@ -469,10 +469,10 @@ if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_L $form = 'Merci de vérifier les informations suivantes, corrigez si nécessaire.
-
+


-
+

'; @@ -516,11 +516,17 @@ if( !empty($_POST['opml_file']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY {$error[] = 'Le lien est incorrect.';} if( empty( $error)) { - if ( ($opml = simplexml_load_file( escape($_POST['opml_url']) )) !== false ) { - create_from_opml($opml); + $opml_url = escape($_POST['opml_url']); + if(parse_url($opml_url, PHP_URL_HOST)==FALSE) { + $error[] = "URL du fichier OPML non valide."; + } else { + if ( ($opml = simplexml_load_file( $opml_url )) !== false ) { + create_from_opml($opml); + } else { + $error[] = "Impossible de lire le contenu du fichier OPML ou d'accéder à l'URL donnée."; + } } - else - $error[] = "Impossible de lire le contenu du fichier OPML ou d'accéder à l'URL donnée."; + } }