/** * Gets the search query keywords. */ protected static function getSearchQuery() { self::$searchQuery = false; if (isset($_GET['highlight'])) { $keywordString = $_GET['highlight']; // remove search operators $keywordString = preg_replace('/[\\+\\-><()~\\*]+/', '', $keywordString); if (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') { // phrases search $keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1)); if (!empty($keywordString)) { self::$searchQuery = $keywordString; } } else { self::$searchQuery = ArrayUtil::trim(explode(' ', $keywordString)); if (count(self::$searchQuery) == 0) { self::$searchQuery = false; } else { if (count(self::$searchQuery) == 1) { self::$searchQuery = reset(self::$searchQuery); } } } } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['path'])) { $this->path = StringUtil::trim($_POST['path']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['title'])) { $this->title = StringUtil::trim($_POST['title']); } if (isset($_POST['points'])) { $this->points = abs(intval($_POST['points'])); } if (isset($_POST['expiresWeek'])) { $this->expiresWeek = intval($_POST['expiresWeek']); } if (isset($_POST['expiresDay'])) { $this->expiresDay = intval($_POST['expiresDay']); } if (isset($_POST['expiresHour'])) { $this->expiresHour = intval($_POST['expiresHour']); } if (isset($_POST['suspensionType'])) { $this->suspensionType = $_POST['suspensionType']; } if (isset($_POST['send'])) { $this->send = (bool) $_POST['send']; } // get type object if ($this->suspensionType && isset($this->availableSuspensionTypes[$this->suspensionType])) { $this->suspensionTypeObject = $this->availableSuspensionTypes[$this->suspensionType]; } if ($this->suspensionTypeObject !== null && $this->send) { $this->suspensionTypeObject->readFormParameters(); } }
/** * Parses search keywords. * * @param string $keywordString */ protected static function parseKeywords($keywordString) { // convert encoding if necessary if (CHARSET == 'UTF-8' && !StringUtil::isASCII($keywordString) && !StringUtil::isUTF8($keywordString)) { $keywordString = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $keywordString); } // remove bad wildcards $keywordString = preg_replace('/(?<!\\w)\\*/', '', $keywordString); // remove search operators $keywordString = preg_replace('/[\\+\\-><()~]+/', '', $keywordString); if (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') { // phrases search $keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1)); if (!empty($keywordString)) { self::$keywords = array_merge(self::$keywords, array(StringUtil::encodeHTML($keywordString))); } } else { // replace word delimiters by space $keywordString = preg_replace('/[.,]/', ' ', $keywordString); $keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString))); if (count($keywords) > 0) { self::$keywords = array_merge(self::$keywords, $keywords); } } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['type'])) { $this->type = StringUtil::trim($_REQUEST['type']); } if (isset($_REQUEST['name'])) { $this->name = StringUtil::trim($_REQUEST['name']); } if (isset($_REQUEST['startInput']) && !empty($_REQUEST['startInput'])) { $this->start = LWUtil::checkInt($_REQUEST['startInput'], 1); if ($this->start >= 1 && $this->start <= 99) { // e.g. 5 => 501; 14 => 1401 $this->start *= 100; $this->start++; } } else { if (isset($_REQUEST['start'])) { $this->start = LWUtil::checkInt($_REQUEST['start'], 0); } else { if (isset($_REQUEST['relationalID'])) { $this->relationalID = LWUtil::checkInt($_REQUEST['relationalID']); } } } if (isset($_REQUEST['rowCount'])) { $this->rowCount = LWUtil::checkInt($_REQUEST['rowCount'], 10, 500); } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['q'])) { $this->input = StringUtil::trim($_REQUEST['q']); } }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['production'])) { $this->production = StringUtil::trim($_REQUEST['production']); } }
/** * @see Page::readData */ public function readData() { parent::readData(); //echo "."; $this->fleetQueue = new FleetQueue(0); $this->readTarget(); $this->specs = Spec::getBySpecType(3); $this->fleets = Fleet::getByUserID(WCF::getUser()->userID); foreach ($this->fleets as $fleetID => $fleet) { $this->fleets[$fleetID]->navalFormation = NavalFormation::getByFleetID($fleetID); } // backlink if (isset($_REQUEST['backlink'])) { $this->backlink = StringUtil::trim($_REQUEST['backlink']); } $array = array(); preg_match('/^(https?:\\/\\/[^\\/]*\\/)?(.*)$/i', $this->backlink, $array); $this->fleetQueue->backlink = $this->backlink = isset($array[2]) ? $array[2] : ''; //echo "."; // TODO: clean this one up $sql = "DELETE FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID; WCF::getDB()->registerShutdownUpdate($sql); $sql = "INSERT INTO ugml_galactic_jump_queue (userID, startPlanetID, state, time)\n\t\t\t\tVALUES(" . WCF::getUser()->userID . ", " . LWCore::getPlanet()->planetID . ", 1, " . TIME_NOW . ")"; WCF::getDB()->registerShutdownUpdate($sql); }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); $this->languageID = $this->useRegex = $this->caseSensitive = $this->replace = $this->searchVariableName = 0; if (isset($_POST['languageID'])) { $this->languageID = intval($_POST['languageID']); } if (isset($_POST['useRegex'])) { $this->useRegex = intval($_POST['useRegex']); } if (isset($_POST['caseSensitive'])) { $this->caseSensitive = intval($_POST['caseSensitive']); } if (isset($_POST['replace'])) { $this->replace = intval($_POST['replace']); } if (isset($_POST['searchVariableName'])) { $this->searchVariableName = intval($_POST['searchVariableName']); } if (isset($_POST['replaceBy'])) { $this->replaceBy = $_POST['replaceBy']; } if (isset($_POST['query'])) { $this->query = StringUtil::trim($_POST['query']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); // data if (isset($_POST['name'])) { $this->name = StringUtil::trim($_POST['name']); } if (isset($_POST['link'])) { $this->link = StringUtil::trim($_POST['link']); } if (isset($_POST['iconS'])) { $this->iconS = StringUtil::trim($_POST['iconS']); } if (isset($_POST['iconM'])) { $this->iconM = StringUtil::trim($_POST['iconM']); } if (isset($_POST['position'])) { $this->position = StringUtil::trim($_POST['position']); } if ($this->position != 'header' && $this->position != 'footer') { $this->position = "header"; } if (isset($_POST['showOrder'])) { $this->showOrder = intval($_POST['showOrder']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['applicationText'])) { $this->applicationText = StringUtil::trim($_POST['applicationText']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['username'])) { $this->username = StringUtil::trim($_POST['username']); } if (isset($_POST['email'])) { $this->email = StringUtil::trim($_POST['email']); } if (isset($_POST['confirmEmail'])) { $this->confirmEmail = StringUtil::trim($_POST['confirmEmail']); } if (isset($_POST['password'])) { $this->password = $_POST['password']; } if (isset($_POST['confirmPassword'])) { $this->confirmPassword = $_POST['confirmPassword']; } if (isset($_POST['groupIDs']) && is_array($_POST['groupIDs'])) { $this->groupIDs = ArrayUtil::toIntegerArray($_POST['groupIDs']); } if (isset($_POST['visibleLanguages']) && is_array($_POST['visibleLanguages'])) { $this->visibleLanguages = ArrayUtil::toIntegerArray($_POST['visibleLanguages']); } if (isset($_POST['languageID'])) { $this->languageID = intval($_POST['languageID']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['warningID'])) { $this->warningID = intval($_POST['warningID']); } if (isset($_POST['title'])) { $this->title = StringUtil::trim($_POST['title']); } if (isset($_POST['points'])) { $this->points = abs(intval($_POST['points'])); } if (isset($_POST['reason'])) { $this->reason = StringUtil::trim($_POST['reason']); } if (isset($_POST['expiresDay'])) { $this->expiresDay = intval($_POST['expiresDay']); } if (isset($_POST['expiresMonth'])) { $this->expiresMonth = intval($_POST['expiresMonth']); } if (isset($_POST['expiresYear'])) { $this->expiresYear = intval($_POST['expiresYear']); } if (isset($_POST['expiresHour'])) { $this->expiresHour = intval($_POST['expiresHour']); } if (isset($_POST['expiresMinute'])) { $this->expiresMinute = intval($_POST['expiresMinute']); } }
/** * Creates a new MemcacheAdapter object. */ private function __construct() { if (!class_exists('Memcache')) { throw new SystemException('memcache support is not enabled.'); } // init memcache $this->memcache = new Memcache(); // add servers $servers = explode("\n", StringUtil::unifyNewlines(CACHE_SOURCE_MEMCACHE_HOST)); foreach ($servers as $server) { $server = StringUtil::trim($server); if (!empty($server)) { $host = $server; $port = 11211; // default memcache port // get port if (strpos($host, ':')) { $parsedHost = explode(':', $host); $host = $parsedHost[0]; $port = $parsedHost[1]; } $this->memcache->addServer($host, $port, CACHE_SOURCE_MEMCACHE_USE_PCONNECT); } } // test connection $this->memcache->get('testing'); }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); $this->ignoreUniques = $this->plugin = $this->standalone = 0; if (isset($_POST['packageUpdateServerIDs']) && is_array($_POST['packageUpdateServerIDs'])) { $this->packageUpdateServerIDs = ArrayUtil::toIntegerArray($_POST['packageUpdateServerIDs']); } if (isset($_POST['packageName'])) { $this->packageName = StringUtil::trim($_POST['packageName']); } if (isset($_POST['author'])) { $this->author = StringUtil::trim($_POST['author']); } if (isset($_POST['searchDescription'])) { $this->searchDescription = intval($_POST['searchDescription']); } if (isset($_POST['plugin'])) { $this->plugin = intval($_POST['plugin']); } if (isset($_POST['standalone'])) { $this->standalone = intval($_POST['standalone']); } if (isset($_POST['other'])) { $this->other = intval($_POST['other']); } if (isset($_POST['ignoreUniques'])) { $this->ignoreUniques = intval($_POST['ignoreUniques']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['classPath'])) { $this->classPath = StringUtil::trim($_POST['classPath']); } if (isset($_POST['description'])) { $this->description = StringUtil::trim($_POST['description']); } if (isset($_POST['execMultiple'])) { $this->execMultiple = intval($_POST['execMultiple']); } if (isset($_POST['startMinute'])) { $this->startMinute = StringUtil::replace(' ', '', $_POST['startMinute']); } if (isset($_POST['startHour'])) { $this->startHour = StringUtil::replace(' ', '', $_POST['startHour']); } if (isset($_POST['startDom'])) { $this->startDom = StringUtil::replace(' ', '', $_POST['startDom']); } if (isset($_POST['startMonth'])) { $this->startMonth = StringUtil::replace(' ', '', $_POST['startMonth']); } if (isset($_POST['startDow'])) { $this->startDow = StringUtil::replace(' ', '', $_POST['startDow']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['username'])) { $this->username = StringUtil::trim($_POST['username']); } }
/** * @see Form::validate() */ public function validate() { parent::validate(); if (empty($this->usernames)) { throw new UserInputException('usernames'); } // explode multiple usernames to an array $usernameArray = explode(',', $this->usernames); $error = array(); // loop through users foreach ($usernameArray as $username) { $username = StringUtil::trim($username); if (empty($username)) { continue; } try { // get user $user = new UserEditor(null, null, $username); if (!$user->userID) { throw new UserInputException('username', 'notFound'); } // no error $this->users[] = $user; } catch (UserInputException $e) { $error[] = array('type' => $e->getType(), 'username' => $username); } } if (count($error)) { throw new UserInputException('usernames', $error); } }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); if (!MODULE_MODERATED_USER_GROUP || !MODULE_PM) { throw new IllegalLinkException(); } if (isset($_POST['groupID'])) { $this->groupID = intval($_POST['groupID']); } $this->group = new Group($this->groupID); if (!$this->group->groupID) { throw new IllegalLinkException(); } // check permission if (!GroupApplicationEditor::isGroupLeader(WCF::getUser(), $this->groupID)) { throw new PermissionDeniedException(); } if (isset($_POST['subject'])) { $this->subject = StringUtil::trim($_POST['subject']); } if (isset($_POST['text'])) { $this->text = StringUtil::trim($_POST['text']); } if (empty($this->subject) || empty($this->text)) { throw new IllegalLinkException(); } }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_POST['packageName'])) { $this->packageName = StringUtil::trim($_POST['packageName']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['parentItem'])) { $this->parentItem = $_POST['parentItem']; } if (isset($_POST['refererPattern'])) { $this->refererPattern = StringUtil::trim($_POST['refererPattern']); } if (isset($_POST['showOrder'])) { $this->showOrder = intval($_POST['showOrder']); } if (isset($_POST['isDisabled'])) { $this->isDisabled = intval($_POST['isDisabled']); } if (isset($_POST['topic'])) { $this->topic = StringUtil::trim($_POST['topic']); } if (isset($_POST['text'])) { $this->text = StringUtil::trim($_POST['text']); } if (isset($_POST['languageID'])) { $this->languageID = intval($_POST['languageID']); } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); if (!WCF::getUser()->getPermission('user.source.profiles.canManageProfiles')) { throw new PermissionDeniedException(); } if (isset($_POST['packages'])) { $packages = JSON::decode($_POST['packages']); if (!is_array($packages)) { $this->sendResponse('pb.build.profile.error.packages.empty', true); } $this->packages = $packages; } if (isset($_POST['packageHash'])) { $this->packageHash = StringUtil::trim($_POST['packageHash']); } if (isset($_POST['packageName'])) { $this->packageName = StringUtil::trim($_POST['packageName']); } if (isset($_POST['profileName'])) { $this->profileName = StringUtil::trim($_POST['profileName']); if (empty($this->profileName)) { $this->sendResponse('wcf.global.error.empty', true); } } if (isset($_POST['resource'])) { $this->resource = StringUtil::trim($_POST['resource']); } }
/** * @see Page::readParameters */ public function readParameters() { // if there is no user logged in try to get valid logindata if (!WCF::getUser()->userID && function_exists('getallheaders')) { if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) { $this->authenticate(); } else { $this->user = new UserSession(null, null, $_SERVER['PHP_AUTH_USER']); if (!$this->user->checkPassword($_SERVER['PHP_AUTH_PW'])) { $this->authenticate(); } } } else { $this->user = WCF::getUser(); } $sourceID = 0; if (isset($_REQUEST['sourceID'])) { $sourceID = $_REQUEST['sourceID']; } if (isset($_REQUEST['type'])) { $this->type = StringUtil::trim($_REQUEST['type']); } if (!in_array($this->type, $this->validTypes)) { throw new IllegalLinkException(); } $this->source = new Source($sourceID); if (!$this->source->sourceID) { throw new IllegalLinkException(); } if (!$this->source->hasAccess($this->user)) { throw new PermissionDeniedException(); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['password'])) { $this->password = $_POST['password']; } if (isset($_POST['email'])) { $this->email = $_POST['email']; } if (isset($_POST['confirmEmail'])) { $this->confirmEmail = $_POST['confirmEmail']; } if (isset($_POST['newPassword'])) { $this->newPassword = $_POST['newPassword']; } if (isset($_POST['confirmNewPassword'])) { $this->confirmNewPassword = $_POST['confirmNewPassword']; } if (isset($_POST['username'])) { $this->username = StringUtil::trim($_POST['username']); } if (isset($_POST['quit'])) { $this->quit = intval($_POST['quit']); } if (isset($_POST['cancelQuit'])) { $this->cancelQuit = intval($_POST['cancelQuit']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); // get parameters if (isset($_POST['message'])) { $this->message = StringUtil::trim($_POST['message']); } }
/** * @see Page::readParameters() */ public function readParameters() { parent::readParameters(); // parameters if (isset($_REQUEST['username'])) { $this->username = StringUtil::trim($_REQUEST['username']); } if (isset($_REQUEST['suspensionID'])) { $this->suspensionID = intval($_REQUEST['suspensionID']); } if (isset($_REQUEST['status'])) { $this->status = $_REQUEST['status']; } if (isset($_REQUEST['fromDay'])) { $this->fromDay = intval($_REQUEST['fromDay']); } if (isset($_REQUEST['fromMonth'])) { $this->fromMonth = intval($_REQUEST['fromMonth']); } if (isset($_REQUEST['fromYear'])) { $this->fromYear = intval($_REQUEST['fromYear']); } if (isset($_REQUEST['untilDay'])) { $this->untilDay = intval($_REQUEST['untilDay']); } if (isset($_REQUEST['untilMonth'])) { $this->untilMonth = intval($_REQUEST['untilMonth']); } if (isset($_REQUEST['untilYear'])) { $this->untilYear = intval($_REQUEST['untilYear']); } if (isset($_REQUEST['deletedUserSuspensionID'])) { $this->deletedUserSuspensionID = intval($_REQUEST['deletedUserSuspensionID']); } // init list $this->userSuspensionList = new UserSuspensionList(); // set conditions $this->userSuspensionList->sqlConditions .= 'user_suspension.packageID = ' . PACKAGE_ID; if (!empty($this->username)) { $this->userSuspensionList->sqlConditions .= " AND user_suspension.userID = (SELECT userID FROM wcf" . WCF_N . "_user WHERE username = '******')"; } if ($this->suspensionID) { $this->userSuspensionList->sqlConditions .= " AND user_suspension.suspensionID = " . $this->suspensionID; } if ($this->status == 'active') { $this->userSuspensionList->sqlConditions .= " AND (user_suspension.expires = 0 OR user_suspension.expires > " . TIME_NOW . ")"; } else { if ($this->status == 'expired') { $this->userSuspensionList->sqlConditions .= " AND user_suspension.expires > 0 AND user_suspension.expires < " . TIME_NOW; } } if ($this->fromDay && $this->fromMonth && $this->fromYear) { $this->userSuspensionList->sqlConditions .= " AND user_suspension.time > " . gmmktime(0, 0, 0, $this->fromMonth, $this->fromDay, $this->fromYear); } if ($this->untilDay && $this->untilMonth && $this->untilYear) { $this->userSuspensionList->sqlConditions .= " AND user_suspension.time < " . gmmktime(0, 0, 0, $this->untilMonth, $this->untilDay, $this->untilYear); } }
public function __construct() { if (MODULE_USER_EMAIL_BLACKLIST && BLOCKED_EMAIL_SUFFIXES != '') { $this->enabled = true; $blockedEmailSuffixex = explode("\n", preg_quote(StringUtil::unifyNewlines(StringUtil::trim(BLOCKED_EMAIL_SUFFIXES)))); $blockedEmailSuffixex = array_filter($blockedEmailSuffixex); $this->mailSuffixRegex = '!^(.*' . implode('|.*', $blockedEmailSuffixex) . ')$!i'; } }
/** * @see BBCode::getParsedTag() */ public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) { if (StringUtil::indexOf($content, '[*]') !== false) { // get list elements $listElements = preg_split('/\\[\\*\\]/', StringUtil::trim($content), -1, PREG_SPLIT_NO_EMPTY); // remove empty elements foreach ($listElements as $key => $val) { $listElements[$key] = StringUtil::trim($val); if (empty($listElements[$key]) || $listElements[$key] == '<br />') { unset($listElements[$key]); } } if (count($listElements) > 0) { // get list style type $listType = 'disc'; if (isset($openingTag['attributes'][0])) { $listType = $openingTag['attributes'][0]; } $listType = strtolower($listType); // replace old types if ($listType == '1') { $listType = 'decimal'; } if ($listType == 'a') { $listType = 'lower-latin'; } if ($parser->getOutputType() == 'text/html') { // build list html $listHTML = 'ol'; if ($listType == 'none' || $listType == 'circle' || $listType == 'square' || $listType == 'disc') { $listHTML = 'ul'; } return '<' . $listHTML . ' style="list-style-type: ' . $listType . '"><li>' . implode('</li><li>', $listElements) . '</li></' . $listHTML . '>'; } else { if ($parser->getOutputType() == 'text/plain') { $result = ''; $i = 1; foreach ($listElements as $listElement) { switch ($listType) { case 'decimal': $result .= $i . '. '; break; default: $result .= '- '; } $result .= $listElement . "\n"; $i++; } return $result; } } } } // no valid list // return bbcode as text return $openingTag['source'] . $content . $closingTag['source']; }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['reason'])) { $this->reason = StringUtil::trim($_POST['reason']); } if (isset($_POST['enableNotification'])) { $this->enableNotification = intval($_POST['enableNotification']); } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['categoryName'])) { $this->categoryName = StringUtil::trim($_POST['categoryName']); } if (isset($_POST['showOrder'])) { $this->showOrder = intval($_POST['showOrder']); } }