public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     $sess = new Kwf_Session_Namespace('recaptcha');
     if ($sess->validated) {
         //if user did solve one captcha we store that in session and don't annoy him again
         return $ret;
     }
     if (empty($_POST["recaptcha_challenge_field"]) || empty($_POST["recaptcha_response_field"])) {
         $ret[] = array('message' => trlKwf('Please solve captcha correctly'), 'field' => $this);
         return $ret;
     }
     require_once 'vendor/koala-framework/recaptcha-php/recaptchalib.php';
     $resp = recaptcha_check_answer(Kwf_Config::getValue('recaptcha.privateKey'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
     if (!$resp->is_valid) {
         $msg = $resp->error;
         if ($msg == 'incorrect-captcha-sol') {
             $msg = trlKwf('Please solve captcha correctly');
         }
         $ret[] = array('message' => $msg, 'field' => $this);
     } else {
         $sess->validated = true;
     }
     return $ret;
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     if (isset($this->_validators['samePassword'])) {
         $password1 = $postData[$this->_passwordField1->getFieldName()];
         $password2 = $postData[$this->_passwordField2->getFieldName()];
         $validator = $this->_validators['samePassword'];
         if (!$validator->isValid(array($password1, $password2))) {
             $ret[] = array('messages' => $validator->getMessages(), 'field' => $this->_passwordField1);
         }
     }
     return $ret;
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     $data = $this->_getValueFromPostData($postData);
     if (!is_string($data)) {
         return $ret;
     }
     $data = Zend_Json::decode($data);
     $dimensions = $this->getDimensions();
     reset($dimensions);
     if ($this->getAllowBlank() === false || $this->getAllowBlank() === 0 || $this->getAllowBlank() === '0') {
         if (!isset($dimensions[$data['dimension']])) {
             $ret[] = array('message' => trlKwf("Please fill out the field"), 'field' => $this);
         }
     }
     if (!empty($data['dimension'])) {
         $dimension = $dimensions[$data['dimension']];
     } else {
         $dimension = current($dimensions);
     }
     return $ret;
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     $data = $this->_getValueFromPostData($postData);
     foreach ($this->getValidators() as $v) {
         // folgende if ist, weils es zB bei einem Date Validator keinen
         // sinn macht zu validieren wenn kein wert da ist. da macht dann
         // nur mehr der NotEmpty sinn
         if ((is_null($data) || $data === '') && !$v instanceof Zend_Validate_NotEmpty) {
             continue;
         }
         if ($v instanceof Kwf_Validate_Row_Abstract) {
             $v->setField($this->getName());
             $isValid = $v->isValidRow($data, $row);
         } else {
             $isValid = $v->isValid($data);
         }
         if (!$isValid) {
             $ret[] = array('messages' => $v->getMessages(), 'field' => $this);
         }
     }
     return $ret;
 }
 public function validate($parentRow, $postData = array())
 {
     $row = $this->_getRowByParentRow($parentRow);
     return parent::validate($row, $postData);
 }
 public function validate($row, $postData)
 {
     $ret = parent::validate($row, $postData);
     $dataModel = $row->getModel();
     if ($dataModel) {
         $this->setDataModel($dataModel);
     }
     if (!is_null($this->getAllowBlank()) && !$this->getAllowBlank()) {
         if (!count($this->_getIdsFromPostData($postData))) {
             $ret[] = array('message' => $this->getEmptyMessage(), 'field' => $this);
         }
     }
     return $ret;
 }