/**
  * Gets a list of attachments.
  */
 protected function readAttachments()
 {
     // read attachments
     if (MODULE_ATTACHMENT == 1 && count($this->attachmentPostIDArray) > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->attachmentPostIDArray, 'post');
         $this->attachmentList->readObjects();
         $this->attachments = $this->attachmentList->getSortedAttachments($this->canViewAttachmentPreview);
         // set embedded attachments
         if ($this->canViewAttachmentPreview) {
             require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
             AttachmentBBCode::setAttachments($this->attachments);
         }
         // remove embedded attachments from list
         if (count($this->attachments) > 0) {
             MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
         }
     }
 }
 /**
  * Gets a list of attachments.
  */
 protected function readAttachments()
 {
     // read attachments
     if (MODULE_ATTACHMENT == 1 && count($this->attachmentEntryIDArray) > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->attachmentEntryIDArray, 'contestEntry', '', WCF::getPackageID('de.easy-coding.wcf.contest'));
         $this->attachmentList->readObjects();
         $this->attachments = $this->attachmentList->getSortedAttachments(WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview'));
         // set embedded attachments
         if (WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')) {
             require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
             AttachmentBBCode::setAttachments($this->attachments);
         }
         // remove embedded attachments from list
         if (count($this->attachments) > 0) {
             MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
         }
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get post list
     $this->postList = new PostAddPostList($this->thread, $this->board);
     // old thread warning
     if (REPLY_OLD_THREAD_WARNING && $this->thread->lastPostTime > 0) {
         $this->oldThreadWarning = intval(floor((TIME_NOW - $this->thread->lastPostTime) / 86400));
         if ($this->oldThreadWarning < REPLY_OLD_THREAD_WARNING) {
             $this->oldThreadWarning = 0;
         }
     }
     $this->attachments = $this->postList->attachments;
     if (count($this->attachments) > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
     }
     // default values
     if (!count($_POST)) {
         $this->closeThread = $this->thread->isClosed;
         $this->subscription = $this->thread->subscribed;
         if (!$this->subscription && WCF::getUser()->enableSubscription) {
             $this->subscription = 1;
         }
         // single quote
         if ($this->action == 'quote') {
             $post = $this->thread->getPost();
             if ($post) {
                 $this->text = "[quote='" . StringUtil::replace("'", "\\'", $post->username) . "',index.php?page=Thread&postID=" . $post->postID . "#post" . $post->postID . "]" . $post->message . "[/quote]";
                 if ($post->subject) {
                     $this->subject = WCF::getLanguage()->get('wbb.postAdd.quote.subject', array('$subject' => $post->subject));
                 }
             }
         }
     }
 }
 /**
  * Gets a list of attachments.
  */
 protected function readAttachments()
 {
     // read attachments
     if (MODULE_ATTACHMENT == 1 && count($this->attachmentPMIDArray)) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->attachmentPMIDArray, 'pm', '', WCF::getPackageID('com.woltlab.wcf.data.message.pm'));
         $this->attachmentList->readObjects();
         $this->attachments = $this->attachmentList->getSortedAttachments();
         require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
         AttachmentBBCode::setAttachments($this->attachments);
         if (count($this->attachments) > 0) {
             MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
         }
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // show 5 entries on first page, but 20 on the following pages
     $this->eventmixList->sqlLimit = $this->pageNo <= 1 ? $this->itemsOnLandingpage : $this->itemsPerPage;
     $this->eventmixList->sqlOffset = $this->pageNo <= 1 ? 0 : ($this->pageNo - 2) * $this->itemsPerPage + $this->itemsOnLandingpage;
     // fire sql query
     $this->eventmixList->readObjects();
     // get previous entry
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime > " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID < " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime ASC, contestID DESC";
     $this->previousEntry = new Contest(null, WCF::getDB()->getFirstRow($sql));
     if (!$this->previousEntry->contestID) {
         $this->previousEntry = null;
     }
     // get next entry
     $sql = "SELECT\t\t*\n\t\t\tFROM\t\twcf" . WCF_N . "_contest\n\t\t\tWHERE\t\tuserID = " . intval($this->entry->userID) . "\n\t\t\t\t\tAND (\n\t\t\t\t\t\ttime < " . intval($this->entry->time) . "\n\t\t\t\t\t\tOR (time = " . intval($this->entry->time) . " AND contestID > " . intval($this->entry->contestID) . ")\n\t\t\t\t\t)\n\t\t\tORDER BY\ttime DESC, contestID ASC";
     $this->nextEntry = new Contest(null, WCF::getDB()->getFirstRow($sql));
     if (!$this->nextEntry->contestID) {
         $this->nextEntry = null;
     }
     // read attachments
     if (MODULE_ATTACHMENT == 1 && $this->entry->attachments > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->contestID, 'contestEntry', '', WCF::getPackageID('de.easy-coding.wcf.contest'));
         $this->attachmentList->readObjects();
         $this->attachments = $this->attachmentList->getSortedAttachments(WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview'));
         // set embedded attachments
         if (WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')) {
             require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
             AttachmentBBCode::setAttachments($this->attachments);
         }
         // remove embedded attachments from list
         if (count($this->attachments) > 0) {
             MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
         }
     }
     if ($this->entry->isOwner()) {
         // init todo list
         require_once WCF_DIR . 'lib/data/contest/owner/todo/ContestOwnerTodoList.class.php';
         $this->todoList = new ContestOwnerTodoList();
         $this->todoList->sqlConditions .= 'contest.contestID = ' . intval($this->contestID);
         $this->todoList->readObjects();
     }
     // init sidebar
     $this->sidebar = new ContestSidebar($this->entry);
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!count($_POST)) {
         $this->closeThread = $this->thread->isClosed;
         $this->text = $this->post->message;
         $this->subject = $this->post->subject;
         $this->subscription = $this->thread->subscribed;
         $this->prefix = $this->thread->prefix;
         if ($this->thread->isSticky) {
             $this->isImportant = 1;
         }
         if ($this->thread->isAnnouncement) {
             $this->isImportant = 2;
         }
         $this->boardIDs = $this->thread->getAssignedBoards();
         $this->languageID = $this->thread->languageID;
         $this->editReason = $this->post->editReason;
         $this->enableSmilies = $this->post->enableSmilies;
         $this->enableHtml = $this->post->enableHtml;
         $this->enableBBCodes = $this->post->enableBBCodes;
         $this->showSignature = $this->post->showSignature;
         // tags
         if (THREAD_ENABLE_TAGS && $this->thread->firstPostID == $this->postID) {
             $this->tags = TaggingUtil::buildString($this->thread->getTags(array($this->languageID)));
         }
     }
     // get post list
     if ($this->thread->firstPostID != $this->postID) {
         try {
             require_once WBB_DIR . 'lib/data/post/PostEditPostList.class.php';
             $this->postList = new PostEditPostList($this->post, $this->thread, $this->board);
             $this->attachments = $this->postList->attachments;
             if (count($this->attachments) > 0) {
                 require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
                 MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
             }
         } catch (SystemException $e) {
         }
     }
 }
 /**
  * @see Form::readData()
  */
 public function readData()
 {
     parent::readData();
     if ($this->sendPickNotification) {
         $this->solutionObj->getEditor()->sendPickNotification();
     }
     // init todo list
     $this->todoList = new ContestParticipantTodoList();
     $this->todoList->sqlConditions .= 'contest_participant.contestID = ' . intval($this->contestID);
     $this->todoList->readObjects();
     // read comments
     $this->commentList->sqlOffset = ($this->pageNo - 1) * $this->itemsPerPage;
     $this->commentList->sqlLimit = $this->itemsPerPage;
     $this->commentList->readObjects();
     // read ratings
     $this->ratingList->readObjects();
     // read attachments
     if (MODULE_ATTACHMENT == 1 && $this->solutionObj->attachments > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         $this->attachmentList = new MessageAttachmentList($this->solutionObj->solutionID, 'contestSolutionEntry', '', WCF::getPackageID('de.easy-coding.wcf.contest'));
         $this->attachmentList->readObjects();
         $this->attachments = $this->attachmentList->getSortedAttachments(WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview'));
         // set embedded attachments
         if (WCF::getUser()->getPermission('user.contest.canViewAttachmentPreview')) {
             require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
             AttachmentBBCode::setAttachments($this->attachments);
         }
         // remove embedded attachments from list
         if (count($this->attachments) > 0) {
             MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
         }
     }
     // init sidebar
     $this->sidebar = new ContestSidebar($this->entry);
 }