示例#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;
 }