示例#1
0
 private function onAddThread()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateAddThread();
     }
     $user = GWF_Session::getUser();
     $is_mod = $user === false && $this->module->isGuestPostModerated();
     $title = $form->getVar('title');
     $message = $form->getVar('message');
     $bid = $this->board->getID();
     $gid = $this->board->getGroupID();
     $options = 0;
     $options |= $is_mod === false ? 0 : GWF_ForumThread::IN_MODERATION;
     $options |= $this->board->isGuestView() ? GWF_ForumThread::GUEST_VIEW : 0;
     //		$options |= Common::getPost('guest_view') === false ? 0 : GWF_ForumThread::GUEST_VIEW;
     $date = GWF_Time::getDate(GWF_Time::LEN_SECOND);
     $thread = GWF_ForumThread::fakeThread($user, $title, $bid, $gid, 1, $options, $date);
     if (false === $thread->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $tid = $thread->getID();
     $gid = $thread->getGroupID();
     $options = 0;
     $options |= Common::getPost('bbcode') === false ? 0 : GWF_ForumPost::DISABLE_BB;
     $options |= Common::getPost('smileys') === false ? 0 : GWF_ForumPost::DISABLE_SMILE;
     $options |= $is_mod === false ? 0 : GWF_ForumPost::IN_MODERATION;
     $options |= $this->board->isGuestView() ? GWF_ForumPost::GUEST_VIEW : 0;
     $post = GWF_ForumPost::fakePost($user, $title, $message, $options, $tid, $gid, $date);
     if (false === $post->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (!$is_mod) {
         $thread->onApprove();
         //			$this->module->cachePostcoun();
         return $this->module->message('msg_posted', array($thread->getLastPageHREF()));
     } else {
         GWF_ForumSubscription::sendModerateThread($this->module, $thread, $message);
         return $this->module->message('msg_posted_mod', array($this->board->getShowBoardHREF()));
     }
 }
示例#2
0
文件: Reply.php 项目: sinfocol/gwf3
 private function onPreview()
 {
     $form = $this->getForm();
     $error = $form->validate($this->module);
     $user = GWF_Session::getUser();
     $title = $form->getVar('title');
     $message = $form->getVar('message');
     $options = 0;
     $options |= Common::getPost('bbcode') === false ? 0 : GWF_ForumPost::DISABLE_BB;
     $options |= Common::getPost('smileys') === false ? 0 : GWF_ForumPost::DISABLE_SMILE;
     $tVars = array('thread' => GWF_ForumThread::fakeThread($user, $title), 'posts' => array(GWF_ForumPost::fakePost($user, $title, $message, $options, 0, 0, true, true)), 'pagemenu' => '', 'actions' => false, 'title' => false, 'reply' => true, 'nav' => false, 'can_vote' => false, 'can_thank' => false, 'term' => '');
     return $error . $this->templateLastPosts() . '<a name="form"></a>' . $this->module->templatePHP('show_thread.php', $tVars) . $this->templateReply(true);
 }
示例#3
0
 public function onPreview()
 {
     $form = $this->getForm();
     $errors = $form->validate($this->module);
     //		$user = GWF_Session::getUser();
     $user = $this->post->getUser(true);
     $title = $form->getVar('title');
     $message = $form->getVar('message');
     $options = 0;
     $options |= Common::getPost('bbcode') === false ? 0 : GWF_ForumPost::DISABLE_BB;
     $options |= Common::getPost('smileys') === false ? 0 : GWF_ForumPost::DISABLE_SMILE;
     $tVars = array('thread' => GWF_ForumThread::fakeThread($user, $title), 'posts' => array(GWF_ForumPost::fakePost($user, $title, $message, $options, 0, 0, GWF_Time::getDate(GWF_Date::LEN_SECOND), true)), 'pagemenu' => '', 'actions' => false, 'title' => false, 'reply' => true, 'nav' => false, 'term' => '', 'page' => 0, 'href_edit' => '');
     $preview = $this->module->templatePHP('show_thread.php', $tVars);
     return $errors . $preview . $this->templateEdit();
 }
示例#4
0
文件: WC_Site.php 项目: sinfocol/gwf3
 public function onCreateThread(Module_WeChall $module)
 {
     if (false !== ($thread = $this->getThread())) {
         return true;
     }
     $title = 'Comments on ' . $this->getSitename();
     $options = GWF_ForumThread::GUEST_VIEW;
     $thread = GWF_ForumThread::fakeThread($module->cfgWeChallUser(), $title, $this->getBoardID(), 0, 0, $options);
     if (false === $thread->insert()) {
         return false;
     }
     if (false === $this->saveVar('site_threadid', $thread->getID())) {
         return false;
     }
     return $thread->onApprove(false, 0);
 }