/**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $responseIDs = array();
     foreach ($events as $event) {
         $responseIDs[] = $event->objectID;
     }
     $responseList = new CommentResponseList();
     $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($responseIDs));
     $responseList->readObjects();
     $responses = $responseList->getObjects();
     $commentIDs = $comments = array();
     foreach ($responses as $response) {
         $commentIDs[] = $response->commentID;
     }
     if (!empty($commentIDs)) {
         $commentList = new CommentList();
         $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs));
         $commentList->readObjects();
         $comments = $commentList->getObjects();
     }
     // fetch news entries
     $entryIDs = $entry = array();
     foreach ($comments as $comment) {
         $entryIDs[] = $comment->objectID;
     }
     if (!empty($entryIDs)) {
         $entryList = new ViewableEntryList();
         $entryList->getConditionBuilder()->add("news_entry.entryID IN (?)", array($entryIDs));
         $entryList->readObjects();
         $entry = $entryList->getObjects();
     }
     $userIDs = $user = array();
     foreach ($comments as $comment) {
         $userIDs[] = $comment->userID;
     }
     if (!empty($userIDs)) {
         $userList = new UserList();
         $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
         $userList->readObjects();
         $users = $userList->getObjects();
     }
     foreach ($events as $event) {
         if (isset($responses[$event->objectID])) {
             $response = $responses[$event->objectID];
             $comment = $comments[$response->commentID];
             if (isset($entry[$comment->objectID]) && isset($users[$comment->userID])) {
                 $newsEntry = $entry[$comment->objectID];
                 if (!$newsEntry->canRead()) {
                     continue;
                 }
                 $event->setIsAccessible();
                 $text = WCF::getLanguage()->getDynamicVariable('cms.recentActivity.newsCommentResponse', array('commentAuthor' => $users[$comment->userID], 'entry' => $newsEntry));
                 $event->setTitle($text);
                 $event->setDescription($response->getExcerpt());
                 continue;
             }
         }
         $event->setIsOrphaned();
     }
 }
 /**
  * @see	\wcf\system\option\ISearchableConditionUserOption::addCondition()
  */
 public function addCondition(UserList $userList, Option $option, $value)
 {
     $value = intval($value);
     if (!$value) {
         return;
     }
     $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' = ?', array(1));
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $userProfileList = new UserList();
     $userProfileList->sqlOrderBy = 'user_table.registrationDate DESC';
     $userProfileList->sqlLimit = 5;
     $userProfileList->readObjectIDs();
     return $userProfileList->getObjectIDs();
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     if ($condition->greaterThan !== null) {
         $userList->getConditionBuilder()->add('user_table.' . $this->getDecoratedObject()->propertyname . ' > ?', array($condition->greaterThan));
     }
     if ($condition->lessThan !== null) {
         $userList->getConditionBuilder()->add('user_table.' . $this->getDecoratedObject()->propertyname . ' < ?', array($condition->lessThan));
     }
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     if ($condition->registrationDateEnd !== null) {
         $userList->getConditionBuilder()->add('user_table.registrationDate < ?', array(strtotime($condition->registrationDateEnd) + 86400));
     }
     if ($condition->registrationDateStart !== null) {
         $userList->getConditionBuilder()->add('user_table.registrationDate >= ?', array(strtotime($condition->registrationDateStart)));
     }
 }
 /**
  * @see	\wcf\system\dashboard\box\IDashboardBox::init()
  */
 public function init(DashboardBox $box, IPage $page)
 {
     parent::init($box, $page);
     $this->member = new UserProfileList();
     $this->member->sqlOrderBy = 'user_table.jCoinsBalance DESC';
     $this->member->sqlLimit = JCOINS_DASHBOARD_SIDEBAR_RICHEST_NUM;
     $this->member->readObjects();
     $this->fetched();
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $userProfileList = new UserList();
     $userProfileList->getConditionBuilder()->add('user_table.likesReceived > 0');
     $userProfileList->sqlOrderBy = 'user_table.likesReceived DESC';
     $userProfileList->sqlLimit = 5;
     $userProfileList->readObjectIDs();
     return $userProfileList->getObjectIDs();
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     if ($condition->groupIDs !== null) {
         $userList->getConditionBuilder()->add('user_table.userID IN (SELECT userID FROM wcf' . WCF_N . '_user_to_group WHERE groupID IN (?) GROUP BY userID HAVING COUNT(userID) = ?)', array($condition->groupIDs, count($condition->groupIDs)));
     }
     if ($condition->notGroupIDs !== null) {
         $userList->getConditionBuilder()->add('user_table.userID NOT IN (SELECT userID FROM wcf' . WCF_N . '_user_to_group WHERE groupID IN (?))', array($condition->notGroupIDs));
     }
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     if ($condition->greaterThan !== null) {
         $userList->getConditionBuilder()->add('user_table.registrationDate < ?', array(TIME_NOW - $condition->greaterThan * 86400));
     }
     if ($condition->lessThan !== null) {
         $userList->getConditionBuilder()->add('user_table.registrationDate > ?', array(TIME_NOW - $condition->lessThan * 86400));
     }
 }
 /**
  * @see	\wcf\system\message\embedded\object\IMessageEmbeddedObjectHandler::parseMessage()
  */
 public function parseMessage($message)
 {
     $usernames = self::getFirstParameters($message, 'quote');
     if (!empty($usernames)) {
         $userList = new UserList();
         $userList->getConditionBuilder()->add("user_table.username IN (?)", array($usernames));
         $userList->readObjectIDs();
         return $userList->getObjectIDs();
     }
     return false;
 }
 /**
  * Adds a log entry for newly added conversation participants.
  * 
  * @param	\wcf\data\conversation\Conversation	$conversation
  * @param	array<integer>				$participantIDs
  */
 public function addParticipants(Conversation $conversation, array $participantIDs)
 {
     $participants = array();
     $userList = new UserList();
     $userList->setObjectIDs($participantIDs);
     $userList->readObjects();
     foreach ($userList as $user) {
         $participants[] = array('userID' => $user->userID, 'username' => $user->username);
     }
     $this->add($conversation, 'addParticipants', array('participants' => $participants));
 }
Example #12
0
 /**
  * Loads the users.
  */
 protected function readUsers()
 {
     $this->users = array();
     if (empty($this->userIDs)) {
         return;
     }
     $this->userIDs = array_unique($this->userIDs);
     $userList = new UserList();
     $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($this->userIDs));
     $userList->readObjects();
     $this->users = $userList->getObjects();
 }
 /**
  * @see	\wcf\system\worker\IWorker::execute()
  */
 public function execute()
 {
     $userList = new UserList();
     $userList->decoratorClassName = 'wcf\\data\\user\\UserEditor';
     $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($this->parameters['userIDs']));
     $userList->sqlLimit = $this->limit;
     $userList->sqlOffset = $this->limit * $this->loopCount;
     $userList->readObjects();
     foreach ($userList as $userEditor) {
         $this->sendNewPassword($userEditor);
     }
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     if ($condition->userIsBanned !== null) {
         $userList->getConditionBuilder()->add('user_table.banned = ?', array($condition->userIsBanned));
     }
     if ($condition->userIsEnabled !== null) {
         if ($condition->userIsEnabled) {
             $userList->getConditionBuilder()->add('user_table.activationCode = ?', array(0));
         } else {
             $userList->getConditionBuilder()->add('user_table.activationCode <> ?', array(0));
         }
     }
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     switch ($condition->userAvatar) {
         case self::NO_AVATAR:
             $userList->getConditionBuilder()->add('user_table.avatarID IS NULL');
             $userList->getConditionBuilder()->add('user_table.enableGravatar = ?', array(0));
             break;
         case self::AVATAR:
             $userList->getConditionBuilder()->add('user_table.avatarID IS NOT NULL');
             break;
         case self::GRAVATAR:
             $userList->getConditionBuilder()->add('user_table.enableGravatar = ?', array(1));
             break;
     }
 }
Example #16
0
 /**
  * @see	\wcf\page\IPage::assignVariables()
  */
 public function readData()
 {
     parent::readData();
     if (empty($_POST)) {
         // get marked user ids
         if (empty($this->action)) {
             // get type id
             $objectTypeID = ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user');
             if ($objectTypeID === null) {
                 throw new SystemException("Unknown clipboard item type 'com.woltlab.wcf.user'");
             }
             // get user ids
             $users = ClipboardHandler::getInstance()->getMarkedItems($objectTypeID);
             if (empty($users)) {
                 throw new IllegalLinkException();
             }
             // load users
             $this->userIDs = array_keys($users);
         }
         if (MAIL_USE_FORMATTED_ADDRESS) {
             $this->from = MAIL_FROM_NAME . ' <' . MAIL_FROM_ADDRESS . '>';
         } else {
             $this->from = MAIL_FROM_ADDRESS;
         }
     }
     if (!empty($this->userIDs)) {
         $this->userList = new UserList();
         $this->userList->getConditionBuilder()->add("user_table.userID IN (?)", array($this->userIDs));
         $this->userList->sqlOrderBy = "user_table.username ASC";
         $this->userList->readObjects();
     }
     $this->groups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE));
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $commentsIDs = $responseIDs = $userIDs = array();
     foreach ($events as $event) {
         $responseIDs[] = $event->objectID;
     }
     $responseList = new CommentResponseList();
     $responseList->setObjectIDs($responseIDs);
     $responseList->readObjects();
     $responses = $responseList->getObjects();
     foreach ($responses as $response) {
         $commentIDs[] = $response->commentID;
     }
     $commentList = new CommentList();
     $commentList->setObjectIDs($commentIDs);
     $commentList->readObjects();
     $comments = $commentList->getObjects();
     foreach ($comments as $comment) {
         if (!in_array($comment->userID, $userIDs)) {
             $userIDs[] = $comment->userID;
         }
     }
     $userList = new UserList();
     $userList->setObjectIDs($userIDs);
     $userList->readObjects();
     $users = $userList->getObjects();
     foreach ($events as $event) {
         if (isset($responses[$event->objectID])) {
             $response = $responses[$event->objectID];
             $comment = $comments[$response->commentID];
             $page = PageCache::getInstance()->getPage($comment->objectID);
             if ($page !== null && isset($users[$comment->userID])) {
                 if (!$page->canRead()) {
                     continue;
                 }
                 $event->setIsAccessible();
                 $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.pageCommentResponse', array('author' => $users[$comment->userID], 'page' => $pages[$comment->objectID]));
                 $event->setTitle($text);
                 $event->setDescription($response->getFormattedMessage());
                 continue;
             }
         } else {
             $event->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $objectIDs = array();
     foreach ($events as $event) {
         $objectIDs[] = $event->objectID;
     }
     // fetch user id and username
     $userList = new UserList();
     $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($objectIDs));
     $userList->readObjects();
     $users = $userList->getObjects();
     // set message
     foreach ($events as $event) {
         if (isset($users[$event->objectID])) {
             $event->setIsAccessible();
             $text = WCF::getLanguage()->getDynamicVariable('wcf.user.profile.recentActivity.follow', array('user' => $users[$event->objectID]));
             $event->setTitle($text);
         } else {
             $event->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\moderation\queue\IModerationQueueHandler::populate()
  */
 public function populate(array $queues)
 {
     $objectIDs = array();
     foreach ($queues as $object) {
         $objectIDs[] = $object->objectID;
     }
     // fetch users
     $userList = new UserList();
     $userList->setObjectIDs($objectIDs);
     $userList->readObjects();
     $users = $userList->getObjects();
     foreach ($queues as $object) {
         if (isset($users[$object->objectID])) {
             $object->setAffectedObject($users[$object->objectID]);
         } else {
             $object->setIsOrphaned();
         }
     }
 }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     $userList->getConditionBuilder()->add('user_table.languageID IN (?)', array($condition->conditionData['languageIDs']));
 }
 /**
  * @see	\wcf\system\user\activity\event\IUserActivityEvent::prepare()
  */
 public function prepare(array $events)
 {
     $responseIDs = array();
     foreach ($events as $event) {
         $responseIDs[] = $event->objectID;
     }
     // fetch responses
     $responseList = new CommentResponseList();
     $responseList->setObjectIDs($responseIDs);
     $responseList->readObjects();
     $responses = $responseList->getObjects();
     // fetch comments
     $commentIDs = $comments = array();
     foreach ($responses as $response) {
         $commentIDs[] = $response->commentID;
     }
     if (!empty($commentIDs)) {
         $commentList = new CommentList();
         $commentList->setObjectIDs($commentIDs);
         $commentList->readObjects();
         $comments = $commentList->getObjects();
     }
     // fetch entries
     $entryIDs = $entries = array();
     foreach ($comments as $comment) {
         $entryIDs[] = $comment->objectID;
     }
     if (!empty($entryIDs)) {
         $entryList = new EntryList();
         $entryList->setObjectIDs($entryIDs);
         $entryList->readObjects();
         $entries = $entryList->getObjects();
     }
     // fetch users
     $userIDs = $user = array();
     foreach ($comments as $comment) {
         $userIDs[] = $comment->userID;
     }
     if (!empty($userIDs)) {
         $userList = new UserList();
         $userList->setObjectIDs($userIDs);
         $userList->readObjects();
         $users = $userList->getObjects();
     }
     // set message
     foreach ($events as $event) {
         if (isset($responses[$event->objectID])) {
             $response = $responses[$event->objectID];
             $comment = $comments[$response->commentID];
             if (isset($entries[$comment->objectID]) && isset($users[$comment->userID])) {
                 $entry = $entries[$comment->objectID];
                 // check permissions
                 if (!$entry->canRead()) {
                     continue;
                 }
                 $event->setIsAccessible();
                 // title
                 $text = WCF::getLanguage()->getDynamicVariable('linklist.recentActivity.entryCommentResponse', array('commentAuthor' => $users[$comment->userID], 'entry' => $entry));
                 $event->setTitle($text);
                 // description
                 $event->setDescription($response->getExcerpt());
                 continue;
             }
         }
         $event->setIsOrphaned();
     }
 }
Example #22
0
 /**
  * @see	\wcf\system\option\ISearchableConditionUserOption::addCondition()
  */
 public function addCondition(UserList $userList, Option $option, $value)
 {
     $value = StringUtil::trim($value);
     if ($value == '') {
         $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' = ?', array(''));
     } else {
         $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' LIKE ?', array('%' . addcslashes($value, '_%') . '%'));
     }
 }
Example #23
0
 /**
  * Returns a list of users.
  * 
  * @param	array		$userIDs
  * @return	array<User>
  */
 public static function getUsers(array $userIDs)
 {
     $userList = new UserList();
     $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs));
     $userList->readObjects();
     return $userList->getObjects();
 }
 /**
  * @see	\wcf\system\option\ISearchableConditionUserOption::addCondition()
  */
 public function addCondition(UserList $userList, Option $option, $value)
 {
     $ageFrom = intval($value['ageFrom']);
     $ageTo = intval($value['ageTo']);
     if ($ageFrom < 0 || $ageFrom > 120 || $ageTo < 0 || $ageTo > 120) {
         return false;
     }
     $dateFrom = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P' . ($ageTo + 1) . 'Y'))->add(new \DateInterval('P1D'));
     $dateTo = DateUtil::getDateTimeByTimestamp(TIME_NOW)->sub(new \DateInterval('P' . $ageFrom . 'Y'));
     $userList->getConditionBuilder()->add('user_option_value.userOption' . User::getUserOptionID('birthdayShowYear') . ' = ?', array(1));
     if ($ageFrom && $ageTo) {
         $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), $dateTo->format('Y-m-d')));
     } else {
         if ($ageFrom) {
             $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' BETWEEN DATE(?) AND DATE(?)', array('1893-01-01', $dateTo->format('Y-m-d')));
         } else {
             $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' BETWEEN DATE(?) AND DATE(?)', array($dateFrom->format('Y-m-d'), DateUtil::getDateTimeByTimestamp(TIME_NOW)->add(new \DateInterval('P1D'))->format('Y-m-d')));
         }
     }
 }
 /**
  * @see	\wcf\system\option\ISearchableConditionUserOption::addCondition()
  */
 public function addCondition(UserList $userList, Option $option, $value)
 {
     if (!is_array($value) || empty($value)) {
         return false;
     }
     $value = ArrayUtil::trim($value);
     $userList->getConditionBuilder()->add("user_option_value.userOption" . $option->optionID . " REGEXP '" . '(^|\\n)' . implode('\\n([^\\n]*\\n)*', array_map('escapeString', $value)) . '($|\\n)' . "'");
 }
 /**
  * @see	\wcf\data\DatabaseObjectList\DatabaseObjectList::__construct()
  */
 public function __construct()
 {
     $this->sqlJoins = "LEFT JOIN wcf" . WCF_N . "_user user_table ON (user_table.userID = event_to_user.userID)";
     $this->sqlSelects = 'user_table.*';
     parent::__construct();
 }
 /**
  * Returns the users who fullfil all conditions of the given user group
  * assignment.
  * 
  * @param	\wcf\data\user\group\assignment\UserGroupAssignment	$assignment
  * @return	array<\wcf\data\user\User>
  */
 public function getUsers(UserGroupAssignment $assignment)
 {
     $userList = new UserList();
     $userList->getConditionBuilder()->add('user_table.userID NOT IN (SELECT userID FROM wcf' . WCF_N . '_user_to_group WHERE groupID = ?)', array($assignment->groupID));
     $conditions = $assignment->getConditions();
     foreach ($conditions as $condition) {
         $condition->getObjectType()->getProcessor()->addUserCondition($condition, $userList);
     }
     $userList->readObjects();
     return $userList->getObjects();
 }
    /**
     * @see	\wcf\system\event\listener\IParameterizedEventListener::execute()
     */
    public function execute($eventObj, $className, $eventName, array &$parameters)
    {
        if (!$eventObj->text) {
            return;
        }
        // check if needed url BBCode is allowed
        if ($eventObj->allowedBBCodes !== null && !BBCode::isAllowedBBCode('url', $eventObj->allowedBBCodes)) {
            return;
        }
        static $userRegex = null;
        if ($userRegex === null) {
            $userRegex = new Regex("\n\t\t\t\t(?:^|(?<=\\s|\\]))\t\t\t\t\t# either at start of string, or after whitespace\n\t\t\t\t@\n\t\t\t\t(\n\t\t\t\t\t([^',\\s][^,\\s]{2,})(?:\\s[^,\\s]+)?\t# either at most two strings, not containing\n\t\t\t\t\t\t\t\t\t\t# whitespace or the comma, not starting with a single quote\n\t\t\t\t\t\t\t\t\t\t# separated by a single whitespace character\n\t\t\t\t|\n\t\t\t\t\t'(?:''|[^']){3,}'\t\t\t# or a string delimited by single quotes\n\t\t\t\t)\n\t\t\t", Regex::IGNORE_WHITESPACE);
        }
        // cache quotes
        // @see	\wcf\system\bbcode\BBCodeParser::buildTagArray()
        $pattern = '~\\[(?:/(?:quote)|(?:quote)
			(?:=
				(?:\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^,\\]]*)
				(?:,(?:\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^,\\]]*))*
			)?)\\]~ix';
        preg_match_all($pattern, $eventObj->text, $quoteMatches);
        $textArray = preg_split($pattern, $eventObj->text);
        $text = $textArray[0];
        $openQuotes = 0;
        $quote = '';
        foreach ($quoteMatches[0] as $i => $quoteTag) {
            if (mb_substr($quoteTag, 1, 1) == '/') {
                $openQuotes--;
                $quote .= $quoteTag;
                if ($openQuotes) {
                    $quote .= $textArray[$i + 1];
                } else {
                    $text .= StringStack::pushToStringStack($quote, 'preParserUserMentions', '@@@') . $textArray[$i + 1];
                    $quote = '';
                }
            } else {
                $openQuotes++;
                $quote .= $quoteTag . $textArray[$i + 1];
            }
        }
        if ($quote) {
            $text .= $quote;
        }
        $userRegex->match($text, true, Regex::ORDER_MATCH_BY_SET);
        $matches = $userRegex->getMatches();
        if (!empty($matches)) {
            $usernames = array();
            foreach ($matches as $match) {
                // we don't care about the full match
                array_shift($match);
                foreach ($match as $username) {
                    $username = self::getUsername($username);
                    if (!in_array($username, $usernames)) {
                        $usernames[] = $username;
                    }
                }
            }
            if (!empty($usernames)) {
                // fetch users
                $userList = new UserList();
                $userList->getConditionBuilder()->add('user_table.username IN (?)', array($usernames));
                $userList->readObjects();
                $users = array();
                foreach ($userList as $user) {
                    $users[mb_strtolower($user->username)] = $user;
                }
                $text = $userRegex->replace($text, new Callback(function ($matches) use($users) {
                    // containing the full match
                    $usernames = array($matches[1]);
                    // containing only the part before the first space
                    if (isset($matches[2])) {
                        $usernames[] = $matches[2];
                    }
                    $usernames = array_map(array('\\wcf\\system\\event\\listener\\PreParserAtUserListener', 'getUsername'), $usernames);
                    foreach ($usernames as $username) {
                        if (!isset($users[$username])) {
                            continue;
                        }
                        $link = LinkHandler::getInstance()->getLink('User', array('appendSession' => false, 'object' => $users[$username]));
                        $mention = "[url='" . $link . "']@" . $users[$username]->username . '[/url]';
                        // check if only the part before the first space matched, in that case append the second word
                        if (isset($matches[2]) && strcasecmp($matches[2], $username) === 0) {
                            $mention .= mb_substr($matches[1], strlen($matches[2]));
                        }
                        return $mention;
                    }
                    return $matches[0];
                }));
            }
        }
        // reinsert cached quotes
        $eventObj->text = StringStack::reinsertStrings($text, 'preParserUserMentions');
    }
 /**
  * @see	\wcf\system\condition\IUserCondition::addUserCondition()
  */
 public function addUserCondition(Condition $condition, UserList $userList)
 {
     $userList->getConditionBuilder()->add('user_table.username LIKE ?', array('%' . addcslashes($condition->username, '_%') . '%'));
 }
 /**
  * @see	\wcf\system\option\ISearchableConditionUserOption::addCondition()
  */
 public function addCondition(UserList $userList, Option $option, $value)
 {
     $userList->getConditionBuilder()->add('user_option_value.userOption' . $option->optionID . ' = ?', array(StringUtil::trim($value)));
 }