private function deleteThread($tid, $token) { if (false === ($thread = GWF_ForumThread::getThread($tid))) { return $this->module->error('err_thread'); } if ($token !== $thread->getToken()) { return $this->module->error('err_token'); } if (false === $thread->deleteThread()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_thread_deleted'); }
public function execute() { if (false === ($mod_votes = GWF_Module::loadModuleDB('Votes'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Votes')); } $mod_votes->onInclude(); if (!($this->thread = GWF_ForumThread::getThread(Common::getGet('tid')))) { return $this->module->error('err_thread'); } $this->user = GWF_Session::getUser(); if (!$this->thread->mayAddPoll($this->user)) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false !== Common::getPost('assign')) { return $this->onAssign() . $this->template(); } return $this->template(); }
private function onEdit() { $t = $this->thread; $form = $this->getForm(); if (false !== ($error = $form->validate($this->module))) { return $error; } $t->saveOption(GWF_ForumThread::HIDDEN, isset($_POST['hidden'])); $t->saveOption(GWF_ForumThread::STICKY, isset($_POST['sticky'])); $t->saveOption(GWF_ForumThread::CLOSED, isset($_POST['closed'])); $t->saveOption(GWF_ForumThread::GUEST_VIEW, isset($_POST['guest_view'])); $t->saveOption(GWF_ForumThread::INVISIBLE, isset($_POST['invisible'])); $t->saveVars(array('thread_title' => $form->getVar('title'))); if ($t->getBoardID() !== ($bid = $form->getVar('move'))) { // var_dump($bid); return $this->onMove($t, GWF_ForumBoard::getBoard($bid)); } else { if ($t->getID() !== ($tid = $form->getVar('merge'))) { return $this->onMerge($t, GWF_ForumThread::getThread($tid)); } } return $this->module->message('msg_edited_thread'); }
public function validate_thread($arg) { if (false === GWF_ForumThread::getThread($arg)) { return $this->lang('err_thread'); } return false; }
/** * @return GWF_ForumThread */ public function getThread() { return GWF_ForumThread::getThread($this->getVar('post_tid')); }