import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -220,6 +220,10 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
{
if (!isset($this->_session) || (null === $this->_session)) {
$id = $this->getId();
if (!class_exists($this->_sessionClass)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($this->_sessionClass);
}
$this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id);
$this->_session->setExpirationHops(1, null, true);
$this->_session->setExpirationSeconds($this->getTimeout());
@ -322,21 +326,34 @@ abstract class Zend_Captcha_Word extends Zend_Captcha_Base
*/
public function isValid($value, $context = null)
{
$name = $this->getName();
if (!isset($context[$name]['input'])) {
if (!is_array($value) && !is_array($context)) {
$this->_error(self::MISSING_VALUE);
return false;
}
$value = strtolower($context[$name]['input']);
$this->_setValue($value);
if (!is_array($value) && is_array($context)) {
$value = $context;
}
if (!isset($context[$name]['id'])) {
$name = $this->getName();
if (isset($value[$name])) {
$value = $value[$name];
}
if (!isset($value['input'])) {
$this->_error(self::MISSING_VALUE);
return false;
}
$input = strtolower($value['input']);
$this->_setValue($input);
if (!isset($value['id'])) {
$this->_error(self::MISSING_ID);
return false;
}
$this->_id = $context[$name]['id'];
if ($value !== $this->getWord()) {
$this->_id = $value['id'];
if ($input !== $this->getWord()) {
$this->_error(self::BAD_CAPTCHA);
return false;
}