예제 #1
0
파일: EditBoard.php 프로젝트: sinfocol/gwf3
 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);
 }
예제 #2
0
파일: AddThread.php 프로젝트: sinfocol/gwf3
 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()));
     }
 }