Source for file jFormsControlCaptcha.class.php

Documentation is available at jFormsControlCaptcha.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  forms
  5. @author      Laurent Jouanneau
  6. @contributor
  7. @copyright   2006-2008 Laurent Jouanneau
  8. @link        http://www.jelix.org
  9. @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  10. */
  11.  
  12.  
  13. /**
  14.  * captcha control
  15.  * @package     jelix
  16.  * @subpackage  forms
  17.  * @since 1.1
  18.  */
  19. class jFormsControlCaptcha extends jFormsControl {
  20.     public $type = 'captcha';
  21.     public $question='';
  22.     public $required = true;
  23.     function check(){
  24.         $value $this->container->data[$this->ref];
  25.         if(trim($value== ''{
  26.             return $this->container->errors[$this->refjForms::ERRDATA_REQUIRED;
  27.         }elseif($value !=  $this->container->privateData[$this->ref]){
  28.             return $this->container->errors[$this->refjForms::ERRDATA_INVALID;
  29.         }
  30.         return null;
  31.     }
  32.  
  33.     function initExpectedValue(){
  34.         $numbers jLocale::get('jelix~captcha.number');
  35.         $id rand(1,intval($numbers));
  36.         $this->question = jLocale::get('jelix~captcha.question.'.$id);
  37.         $this->container->privateData[$this->refjLocale::get('jelix~captcha.response.'.$id);
  38.     }
  39. }

Documentation generated on Thu, 22 Mar 2012 22:15:54 +0100 by phpDocumentor 1.4.3