/**
  * @see Form::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get contest
     if (!$this->contest->isCommentable()) {
         throw new PermissionDeniedException();
     }
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get user
     require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
     $this->user = new UserProfile($this->userID);
     if (!$this->user->userID) {
         throw new IllegalLinkException();
     }
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     CaptchaForm::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->commentID = intval($_REQUEST['id']);
     }
     $this->entry = new ContestCommentEditor($this->commentID);
     if (!$this->entry->commentID || !$this->entry->isEditable()) {
         throw new IllegalLinkException();
     }
 }
Ejemplo n.º 4
0
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get user
     if (isset($_REQUEST['userID'])) {
         $this->userID = intval($_REQUEST['userID']);
     }
     require_once WCF_DIR . 'lib/data/user/UserProfile.class.php';
     $this->user = new UserProfile($this->userID);
     if (!$this->user->userID) {
         throw new IllegalLinkException();
     }
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['modify'])) {
         $this->modify = (bool) intval($_REQUEST['modify']);
     }
     if (isset($_REQUEST['searchID'])) {
         $this->searchID = intval($_REQUEST['searchID']);
         if (!$this->modify) {
             // searchID given. show result page
             require_once WCF_DIR . 'lib/page/SearchResultPage.class.php';
             new SearchResultPage($this->searchID);
             exit;
         }
     }
     if (isset($_REQUEST['q'])) {
         $this->query = StringUtil::trim($_REQUEST['q']);
     }
     if (isset($_REQUEST['defaultQuery'])) {
         $this->defaultQuery = StringUtil::trim($_REQUEST['defaultQuery']);
     }
     if (isset($_REQUEST['username'])) {
         $this->username = StringUtil::trim($_REQUEST['username']);
     }
     if (isset($_REQUEST['userID'])) {
         $this->userID = intval($_REQUEST['userID']);
     }
     if (isset($_REQUEST['types']) && is_array($_REQUEST['types'])) {
         $this->types = $_REQUEST['types'];
     }
     $this->submit = count($_POST) || !empty($this->query) || !empty($this->username) || $this->userID;
     // modify existing search
     if ($this->modify) {
         // get search data
         $sql = "SELECT \t*\n\t\t\t\tFROM\twcf" . WCF_N . "_search\n\t\t\t\tWHERE\tsearchID = " . $this->searchID . "\n\t\t\t\t\tAND searchType = 'messages'\n\t\t\t\t\tAND userID = " . WCF::getUser()->userID;
         $search = WCF::getDB()->getFirstRow($sql);
         if (!isset($search['searchID']) || $search['userID'] && $search['userID'] != WCF::getUser()->userID) {
             throw new IllegalLinkException();
         }
         $this->searchData = unserialize($search['searchData']);
         if (empty($this->searchData['alterable'])) {
             throw new IllegalLinkException();
         }
         $this->query = $this->searchData['query'];
         $this->sortOrder = $this->searchData['sortOrder'];
         $this->sortField = $this->searchData['sortField'];
         $this->nameExactly = $this->searchData['nameExactly'];
         $this->fromDay = $this->searchData['fromDay'];
         $this->fromMonth = $this->searchData['fromMonth'];
         $this->fromYear = $this->searchData['fromYear'];
         $this->untilDay = $this->searchData['untilDay'];
         $this->untilMonth = $this->searchData['untilMonth'];
         $this->untilYear = $this->searchData['untilYear'];
         $this->username = $this->searchData['username'];
         $this->userID = $this->searchData['userID'];
         $this->types = $this->searchData['types'];
         if (count($_POST)) {
             $this->submit = true;
         }
     }
     // sort order
     if (isset($_REQUEST['sortField'])) {
         $this->sortField = $_REQUEST['sortField'];
     }
     switch ($this->sortField) {
         case 'subject':
         case 'time':
         case 'username':
             break;
         case 'relevance':
             if (!$this->submit || !empty($this->query)) {
                 break;
             }
         default:
             if (!$this->submit || !empty($this->query)) {
                 $this->sortField = 'relevance';
             } else {
                 $this->sortField = 'time';
             }
     }
     if (isset($_REQUEST['sortOrder'])) {
         $this->sortOrder = $_REQUEST['sortOrder'];
         switch ($this->sortOrder) {
             case 'ASC':
             case 'DESC':
                 break;
             default:
                 $this->sortOrder = 'DESC';
         }
     }
 }