diff --git a/core/class/template.class.php b/core/class/template.class.php index d3cc78bf..63a9ca6c 100755 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -33,12 +33,12 @@ class template { } /** - * Crée un champ capcha + * Crée un champ captcha * @param string $nameId Nom et id du champ * @param array $attributes Attributs ($key => $value) * @return string */ - public static function capcha($nameId, array $attributes = []) { + public static function captcha($nameId, array $attributes = []) { // Attributs par défaut $attributes = array_merge([ 'class' => '', @@ -48,13 +48,15 @@ class template { 'name' => $nameId, 'value' => '' ], $attributes); - // Génère deux nombres pour le capcha - $firstNumber = mt_rand(1, 15); - $secondNumber = mt_rand(1, 15); + // Génère deux nombres pour le captcha + $numbers=array(0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20); + $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'); + $firstNumber=rand ( 0 , count($letters)-1 ); + $secondNumber=rand ( 0 , count($letters)-1 ); // Début du wrapper $html = '
'; // Label - $html .= self::label($attributes['id'], $firstNumber . ' + ' . $secondNumber . ' = ?', [ + $html .= self::label($attributes['id'], $letters[$firstNumber] . ' + ' . $letters[$secondNumber] . ' = ? (réponse en chiffres)', [ 'help' => $attributes['help'] ]); // Notice @@ -64,7 +66,7 @@ class template { $attributes['class'] .= ' notice'; } $html .= self::notice($attributes['id'], $notice); - // Capcha + // captcha $html .= sprintf( '', helper::sprintAttributes($attributes) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index f0b3d7a9..5e7397a1 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -632,7 +632,7 @@ class init extends common { 'contact' => [ 'config' => [ 'button' => '', - 'capcha' => true, + 'captcha' => true, 'group' => self::GROUP_ADMIN, 'pageId' => '', 'subject' => '' diff --git a/module/blog/blog.php b/module/blog/blog.php index 67f3a7e5..0709be0f 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -339,12 +339,12 @@ class blog extends common { else { // Soumission du formulaire if($this->isPost()) { - // Check la capcha + // Check la captcha if( $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - AND $this->getInput('blogArticleCapcha', helper::FILTER_INT) !== $this->getInput('blogArticleCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticleCapchaSecondNumber', helper::FILTER_INT)) + AND $this->getInput('blogArticlecaptcha', helper::FILTER_INT) !== $this->getInput('blogArticlecaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('blogArticlecaptchaSecondNumber', helper::FILTER_INT)) { - self::$inputNotices['blogArticleCapcha'] = 'Incorrect'; + self::$inputNotices['blogArticlecaptcha'] = 'Incorrect'; } // Crée le commentaire $commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment'])); diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index e3386281..8ce7acb4 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -75,7 +75,7 @@ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
- +
diff --git a/module/form/form.php b/module/form/form.php index b419f074..3332afc6 100755 --- a/module/form/form.php +++ b/module/form/form.php @@ -77,7 +77,7 @@ class form extends common { 'config', [ 'button' => $this->getInput('formConfigButton'), - 'capcha' => $this->getInput('formConfigCapcha', helper::FILTER_BOOLEAN), + 'captcha' => $this->getInput('formConfigcaptcha', helper::FILTER_BOOLEAN), 'group' => $this->getInput('formConfigGroup', helper::FILTER_INT), 'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)], 'mail' => $this->getInput('formConfigMail') , @@ -279,12 +279,12 @@ class form extends common { public function index() { // Soumission du formulaire if($this->isPost()) { - // Check la capcha + // Check la captcha if( - $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) - AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT)) + $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) + AND $this->getInput('formcaptcha', helper::FILTER_INT) !== $this->getInput('formcaptchaFirstNumber', helper::FILTER_INT) + $this->getInput('formcaptchaSecondNumber', helper::FILTER_INT)) { - self::$inputNotices['formCapcha'] = 'Incorrect'; + self::$inputNotices['formcaptcha'] = 'Incorrect'; } // Préparation le contenu du mail diff --git a/module/form/view/config/config.php b/module/form/view/config/config.php index 47ada59d..7eae904c 100755 --- a/module/form/view/config/config.php +++ b/module/form/view/config/config.php @@ -142,8 +142,8 @@ ]); ?>
- $this->getData(['module', $this->getUrl(0), 'config', 'capcha']) + $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) ]); ?>
diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 4fe54a9a..e1dc4422 100755 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -43,10 +43,10 @@ - getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?> + getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
- +