/** * Check that the parameter is correct. */ function validate() { // let's make sure that the "page" parameter has a sane value // and that it is not below 0 $val = new IntegerValidator(); $this->_page = $this->_request->getValue("page"); if (!$val->validate($this->_page) || $this->_page < 0) { $this->_page = 1; } // run the real validation stuff... return parent::validate(); }
function validate() { if (!parent::validate()) { $resources = new GalleryResources(); $resource = $resources->getResource($this->_request->getValue("resourceId"), $this->_blogInfo->getId()); if (!$resource) { $this->setValidationErrorView(new AdminResourcesListView($this->_blogInfo)); $this->setCommonData(); return false; } $this->_view->setValue("resource", $resource); return false; } return true; }
/** * Validates that the information we've just received from the blog settings * form is valid... We have to be really sure about this one!!! */ function validate() { // if all correct, we can proceed $this->_userPassword = trim($this->_request->getValue("userSettingsPassword")); $this->_userConfirmPassword = trim($this->_request->getValue("confirmPassword")); $valid = parent::validate(); // check that the password is correct and confirm it if ($this->_userPassword != "") { $passwordVal = new PasswordValidator(); if (!$passwordVal->validate($this->_userPassword)) { $this->_form->setFieldValidationStatus("userSettingsPassword", false); $this->setCommonData(true); return false; } if ($this->_userPassword != $this->_userConfirmPassword) { $this->_form->setFieldValidationStatus("confirmPassword", false); $this->setCommonData(true); return false; } } return $valid; }