Files
grzanieplus.pl/plugins/sfCaptchaGDPlugin/lib/sfCaptchaGDValidator.class.php
2025-03-12 17:06:23 +01:00

36 lines
961 B
PHP

<?php
class sfCaptchaGDValidator extends sfValidator
{
public function execute (&$value, &$error)
{
$captcha = $value;
$session_captcha = $this->getParameter('captcha_ref');
if($captcha != $session_captcha)
{
//sfContext::getInstance()->getUser()->setAttribute('captcha', NULL);
$error = $this->getParameter('captcha_error');
return false;
}
return true;
}
public function initialize ($context, $parameters = null)
{
// Initialize parent
parent::initialize($context);
// Set default parameters value
$this->setParameter('captcha_ref', $context->getUser()->getAttribute('captcha'));
$this->setParameter('captcha_error', 'Неверный код');
// Set parameters
$this->getParameterHolder()->add($parameters);
return true;
}
}
?>