示例#1
0
文件: Reply.php 项目: sinfocol/gwf3
 private function sanitize()
 {
     $this->quoted = Common::getGet('quote') !== false;
     if (false === ($pid = Common::getGet('pid'))) {
         if (false === ($this->thread = $this->module->getCurrentThread())) {
             return $this->module->error('err_post');
         }
         if (false === ($this->post = $this->thread->getLastPost())) {
             //				return $this->module->error('err_post');
         }
         $this->replyThread = true;
     } elseif (false === ($this->post = $this->module->getCurrentPost())) {
         return $this->module->error('err_post');
     } else {
         if (false === ($this->thread = $this->post->getThread())) {
             return $this->module->error('err_post');
         }
     }
     # Check Permission
     $user = GWF_Session::getUser();
     if (!$this->thread->hasReplyPermission($user, $this->module)) {
         $a = GWF_HTML::display($this->post->getShowHREF());
         return $this->module->error('err_reply_perm', array($a));
     }
     if (false !== ($last_post = $this->thread->getLastPost())) {
         if ($last_post->getPosterID() === GWF_Session::getUserID()) {
             if (!$this->module->cfgDoublePost()) {
                 $a = GWF_HTML::display($this->post->getShowHREF());
                 return $this->module->error('err_better_edit', array($a));
             }
         }
     }
     return false;
 }
示例#2
0
 private function templateThread()
 {
     $this->thread->increase('thread_viewcount', 1);
     if (false !== ($user = GWF_Session::getUser())) {
         if (false === $this->thread->markRead($user)) {
             echo GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
         }
     }
     $tVars = array('thread' => $this->thread, 'posts' => $this->thread->getPostPage($this->ppt, $this->page), 'pagemenu' => $this->getPageMenu(), 'actions' => true, 'title' => true, 'reply' => $this->thread->hasReplyPermission(GWF_Session::getUser(), $this->module), 'nav' => true, 'can_vote' => $user === false ? false : $this->module->cfgVotesEnabled(), 'can_thank' => $user === false ? false : $this->module->cfgThanksEnabled(), 'term' => GWF_QuickSearch::getQuickSearchHighlights(Common::getRequest('term', '')), 'page' => $this->page, 'href_add_poll' => $this->thread->hrefAddPoll(), 'href_edit' => $this->thread->getEditHREF());
     return $this->module->templatePHP('show_thread.php', $tVars);
 }