Ejemplo n.º 1
0
 private function onEditBoard()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error;
     }
     if (!$this->board->isRoot()) {
         $bid = $this->board->getID();
         if ($bid !== ($newpid = (int) $form->getVar('moveboard'))) {
             if ($this->board->getParentID() !== $newpid) {
                 if (false !== ($newparent = GWF_ForumBoard::getBoard($newpid))) {
                     if (false === $this->board->move($newparent)) {
                         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
                     }
                 }
             }
         }
     }
     $this->board->saveVars(array('board_gid' => $form->getVar('groupid'), 'board_title' => $form->getVar('title'), 'board_descr' => $form->getVar('descr')));
     # Options
     $this->board->saveOption(GWF_ForumBoard::ALLOW_THREADS, Common::getPost('allow_threads') !== false);
     $this->board->saveOption(GWF_ForumBoard::LOCKED, Common::getPost('is_locked') !== false);
     $this->board->saveOption(GWF_ForumBoard::GUEST_POSTS, Common::getPost('guests') !== false);
     $this->board->saveOption(GWF_ForumBoard::GUEST_VIEW, Common::getPost('guest_view') !== false);
     if (!$this->board->isRoot()) {
         $this->board->saveOption(GWF_ForumBoard::INVISIBLE, Common::getPost('invisible') !== false);
     }
     return $this->module->message('msg_edited_board', array($this->board->getShowBoardHREF()));
 }
Ejemplo n.º 2
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()));
     }
 }