Example #1
0
 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;
 }
Example #2
0
 public function onRequestInit()
 {
     GWF_ForumBoard::init();
     # Init by Post
     if (0 !== ($this->post_id = (int) Common::getGet('pid', 0))) {
         if (false === ($this->post = GWF_ForumPost::getPost($this->post_id))) {
             $this->post_id = 0;
         } elseif (false !== ($this->thread = $this->post->getThread())) {
             $this->thread_id = $this->thread->getID();
             if (false !== ($this->board = $this->thread->getBoard())) {
                 $this->board_id = $this->board->getID();
             }
         }
     } elseif (0 !== ($this->thread_id = (int) Common::getGet('tid', 0))) {
         if (false === ($this->thread = GWF_ForumThread::getThread($this->thread_id))) {
             $this->thread_id = 0;
         } elseif (false !== ($this->board = $this->thread->getBoard())) {
             $this->board_id = $this->board->getID();
         }
     } else {
         $this->board_id = Common::getGetString('bid', '1');
         if (false === ($this->board = GWF_ForumBoard::getBoard($this->board_id))) {
             $this->board_id = '1';
             if (false === ($this->board = GWF_ForumBoard::getRoot())) {
                 $this->board_id = '0';
             }
         }
     }
     if ($this->thread_id !== 0 && 0 < ($cut = $this->cfgWatchTimeout())) {
         GWF_ForumVisitors::setWatching($this->thread, $cut);
     }
 }
Example #3
0
 public static function sendModeratePost(Module_Forum $module, GWF_ForumPost $post)
 {
     $thread = $post->getThread();
     $boardtxt = self::getBoardTreeText($thread->getBoard());
     $threadtxt = $thread->display('thread_title');
     $usertxt = GWF_User::getStaticOrGuest()->display('user_name');
     $title = $post->displayTitle();
     $message = $post->displayMessage(array(), true);
     $pid = $post->getID();
     $token = $post->getToken();
     $addtxt = Common::getAbsoluteURL('index.php?mo=Forum&me=Moderate&yes_post=' . $pid . '&token=' . $token);
     $remtxt = Common::getAbsoluteURL('index.php?mo=Forum&me=Moderate&no_post=' . $pid . '&token=' . $token);
     return self::sendModMail($module, $boardtxt, $threadtxt, $usertxt, $title, $message, $addtxt, $remtxt);
 }