/** * @see Form::validate() */ public function validate() { // check valide email from guest if (!WCF::getUser()->userID) { if (empty($this->email)) { throw new UserInputException('email'); } if (!UserUtil::isValidEmail($this->email)) { throw new UserInputException('email', 'notValid'); } // check empty username if (empty($this->username)) { throw new UserInputException('username'); } } // check empty subject if (empty($this->subject)) { throw new UserInputException('subject'); } // check empty message if (empty($this->message)) { throw new UserInputException('message'); } parent::validate(); }
/** * @see Form::validate() */ public function validate() { parent::validate(); if (empty($this->comment)) { throw new UserInputException('comment'); } if (StringUtil::length($this->comment) > WCF::getUser()->getPermission('user.contest.maxSolutionLength')) { throw new UserInputException('comment', 'tooLong'); } // username $this->validateUsername(); }
/** * @see Form::validate() */ public function validate() { if (!WCF::getUser()->userID) { if (empty($this->email)) { throw new UserInputException('email'); } if (!UserUtil::isValidEmail($this->email)) { throw new UserInputException('email', 'notValid'); } } if (empty($this->subject)) { throw new UserInputException('subject'); } if (empty($this->message)) { throw new UserInputException('message'); } parent::validate(); }
/** * @see Form::validate() */ public function validate() { parent::validate(); if (empty($this->username) && empty($this->email)) { throw new UserInputException('username'); } if (!empty($this->username)) { $this->user = new User(null, null, $this->username); if (!$this->user->userID) { throw new UserInputException('username', 'notFound'); } } else { $this->user = new User(null, null, null, $this->email); if (!$this->user->userID) { throw new UserInputException('email', 'notFound'); } } // check whether a lost password request was sent in the last 24 hours if ($this->user->lastLostPasswordRequest && TIME_NOW - 86400 < $this->user->lastLostPasswordRequest) { throw new NamedUserException(WCF::getLanguage()->get('wcf.user.lostPassword.error.tooManyRequests', array('$hours' => ceil(($this->user->lastLostPasswordRequest - (TIME_NOW - 86400)) / 3600)))); } }
/** * @see Form::validate() */ public function validate() { CaptchaForm::validate(); // validate moduleID if (empty($this->moduleID)) { throw new UserInputException('moduleID', 'empty'); } // create module object $this->module = new DynamicPageModuleTemplate($this->moduleID); // get dependencies $sql = "SELECT\r\n\t\t\t\t\tdependency.dependency\r\n\t\t\t\tFROM\r\n\t\t\t\t\twcf" . WCF_N . "_package_dependency dependency\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tdependency.packageID = " . PACKAGE_ID; $result = WCF::getDB()->sendQuery($sql); $packageIDs = array(PACKAGE_ID); while ($row = WCF::getDB()->fetchArray($result)) { $packageIDs[] = $row['dependency']; } // validate module row if (!$this->module->moduleID or !in_array($this->module->packageID, $packageIDs)) { throw new UserInputException('moduleID', 'invalid'); } // validate position if (!in_array($this->position, $this->availablePositions)) { $this->position = 'top'; } }
/** * @see Form::validate() */ public function validate() { // subject $this->validateSubject(); // text $this->validateText(); parent::validate(); }
/** * @see Form::validate() */ public function validate() { parent::validate(); // get search conditions $conditions = $this->getConditions(); // check query and author if (empty($this->query) && empty($this->username) && !$this->userID) { throw new UserInputException('q'); } // build search hash $this->searchHash = StringUtil::getHash(serialize(array($this->query, $this->types, !$this->subjectOnly, $conditions, $this->sortField . ' ' . $this->sortOrder, PACKAGE_ID))); // check search hash if (!empty($this->query)) { $sql = "SELECT\tsearchID\n\t\t\t\tFROM\twcf" . WCF_N . "_search\n\t\t\t\tWHERE\tsearchHash = '" . $this->searchHash . "'\n\t\t\t\t\tAND userID = " . WCF::getUser()->userID . "\n\t\t\t\t\tAND searchType = 'messages'\n\t\t\t\t\tAND searchDate > " . (TIME_NOW - 1800); $row = WCF::getDB()->getFirstRow($sql); if (isset($row['searchID'])) { HeaderUtil::redirect('index.php?form=Search&searchID=' . $row['searchID'] . '&highlight=' . urlencode($this->query) . SID_ARG_2ND_NOT_ENCODED); exit; } } // do search $this->result = $this->engine->search($this->query, $this->types, $conditions, $this->sortField . ' ' . $this->sortOrder); // result is empty if (count($this->result) == 0) { $this->throwNoMatchesException(); } }
/** * @see Form::validate() */ public function validate() { CaptchaForm::validate(); }