/** * @see Page::readData() */ public function readData() { parent::readData(); if (WCF::getUser()->hasDiliziumFeature("messageFolders")) { $this->folders = MessageFolder::getByUserID(WCF::getUser()->userID); if (WCF::getUser()->new_message && $this->active === null && !$this->checked) { // show new messages $this->messages = NMessage::getByUserID(WCF::getUser()->userID, null, null, true, self::MESSAGES_FOLDERS + 1, ($this->pageNo - 1) * self::MESSAGES_FOLDERS); foreach ($this->messages as $message) { if (!isset($this->spare[$message->folderID])) { $this->spare[$message->folderID] = $message->folderID; } } } else { // show requested messages if ($this->active === null && !$this->checked) { $this->active = array(); } $this->messages = NMessage::getByUserID(WCF::getUser()->userID, $this->checked, $this->active, false, self::MESSAGES_FOLDERS + 1, ($this->pageNo - 1) * self::MESSAGES_FOLDERS); } $this->nextPage = count($this->messages) > self::MESSAGES_FOLDERS; if ($this->nextPage) { array_pop($this->messages); } } else { $this->pageNo = 1; $this->messages = NMessage::getByUserID(WCF::getUser()->userID, $this->checked, $this->active, false, self::MESSAGES); } // update data $messageUpdates = array(); foreach ($this->messages as $message) { if (!$message->viewed) { $messageUpdates[] = $message->messageID; } } if (count($messageUpdates)) { NMessageEditor::view($messageUpdates, WCF::getUser()->userID); } }