function validate()
 {
     $this->_userNameHash = $this->_request->getValue("b");
     $this->_requestHash = $this->_request->getValue("a");
     // check that the parameters are there...
     $val = new StringValidator();
     if (!$val->validate($this->_userNameHash) || !$val->validate($this->_requestHash)) {
         $this->_view = new SummaryView("summaryerror");
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_request"));
         return false;
     }
     return true;
 }
 /**
  * @covers StringValidator::setPatternValid
  * @todo Implement testSetPatternValid().
  */
 public function testSetRequiredValid()
 {
     $errorMsg = "The input is required";
     $this->object->setRequireValid($errorMsg);
     $testValue = "";
     $result = $this->object->validate($testValue);
     $this->assertEquals($result[0], $errorMsg);
     $this->object->setRequireValid();
     $testValue = "";
     $errorMsg = "ERROR!";
     $result = $this->object->validate($testValue);
     $this->assertEquals($result[0], $errorMsg);
 }
 function validate()
 {
     $this->_debug = false;
     $this->_hostname = $this->_request->getValue("hostname");
     $this->_username = $this->_request->getValue("username");
     $this->_password = $this->_request->getValue("password");
     $this->_dbname = $this->_request->getValue("dbname");
     $this->_prefix = $this->_request->getValue("prefix");
     $this->_profile = $this->_request->getValue("profile");
     $val = new StringValidator();
     if (!$val->validate($this->_hostname) || !$val->validate($this->_username) || !$val->validate($this->_password) || !$val->validate($this->_dbname) || !$val->validate($this->_profile)) {
         $this->_view = new AdminErrorView($this->_blogInfo);
         $this->_view->setMessage("There was an error:  either your inputted hostname, usernae, password, dbname, or profile were invalid.  Please try again.");
         $this->setCommonData();
         return false;
     }
     return true;
 }
 function validate()
 {
     $this->_helpId = trim($this->_request->getValue("helpId"));
     $val = new StringValidator();
     if (!$val->validate($this->_helpId)) {
         $this->_view = new AdminSimpleErrorView();
         $this->_view->setValue("error", "Incorrect identifier.");
         return false;
     }
     return true;
 }
 function validate()
 {
     $this->_host = $this->_request->getValue("hostIp");
     $val = new StringValidator();
     if (!$val->validate($this->_host)) {
         $this->_view = new AdminErrorView($this->_blogInfo);
         $this->_view->setMessage("The host address is not correct.");
         $this->setCommonData();
         return false;
     }
     return true;
 }
 function validate()
 {
     $this->_searchTerms = $this->_request->getValue("searchTerms");
     // if the search terms are not correct, let's return an error message
     $val = new StringValidator();
     if (!$val->validate($this->_searchTerms)) {
         $this->_view = new SummaryView("summaryerror");
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_search_terms"));
         return false;
     }
     return true;
 }
Пример #7
0
 public function validate($input)
 {
     $pre = parent::validate($input);
     if ($pre !== true) {
         return $pre;
     }
     if ($input[2] !== '/' || $input[5] !== '/') {
         return self::$ERROR_WRONG_SEPARATOR;
     }
     list($day, $month, $year) = explode('/', $input);
     if ($day <= 0 || $day > 31 || $month <= 0 || $month > 12 || $year <= 0 || $year >= 3000) {
         return self::$ERROR_NOT_VALID;
     }
     return true;
 }
Пример #8
0
 public function validate($value)
 {
     $parentValidation = parent::validate($value);
     if ($parentValidation === true) {
         if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) {
             return self::$ERROR_SYNTAX_INVALID;
         }
         $host = substr($value, strpos($value, '@') + 1);
         if ($this->options['checkMX'] && !$this->checkMX($host)) {
             return self::$ERROR_HOST_VALID;
         }
         if ($this->options['checkHost'] && $this->checkHost($host)) {
             return self::$ERROR_HOST_VALID;
         }
         return true;
     } else {
         return $parentValidation;
     }
 }
 function validate()
 {
     $this->_pluginEnabled = $this->_request->getValue("pluginEnabled");
     $this->_pluginEnabled = $this->_pluginEnabled != "";
     $this->_maxBackupFiles = $this->_request->getValue("maxBackupFiles");
     if ($this->_maxBackupFiles <= 0 || !ctype_digit($this->_maxBackupFiles)) {
         $this->_view = new PluginTemplateEditorConfigView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("templateeditor_error_maxbackupfiles"));
         $this->setCommonData();
         return false;
     }
     $this->_allowedExtension = $this->_request->getValue("allowedExtension");
     $val = new StringValidator();
     if (!$val->validate($this->_allowedExtension)) {
         $this->_view = new PluginTemplateEditorConfigView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("templateeditor_error_allowedextension"));
         $this->setCommonData();
         return false;
     }
     return true;
 }