コード例 #1
0
ファイル: MailForm.class.php プロジェクト: nick-strohm/WCF
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->userID = intval($_REQUEST['id']);
     }
     $this->user = UserProfile::getUserProfile($this->userID);
     if ($this->user === null) {
         throw new IllegalLinkException();
     }
     // validate ignore status
     if (WCF::getUser()->userID && $this->user->isIgnoredUser(WCF::getUser()->userID)) {
         throw new PermissionDeniedException();
     }
     $this->canonicalURL = LinkHandler::getInstance()->getLink('Mail', array('object' => $this->user->getDecoratedObject()));
 }
コード例 #2
0
ファイル: LoginForm.class.php プロジェクト: nick-strohm/WCF
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (!empty($_REQUEST['url'])) {
         $this->url = StringUtil::trim($_REQUEST['url']);
         // discard URL if it is not an absolute URL of local content
         if (!ApplicationHandler::getInstance()->isInternalURL($this->url)) {
             $this->url = '';
         }
     }
     // check authentication failures
     if (ENABLE_USER_AUTHENTICATION_FAILURE) {
         $failures = UserAuthenticationFailure::countIPFailures(UserUtil::getIpAddress());
         if (USER_AUTHENTICATION_FAILURE_IP_BLOCK && $failures >= USER_AUTHENTICATION_FAILURE_IP_BLOCK) {
             throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.user.login.blocked'));
         }
         if (USER_AUTHENTICATION_FAILURE_IP_CAPTCHA && $failures >= USER_AUTHENTICATION_FAILURE_IP_CAPTCHA) {
             $this->useCaptcha = true;
         } else {
             if (USER_AUTHENTICATION_FAILURE_USER_CAPTCHA) {
                 if (isset($_POST['username'])) {
                     $user = User::getUserByUsername(StringUtil::trim($_POST['username']));
                     if (!$user->userID) {
                         $user = User::getUserByEmail(StringUtil::trim($_POST['username']));
                     }
                     if ($user->userID) {
                         $failures = UserAuthenticationFailure::countUserFailures($user->userID);
                         if (USER_AUTHENTICATION_FAILURE_USER_CAPTCHA && $failures >= USER_AUTHENTICATION_FAILURE_USER_CAPTCHA) {
                             $this->useCaptcha = true;
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: SearchForm.class.php プロジェクト: nick-strohm/WCF
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['q'])) {
         $this->query = StringUtil::trim($_REQUEST['q']);
     }
     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->selectedObjectTypes = $_REQUEST['types'];
         // validate given values
         foreach ($this->selectedObjectTypes as $objectTypeName) {
             if (SearchEngine::getInstance()->getObjectType($objectTypeName) === null) {
                 throw new IllegalLinkException();
             }
         }
     }
     $this->submit = !empty($_POST) || !empty($this->query) || !empty($this->username) || $this->userID;
     if (isset($_REQUEST['modify'])) {
         $this->modifySearchID = intval($_REQUEST['modify']);
         $this->modifySearch = new Search($this->modifySearchID);
         if (!$this->modifySearch->searchID || $this->modifySearch->userID && $this->modifySearch->userID != WCF::getUser()->userID) {
             throw new IllegalLinkException();
         }
         $this->searchData = unserialize($this->modifySearch->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->subjectOnly = $this->searchData['subjectOnly'];
         $this->startDate = $this->searchData['startDate'];
         $this->endDate = $this->searchData['endDate'];
         $this->username = $this->searchData['username'];
         $this->userID = $this->searchData['userID'];
         $this->selectedObjectTypes = $this->searchData['selectedObjectTypes'];
         if (!empty($_POST)) {
             $this->submit = true;
         }
     }
     // disable check for security token for GET requests
     if ($this->submit) {
         $_POST['t'] = WCF::getSession()->getSecurityToken();
     }
     // 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';
         }
     }
 }
コード例 #4
0
ファイル: MessageForm.class.php プロジェクト: nick-strohm/WCF
 /**
  * @see	\wcf\form\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['tmpHash'])) {
         $this->tmpHash = $_REQUEST['tmpHash'];
     }
     if (empty($this->tmpHash)) {
         $this->tmpHash = WCF::getSession()->getVar('__wcfAttachmentTmpHash');
         if ($this->tmpHash === null) {
             $this->tmpHash = StringUtil::getRandomID();
         } else {
             WCF::getSession()->unregister('__wcfAttachmentTmpHash');
         }
     }
     if ($this->enableMultilingualism) {
         $this->availableContentLanguages = LanguageFactory::getInstance()->getContentLanguages();
         if (WCF::getUser()->userID) {
             foreach ($this->availableContentLanguages as $key => $value) {
                 if (!in_array($key, WCF::getUser()->getLanguageIDs())) {
                     unset($this->availableContentLanguages[$key]);
                 }
             }
         }
     }
 }