Add namespace.
This commit is contained in:
30
Captcha/CaptchaValidator.php
Normal file
30
Captcha/CaptchaValidator.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link http://netmonsters.ru
|
||||
* @package Majestic
|
||||
* @subpackage validator
|
||||
* @since 2010-04-26
|
||||
*/
|
||||
|
||||
class CaptchaValidator extends Validator
|
||||
{
|
||||
|
||||
const WRONG_CODE = 'is_empty';
|
||||
|
||||
protected $templates = array(self::WRONG_CODE => 'Entered code wrong');
|
||||
|
||||
public function isValid($value, $context = null)
|
||||
{
|
||||
if (!$context || !isset($context['ctoken']) || !isset($context['ccode'])) {
|
||||
$this->error();
|
||||
return false;
|
||||
}
|
||||
$captcha = new Captcha();
|
||||
if ($captcha->checkCode($context['ctoken'], $context['ccode'])) {
|
||||
return true;
|
||||
}
|
||||
$this->error();
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user