示例#1
0
 public function handleActions()
 {
     if (!empty($this->scriptProperties['spam-thread'])) {
         if ($this->thread->remove(array(), true, true)) {
             $this->discuss->logActivity('thread_spam_remove', $this->thread->toArray(), $this->thread->getUrl());
             $url = $this->discuss->request->makeUrl('board', array('board' => $this->thread->get('board')));
             $this->modx->sendRedirect($url);
         }
     }
 }
示例#2
0
 public function handleActions()
 {
     /* process form */
     if (!empty($this->scriptProperties['remove-message'])) {
         if ($this->thread->remove()) {
             /* log activity */
             $this->discuss->logActivity('message_thread_remove', $this->thread->toArray(), $this->thread->getUrl());
             $url = $this->discuss->request->makeUrl('messages');
             $this->modx->sendRedirect($url);
         }
     }
 }
示例#3
0
 public function process()
 {
     $this->setPlaceholders($this->thread->toArray());
     if ($this->post->remove()) {
         $this->discuss->logActivity('message_post_remove', $this->post->toArray(), $this->post->getUrl());
         $posts = $this->thread->getMany('Posts');
         if (count($posts) <= 0) {
             $url = $this->discuss->request->makeUrl('messages');
         } else {
             $url = $this->discuss->request->makeUrl('messages/view', array('thread' => $this->thread->get('id')));
         }
         $this->modx->sendRedirect($url);
     }
 }
示例#4
0
 public function process()
 {
     /* up view count and mark read */
     $this->view();
     $this->markRead();
     /* get posts */
     $this->getAnswers();
     $this->getPosts();
     $this->getLastPost();
     $this->setPlaceholder('rtl', $this->board->get('rtl'));
     $threadArray = $this->thread->toArray('', true, true);
     $this->setPlaceholders($threadArray);
     $this->setPlaceholder('title', $this->thread->get('title'));
     $this->setPlaceholder('title_value', $threadArray['title']);
     $this->setPlaceholder('views', number_format($this->getPlaceholder('views', 1)));
     $this->setPlaceholder('replies', number_format($this->getPlaceholder('replies', 0)));
     $this->setPlaceholder('url', $this->thread->getUrl(false, array(), true));
     /* set css class of thread */
     $this->thread->buildCssClass();
     $this->getQuickReplyForm();
     if ($this->discuss->user->isLoggedIn && empty($this->scriptProperties['print'])) {
         $this->getActionButtons();
     }
     if ($this->discuss->user->isLoggedIn && ($this->isModerator || $this->isAdmin) && empty($this->scriptProperties['print'])) {
         $this->getModeratorActionButtons();
     }
     /* output */
     $this->setPlaceholder('discuss.error_panel', $this->discuss->getChunk('Error'));
     $this->setPlaceholder('discuss.thread', $this->thread->get('title'));
     $this->buildPagination();
     $this->getViewing();
     $this->fireOnRenderThread();
 }
示例#5
0
 public function prepareThread(disThread $thread)
 {
     $threadArray = $thread->toArray();
     if (!empty($threadArray['post_last_on'])) {
         $threadArray['post_last_on'] = strftime($this->getProperty('dateFormat'), strtotime($threadArray['post_last_on']));
     } else {
         $threadArray['post_last_on'] = '';
     }
     return $threadArray;
 }
示例#6
0
 public function process()
 {
     $this->view();
     $this->thread->buildCssClass();
     $this->getQuickReplyForm();
     $threadArray = $this->thread->toArray();
     $threadArray['url'] = $this->thread->getUrl(false);
     $threadArray['views'] = number_format($threadArray['views']);
     $threadArray['replies'] = number_format($threadArray['replies']);
     $this->setPlaceholders($threadArray);
     $this->markAsRead();
     $this->getThreadPosts();
     $this->getLastPost();
     $this->getViewing();
     $this->buildPagination();
     $this->getActionButtons();
     $this->setPlaceholder('discuss.error_panel', $this->discuss->getChunk('Error'));
     $this->setPlaceholder('discuss.thread', $this->thread->get('title'));
 }
示例#7
0
 /**
  * Prepare the thread for iteration
  * @param disThread $thread
  * @return array
  */
 protected function prepareThread(disThread $thread)
 {
     $thread->calcLastPostPage();
     $thread->getUrl();
     $threadArray = $thread->toArray();
     $threadArray['createdon'] = strftime($this->getOption('dateFormat'), strtotime($threadArray['createdon']));
     $threadArray['icons'] = '';
     /* set css class */
     $class = $this->getOption('clsRow');
     $class = explode(',', $class);
     if ($this->getOption('enableHot')) {
         $threshold = $this->getOption('hotThreadThreshold');
         if ($this->discuss->user->get('id') == $threadArray['author'] && $this->discuss->user->isLoggedIn) {
             $class[] = $threadArray['replies'] < $threshold ? $this->getOption('clsMyNormalThread') : $this->getOption('clsMyHotThread');
         } else {
             $class[] = $threadArray['replies'] < $threshold ? $this->getOption('clsNormalThread') : $this->getOption('clsHotThread');
         }
     }
     $threadArray['class'] = implode(' ', $class);
     /* if sticky/locked */
     $icons = array();
     if ($threadArray['locked']) {
         $icons[] = $this->getOption('iconLocked');
     }
     if ($this->getOption('enableSticky') && $threadArray['sticky']) {
         $icons[] = $this->getOption('iconSticky');
     }
     $threadArray['icons'] = implode($this->getOption('iconSeparator'), $icons);
     $threadArray['views'] = number_format($threadArray['views']);
     $threadArray['replies'] = number_format($threadArray['replies']);
     /* unread class */
     $threadArray['unread'] = true;
     $threadArray['unread-cls'] = $this->getOption('clsUnread');
     $threadArray['author_link'] = $this->getOption('canViewProfiles') ? '<a class="dis-last-post-by" href="' . $this->discuss->request->makeUrl('user', array('type' => 'username', 'user' => $threadArray['author_username'])) . '">' . $threadArray['author_username'] . '</a>' : $threadArray['author_username'];
     return $threadArray;
 }