/**
  * @private
  */
 function _getDestination()
 {
     $dest = HttpVars::getRequestValue("dest");
     $val = new IntegerValidator();
     if (!$val->validate($dest) || $dest < 1 || $dest > 3) {
         $dest = 1;
     }
     return $dest;
 }
 function validate()
 {
     // if the album id is not vald, let's start from the top album again
     $this->_albumId = $this->_request->getValue("albumId");
     $val = new IntegerValidator();
     if (!$val->validate($this->_albumId)) {
         $this->_albumId = 0;
     }
     return true;
 }
 function validate()
 {
     $this->_articleId = $this->_request->getValue("articleId");
     $val = new IntegerValidator();
     if (!$val->validate($this->_articleId)) {
         $this->_view = new nErrorView($this->_blogInfo);
         $this->_view->setMessage($this->_locale->tr("error_incorrect_article_id"));
         $this->setCommonData();
         return false;
     }
     return true;
 }
 /**
  * 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();
 }
 /**
  * Validates a given value thereby considering the state of the field
  * that a specific validator instance is related to.
  *
  * @param mixed $value
  *
  * @return boolean
  */
 public function validate($value)
 {
     if (is_array($value)) {
         foreach ($value as $int) {
             if (!parent::validate($int)) {
                 return false;
             }
         }
     } elseif (!empty($value)) {
         return false;
     }
     return true;
 }
 /**
  * retrieves the current status from the request
  *
  * @private
  * @return nothing
  */
 function getStatusFromRequest()
 {
     $status = HttpVars::getRequestValue("status");
     // validate the value
     $val = new IntegerValidator();
     if (!$val->validate($status)) {
         $status = UserStatus::getDefaultStatus();
     }
     // if the value validated, check if it is a valid status
     if (!UserStatus::isValidStatus($status)) {
         $status = UserStatus::getDefaultStatus();
     }
     return $status;
 }
 function validate()
 {
     $this->_resourceId = $this->_request->getValue("resId");
     $this->_resourceName = $this->_request->getValue("resource");
     $this->_albumId = $this->_request->getValue("albumId");
     $this->_albumName = $this->_request->getValue("albumName");
     if ($this->_resourceName == "") {
         $validator = new IntegerValidator();
         // if the information is not correct, we better show a message and quit
         if (!$validator->validate($this->_resourceId)) {
             $this->_view = new ErrorView($this->_blogInfo, "error_incorrect_resource_id");
             $this->setCommonData();
             return false;
         }
     }
     // if no album id parameter in the url, forget about the whole thing
     if ($this->_albumId == "" && $this->_albumName == "") {
         $this->_albumId = -1;
     }
     return true;
 }
 function validate()
 {
     // fetch the validated data
     $this->_postLinks = $this->_request->getValue("postLink");
     $this->_trackbackLinks = $this->_request->getValue("trackbackLink");
     $this->_postId = $this->_request->getValue("postId");
     $intval = new IntegerValidator();
     if (!$intval->validate($this->_postId)) {
         $this->_view = new AdminPostsListView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_incorrect_article_id"));
         $this->setCommonData();
         return false;
     }
     $arrryval = new ArrayValidator();
     if (!$arrryval->validate($this->_postLinks) && !$arrryval->validate($this->_trackbackLinks)) {
         $this->_view = new AdminPostsListView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_no_trackback_links_sent"));
         $this->setCommonData();
         return false;
     }
     return true;
 }
 public function validate()
 {
     parent::validate();
     $this->assertMinInclusive($this->tdo->_text(), $this::MININCLUSIVE);
 }
Пример #10
0
 /**
  * gets the current page from the HTTP request
  *
  * @return the page number from the request
  * @static
  */
 function getCurrentPageFromRequest()
 {
     // get the value from the request
     $page = HttpVars::getRequestValue(VIEW_DEFAULT_PAGE_PARAMETER);
     // but first of all, validate it
     $val = new IntegerValidator();
     if (!$val->validate($page)) {
         $page = VIEW_DEFAULT_START_PAGE;
     }
     return $page;
 }