Beispiel #1
0
 /**
  * Validate input parameters.
  *
  * @return var
  */
 public function validateInput($validationRules)
 {
     if (CSession::keyExists('formData')) {
         $input = array_merge($_REQUEST, CSession::getValue('formData'));
         CSession::unsetValue(['formData']);
     } else {
         $input = $_REQUEST;
     }
     $validator = new CNewValidator($input, $validationRules);
     foreach ($validator->getAllErrors() as $error) {
         info($error);
     }
     if ($validator->isErrorFatal()) {
         $this->validationResult = self::VALIDATION_FATAL_ERROR;
     } else {
         if ($validator->isError()) {
             $this->input = $validator->getValidInput();
             $this->validationResult = self::VALIDATION_ERROR;
         } else {
             $this->input = $validator->getValidInput();
             $this->validationResult = self::VALIDATION_OK;
         }
     }
     return $this->validationResult == self::VALIDATION_OK;
 }