/** * @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())); }
/** * Validates the given participant. * * @param \wcf\data\user\UserProfile $user * @param string $field */ public static function validateParticipant(UserProfile $user, $field = 'participants') { // check participant's settings and permissions if (!$user->getPermission('user.conversation.canUseConversation')) { throw new UserInputException($field, 'canNotUseConversation'); } if (!WCF::getSession()->getPermission('user.profile.cannotBeIgnored')) { // check if user wants to receive any conversations if ($user->canSendConversation == 2) { throw new UserInputException($field, 'doesNotAcceptConversation'); } // check if user only wants to receive conversations by // users they are following and if the active user is followed // by the relevant user if ($user->canSendConversation == 1 && !$user->isFollowing(WCF::getUser()->userID)) { throw new UserInputException($field, 'doesNotAcceptConversation'); } // active user is ignored by participant if ($user->isIgnoredUser(WCF::getUser()->userID)) { throw new UserInputException($field, 'ignoresYou'); } // check participant's mailbox quota if (ConversationHandler::getInstance()->getConversationCount($user->userID) >= $user->getPermission('user.conversation.maxConversations')) { throw new UserInputException($field, 'mailboxIsFull'); } } }