Exemplo n.º 1
0
 private function getForm()
 {
     $buttons = array('edit_board' => $this->module->lang('btn_edit_board'), 'delete_board' => $this->module->lang('btn_rem_board'));
     $data = array('groupid' => array(GWF_Form::SELECT, $this->module->getGroupSelect($this->board->getGroupID()), $this->module->lang('th_groupid')), 'title' => array(GWF_Form::STRING, $this->board->display('board_title'), $this->module->lang('th_title')), 'descr' => array(GWF_Form::STRING, $this->board->display('board_descr'), $this->module->lang('th_descr')), 'allow_threads' => array(GWF_Form::CHECKBOX, $this->board->isThreadAllowed(), $this->module->lang('th_thread_allowed')), 'guest_view' => array(GWF_Form::CHECKBOX, $this->board->isGuestView(), $this->module->lang('th_guest_view')), 'is_locked' => array(GWF_Form::CHECKBOX, $this->board->isLocked(), $this->module->lang('th_locked')), 'guests' => array(GWF_Form::CHECKBOX, $this->board->isGuestPostAllowed(), $this->module->lang('th_guests')), 'invisible' => array(GWF_Form::CHECKBOX, $this->board->isInvisible(), $this->module->lang('th_invisible')));
     //		if (!$this->board->isRoot()) {
     //			$data['moveboard'] = array(GWF_Form::SELECT, $this->board->getBoardSelect(), $this->module->lang('th_move_board'), 0, 'GWF_ForumBoard');
     //		}
     $data['submit'] = array(GWF_Form::SUBMITS, $buttons, '');
     return new GWF_Form($this, $data);
 }
Exemplo 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()));
     }
 }
Exemplo n.º 3
0
 private function getForm()
 {
     $parent = $this->module->getCurrentBoard();
     $data = array('parentid' => array(GWF_Form::HIDDEN, $parent->getID()), 'groupid' => array(GWF_Form::SELECT, $this->module->getGroupSelect($this->board->getGroupID()), $this->module->lang('th_groupid')), 'title' => array(GWF_Form::STRING, '', $this->module->lang('th_board_title')), 'descr' => array(GWF_Form::STRING, '', $this->module->lang('th_board_descr')), 'allow_threads' => array(GWF_Form::CHECKBOX, true, $this->module->lang('th_thread_allowed')), 'is_locked' => array(GWF_Form::CHECKBOX, false, $this->module->lang('th_locked')), 'guest_view' => array(GWF_Form::CHECKBOX, $parent->isGuestView(), $this->module->lang('th_guest_view')), 'guests' => array(GWF_Form::CHECKBOX, $this->board->isGuestPostAllowed(), $this->module->lang('th_guests')), 'add_board' => array(GWF_Form::SUBMIT, $this->module->lang('btn_add_board')));
     return new GWF_Form($this, $data);
 }
Exemplo n.º 4
0
 private function onMove(GWF_ForumThread $t, GWF_ForumBoard $b)
 {
     //		if (false === ($b->isThreadAllowed())) {
     //			$_POST['move'] = $t->getBoardID();
     //			return $this->module->error('err_no_thread_allowed');
     //		}
     $pc = $t->getPostCount();
     if (false === $t->getBoard()->adjustCounters(-1, -$pc)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $b->adjustCounters(1, $pc)) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $t->saveVars(array('thread_bid' => $b->getID(), 'thread_gid' => $b->getGroupID()))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === $t->saveVar('thread_bid', $b->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_thread_moved', array($t->display('thread_title'), $b->display('board_title')));
 }