diff --git a/0.3/functions.php b/0.3/functions.php index 8576c48..5f03c28 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -57,7 +57,7 @@ function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) { } if(folderExists($siteurl)) { - $error[] = 'Erreur: l\'autoblog '. $sitename .' existe déjà.'; + $error[] = 'Erreur : l\'autoblog '. $sitename .' existe déjà.'; return $error; } diff --git a/0.3/index.php b/0.3/index.php index 5328df5..c70f468 100755 --- a/0.3/index.php +++ b/0.3/index.php @@ -1,8 +1,8 @@ site_title, $b->site_title); } +function generate_antibot() { + $letters = array('zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf', 'vingt'); + return $letters[mt_rand(0, 20)]; +} + +function check_antibot($number, $text_number) { + $letters = array('zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf', 'vingt'); + return ( array_search( $text_number, $letters ) === intval($number) ) ? true : false; +} + /** * SVG **/ @@ -260,9 +270,11 @@ if( isset($_GET['updateAll']) && ALLOW_FULL_UPDATE) { } } +$antibot = generate_antibot(); $form = '

-
+
+
'; @@ -281,11 +293,10 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG $rssurl = DetectRedirect(escape($_GET['rssurl'])); $siteurl = escape($_GET['siteurl']); $sitename = escape($_GET['sitename']); - $sitetype = updateType($_GET['type']); + $sitetype = escape($_GET['type']); $error = createAutoblog($sitetype, $sitename, $siteurl, $rssurl, $error); if( empty($error)) { - $form .= '

'.$sitetype.'

'; $form .= ''; $form .= '

Autoblog '. $sitename .' ajouté avec succès.
'; } @@ -303,7 +314,7 @@ if(!empty($_GET['via_button']) && $_GET['number'] === '17' && ALLOW_NEW_AUTOBLOG if( $datafeed !== false ) { $siteurl = get_link_from_datafeed($datafeed); $sitename = get_title_from_datafeed($datafeed); - $sitetype = updateType($_GET['type']); + $sitetype = updateType($_GET['type'])['type']; $form .= 'Merci de vérifier les informations suivantes, corrigez si nécessaire.

@@ -372,10 +383,10 @@ if(!empty($_POST['socialaccount']) && !empty($_POST['socialinstance']) && ALLOW_ if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_LINKS) { if(empty($_POST['rssurl'])) {$error[] = "Veuillez entrer l'adresse du flux.";} - if(empty($_POST['number'])) + if(empty($_POST['number']) || empty($_POST['antibot']) ) {$error[] = "Vous êtes un bot ?";} - if($_POST['number'] !== '17') - {$error[] = "C'est pas le bon nombre.";} + elseif(! check_antibot($_POST['number'], $_POST['antibot'])) + {$error[] = "Antibot : Ce n'est pas le bon nombre.";} if(empty($error)) { $rssurl = DetectRedirect(escape($_POST['rssurl'])); @@ -406,7 +417,8 @@ if( !empty($_POST['generic']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_L


-
'; +
+ '; } } @@ -476,7 +488,7 @@ if( !empty($_POST['opml']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_OPML .button:active{position:relative;top:1px;} - +

PROJET AUTOBLOG

@@ -650,7 +662,8 @@ if( !empty($_POST['opml']) && ALLOW_NEW_AUTOBLOGS && ALLOW_NEW_AUTOBLOGS_BY_OPML +