Example #1
0
 private function deletePost($pid, $token)
 {
     if (false === ($post = GWF_ForumPost::getPost($pid))) {
         return $this->module->error('err_post');
     }
     if ($token !== $post->getToken()) {
         return $this->module->error('err_token');
     }
     if (false === $post->deletePost()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_post_deleted');
 }
Example #2
0
 public function execute()
 {
     if (false === ($this->post = GWF_ForumPost::getPost(Common::getGet('pid', 0)))) {
         return $this->module->error('err_post');
     }
     if (!$this->post->hasEditPermission()) {
         return GWF_HTML::err('ERR_NO_PERMISSION');
     }
     if (false !== Common::getPost('add')) {
         return $this->onAdd();
     }
     return $this->templateAdd();
 }
Example #3
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 #4
0
 /**
  * Get the forum post associated with this attachment.
  * @return GWF_ForumPost
  */
 public function getPost()
 {
     return GWF_ForumPost::getPost($this->getVar('fatt_pid'));
 }