/** * @see Page::readData() */ public function readData() { parent::readData(); // calculates page number $this->calculateNumberOfPMPages(); // get messages $this->pmList->sqlOffset = ($this->pmPageNo - 1) * $this->pmItemsPerPage; $this->pmList->sqlLimit = $this->pmItemsPerPage; $this->pmList->readObjects(); // mark messages as read foreach ($this->pmList->getObjects() as $pm) { $pm->markAsRead(); } // init sidebars $this->sidebarFactory = new MessageSidebarFactory($this); foreach ($this->pmList->getObjects() as $pm) { $this->sidebarFactory->create($pm); } $this->sidebarFactory->init(); // get folders $this->loadMoveToOptions(); // update folder id $this->updateFolderID(); }
/** * @see Page::readData() */ public function readData() { parent::readData(); if (!count($_POST)) { // default values // user if ($this->userID) { $user = new User($this->userID); $this->recipients = $user->username; } // existing message if ($this->pm) { if ($this->forwarding) { $data = array('$author' => $this->pm->username ? $this->pm->username : WCF::getLanguage()->get('wcf.pm.author.system'), '$date' => DateUtil::formatTime(null, $this->pm->time), '$recipients' => implode(', ', $this->pm->getRecipients()), '$subject' => $this->pm->subject, '$text' => $this->pm->message); $this->subject = WCF::getLanguage()->get('wcf.pm.forward.subject', array('$subject' => $this->pm->subject)); $this->text = WCF::getLanguage()->get('wcf.pm.forward.text', $data); } else { if ($this->reply) { $this->subject = WCF::getLanguage()->get('wcf.pm.reply.subject', array('$subject' => $this->pm->subject)); // replace RE: RE: RE: by RE[3]: $this->subject = preg_replace('/(^RE: RE\\[)(\\d+)(?=\\]:)/ie', '"RE[".(\\2+1)', $this->subject); $this->subject = preg_replace('/^(RE: RE:(?: RE:)+)/ie', '"RE[".substr_count("\\1", "RE:")."]:"', $this->subject); if ($this->replyToAll == 1) { $recipients = array(); foreach ($this->pm->getRecipients() as $recipient) { $recipients[] = $recipient->recipient; } $recipients[] = $this->pm->username; $recipients = array_unique($recipients); foreach ($recipients as $key => $value) { if (StringUtil::toLowerCase($value) == StringUtil::toLowerCase(WCF::getUser()->username)) { unset($recipients[$key]); break; } } $this->recipients = implode(', ', $recipients); } else { $this->recipients = $this->pm->username; } } else { // edit draft $sql = "SELECT\t\trecipient, isBlindCopy\n\t\t\t\t\t\tFROM\t\twcf" . WCF_N . "_pm_to_user\n\t\t\t\t\t\tWHERE\t\tpmID = " . $this->pm->pmID . "\n\t\t\t\t\t\tORDER BY\trecipient"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { if ($row['isBlindCopy']) { if (!empty($this->blindCopies)) { $this->blindCopies .= ', '; } $this->blindCopies .= $row['recipient']; } else { if (!empty($this->recipients)) { $this->recipients .= ', '; } $this->recipients .= $row['recipient']; } } $this->subject = $this->pm->subject; $this->text = $this->pm->message; // options $this->enableSmilies = $this->pm->enableSmilies; $this->enableHtml = $this->pm->enableHtml; $this->enableBBCodes = $this->pm->enableBBCodes; $this->showSignature = $this->pm->showSignature; } } } } if ($this->reply) { require_once WCF_DIR . 'lib/data/message/pm/PMList.class.php'; $this->pmList = new PMList($this->pm); $this->pmList->sqlLimit = 10; $this->pmList->readObjects(); } }