Changeset 107178 in spip-zone
- Timestamp:
- Oct 27, 2017, 8:51:40 AM (3 years ago)
- Location:
- _plugins_/fbantispam
- Files:
-
- 12 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/fbantispam/fbantispam/verifier_formulaire_forum.php
r81051 r107178 7 7 if (!defined("_ECRIRE_INC_VERSION")) return; 8 8 9 10 9 /** 11 10 */ … … 13 12 $ret = array(); 14 13 $form = $flux['args']['form']; 15 if ($form == "forum") 16 { 17 $texte = _request('texte'); 18 $captcha = _request('captcha'); 19 $cp0 = _request('c1'); 20 $cp1 = _request('c0'); 21 $cp2 = _request('c2'); 22 $cp3 = _request('c3'); 23 $cps = "$cp0"."$cp1"."$cp2"."$cp3"; 24 include_spip("inc/fbantispam"); 14 $type_captcha = lire_config('fbantispam/type_captcha', 'copie'); 15 if ($form == "forum") 16 { 17 if ($type_captcha == 'recaptcha') 18 { 19 include_spip("fbantispam/recaptchalib.php"); 20 if ($_POST["recaptcha_response_field"]) { 21 $resp = recaptcha_check_answer (lire_config('fbantispam/cle_secrete'), 22 $_SERVER["REMOTE_ADDR"], 23 $_POST["recaptcha_challenge_field"], 24 $_POST["recaptcha_response_field"]); 25 25 26 if ($captcha != $cps) 27 { 28 $ret['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 29 } 30 } 26 if (!$resp->is_valid) { 27 $error = $resp->error; 28 $ret['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 29 } 30 } 31 // echo "<pre>";print_r($resp);echo "</pre>";exit; 32 } 33 else { 34 $texte = _request('texte'); 35 $captcha = _request('captcha'); 36 $cp0 = _request('c1'); 37 $cp1 = _request('c0'); 38 $cp2 = _request('c2'); 39 $cp3 = _request('c3'); 40 $cps = "$cp0"."$cp1"."$cp2"."$cp3"; 41 include_spip("inc/fbantispam"); 31 42 43 if ($captcha != $cps) 44 { 45 $ret['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 46 } 47 } 48 } 32 49 return $ret; 33 50 } -
_plugins_/fbantispam/fbantispam_pipelines.php
r103864 r107178 4 4 * Plugin FB Antispam 5 5 * (c) 2013 Fabio Bertagnin - FBServices - www.fbservices.fr 6 * Inspiré de "nospam" de Cedric Morin pour www.yterium.net (http s://contrib.spip.net/?rubrique1165)6 * Inspiré de "nospam" de Cedric Morin pour www.yterium.net (http://www.spip-contrib.net/?rubrique1165) 7 7 * Licence GPL 8 8 * … … 11 11 return; 12 12 13 /** 14 * Ajouter le champ de formulaire 'nobot' au besoin 15 * 16 * @param array $flux 17 * @return array 18 */ 13 function fbantispam_insert_head($flux) { 14 return $flux; 15 } 16 19 17 function fbantispam_recuperer_fond($flux) { 20 18 $fond = strval($flux['args']['fond']); … … 35 33 if ($pos) { 36 34 $type_captcha = lire_config('fbantispam/type_captcha', 'copie'); 37 if ($type_captcha == 'copie') 38 { 35 if ($type_captcha == 'copie' || $type_captcha == '') { 39 36 $cp = fbantispam_get_captcha(); 40 37 $cps = "$cp[0]$cp[1]$cp[2]$cp[3]"; … … 42 39 $texte = substr_replace($texte, $captcha, $pos, 0); 43 40 } 44 if ($type_captcha == 'addition') 45 { 41 if ($type_captcha == 'addition') { 46 42 $cp = fbantispam_get_captcha(); 47 43 $cps = "$cp[1]+$cp[3]"; … … 49 45 $texte = substr_replace($texte, $captcha, $pos, 0); 50 46 } 51 if ($type_captcha == 'multiplication') 52 { 47 if ($type_captcha == 'multiplication') { 53 48 $cp = fbantispam_get_captcha(); 54 49 $cps = "$cp[1]x$cp[3]"; 55 50 $captcha = recuperer_fond("inclure/captcha-multiplication", array('captcha' => $cps, 'c1' => $cp[0] * 2, 'c0' => $cp[1] * 2, 'c2' => $cp[2] * 2, 'c3' => $cp[3] * 2)); 51 $texte = substr_replace($texte, $captcha, $pos, 0); 52 } 53 if ($type_captcha == 'recaptcha') { 54 $captcha = recuperer_fond("inclure/captcha-recaptcha", array('cle_site' => lire_config('fbantispam/cle_site'))); 56 55 $texte = substr_replace($texte, $captcha, $pos, 0); 57 56 } … … 89 88 if ($form == "forum" && $previsu) { 90 89 91 $captcha = _request('captcha'); 92 $cp0 = _request('c1') / 2; 93 $cp1 = _request('c0') / 2; 94 $cp2 = _request('c2') / 2; 95 $cp3 = _request('c3') / 2; 96 $cmod = _request('cmod'); 97 if ($cmod != 'fbantispam') { 98 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : message non accepté (identifié à un SPAM)</p>'; 99 return $res; 100 } 101 if ($captcha == '') { 102 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'a pas été saisi</p>'; 103 return $res; 104 } 105 $type_captcha = lire_config('fbantispam/type_captcha'); 106 if ($type_captcha == 'copie' || $type_captcha == '') 107 { 108 $cps = "$cp0" . "$cp1" . "$cp2" . "$cp3"; 109 if ($captcha != $cps) { 110 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 90 $type_captcha = lire_config('fbantispam/type_captcha', 'copie'); 91 if ($type_captcha != 'recaptcha') { 92 $captcha = _request('captcha'); 93 $cp0 = _request('c1') / 2; 94 $cp1 = _request('c0') / 2; 95 $cp2 = _request('c2') / 2; 96 $cp3 = _request('c3') / 2; 97 $cmod = _request('cmod'); 98 if ($cmod != 'fbantispam') { 99 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : message non accepté (identifié à un SPAM)</p>'; 100 return $res; 101 } 102 if ($captcha == '') { 103 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'a pas été saisi</p>'; 104 return $res; 105 } 106 if ($type_captcha == 'copie' || $type_captcha == '') { 107 $cps = "$cp0" . "$cp1" . "$cp2" . "$cp3"; 108 if ($captcha != $cps) { 109 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 110 return $res; 111 } 112 } elseif ($type_captcha == 'addition') { 113 $cps = $cp1 + $cp3; 114 if ($captcha != $cps) { 115 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 116 return $res; 117 } 118 } elseif ($type_captcha == 'multiplication') { 119 $cps = $cp1 * $cp3; 120 if ($captcha != $cps) { 121 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>'; 122 return $res; 123 } 124 } else { 125 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : pas de captcha connu</p>'; 126 return $res; 127 } 128 } else { 129 require(__DIR__."/fbantispam/fb_recaptcha_lib.php"); 130 $recaptcha_response = _request("g-recaptcha-response"); 131 if ($recaptcha_response) { 132 $test = fbantispam_recaptcha_verif($recaptcha_response, lire_config('fbantispam/cle_secrete'), $_SERVER["REMOTE_ADDR"]); 133 134 135 if (!$test) { 136 $res['message_erreur'] = "<p style='background:#ffffaa;padding:4px'>ERREUR : le controle anti-spam n'a pas été validé</p>"; 137 spip_log("ERREUR fbantispam : le controle anti-spam n'a pas été validé. POST=".print_r($_POST, 1), _LOG_ERREUR); 138 return $res; 139 } 140 } else { 141 $res['message_erreur'] = "<p style='background:#ffffaa;padding:4px'>ERREUR : le code du controle anti-spam n'a pas été reçu</p>"; 142 spip_log("ERREUR fbantispam : le code du controle anti-spam n'a pas été reçu. POST=".print_r($_POST, 1), _LOG_ERREUR); 111 143 return $res; 112 144 } 113 145 } 114 elseif ($type_captcha == 'addition')115 {116 $cps = $cp1 + $cp3;117 if ($captcha != $cps) {118 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>';119 return $res;120 }121 }122 elseif ($type_captcha == 'multiplication')123 {124 $cps = $cp1 * $cp3;125 if ($captcha != $cps) {126 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : le code anti-spam n\'est pas correct</p>';127 return $res;128 }129 }130 else131 {132 $res['message_erreur'] = '<p style="background:#ffffaa;padding:4px">ERREUR : pas de captcha connu</p>';133 return $res;134 }135 136 146 } 137 147 return $flux; … … 160 170 } 161 171 162 ?> -
_plugins_/fbantispam/paquet.xml
r103720 r107178 2 2 prefix="fbantispam" 3 3 categorie="performance" 4 version="1. 2.2"4 version="1.3.0" 5 5 etat="test" 6 compatibilite="[2.1.0;3. 1.*]"6 compatibilite="[2.1.0;3.2.*]" 7 7 logo="images/beos-stop-icone-8929-32.png" 8 documentation="http s://contrib.spip.net/CAPTCHA-pour-forums"9 > 8 documentation="http://contrib.spip.net/CAPTCHA-pour-forums" 9 > 10 10 11 11 <nom>FB Antispam</nom> … … 17 17 <licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GPL 3</licence> 18 18 19 <necessite nom="saisies" compatibilite="[1.25.11;]" />19 <necessite nom="saisies" compatibilite="[1.25.11;]"></necessite> 20 20 21 21 <pipeline nom="pre_edition" inclure="fbantispam_pipelines.php" /> … … 24 24 <pipeline nom="formulaire_verifier" inclure="fbantispam_pipelines.php" /> 25 25 <pipeline nom="formulaire_traiter" inclure="fbantispam_pipelines.php" /> 26 26 <pipeline nom="insert_head" inclure="fbantispam_pipelines.php" /> 27 27 28 <menu nom="fbantispam" titre="Configurer FB Antispam" parent="menu_configuration" icone="images/beos-stop-icone-8929-16.png" action="?exec=configurer_fbantispam" /> 28 29 </paquet> -
_plugins_/fbantispam/plugin.xml
r103720 r107178 6 6 <auteur>Fabio Bertagnin - FBServices www.fbservices.fr</auteur> 7 7 <icon>images/beos-stop-icone-8929-32.png</icon> 8 <licence>(c) 2013-201 6GPL</licence>9 <version>1. 2.2</version>8 <licence>(c) 2013-2017 GPL</licence> 9 <version>1.3.0</version> 10 10 <etat>test</etat> 11 11 <description> … … 13 13 La saisie n'est pas prise en compte si le captcha n'est pas correct. 14 14 </description> 15 <lien>http s://contrib.spip.net/CAPTCHA-pour-forums</lien>15 <lien>http://contrib.spip.net/CAPTCHA-pour-forums</lien> 16 16 <prefix>fbantispam</prefix> 17 17 <pipeline> … … 35 35 <inclure>fbantispam_pipelines.php</inclure> 36 36 </pipeline> 37 <pipeline> 38 <nom>insert_head</nom> 39 <inclure>fbantispam_pipelines.php</inclure> 40 </pipeline> 41 37 42 <categorie>performance</categorie> 38 <necessite id="SPIP" version="[2.1.0;3. 1.99]" />43 <necessite id="SPIP" version="[2.1.0;3.2.*]" /> 39 44 </plugin>
Note: See TracChangeset
for help on using the changeset viewer.