*/ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['username'])) $this->username = StringUtil::trim($_POST['username']); if (isset($_POST['preview'])) $this->preview = (boolean) $_POST['preview']; if (isset($_POST['send'])) $this->send = (boolean) $_POST['send']; if (isset($_POST['boardIDs'])) $this->boardIDs = ArrayUtil::toIntegerArray($_POST['boardIDs']); } /** * @see Form::submit() */ public function submit() { // call submit event EventHandler::fireAction($this, 'submit'); $this->readFormParameters(); try { // attachment handling if ($this->showAttachments) { $this->attachmentsEditor->handleRequest(); } // poll handling if ($this->showPoll) { $this->pollEditor->readParams(); } // preview if ($this->preview) { require_once(WCF_DIR.'lib/data/message/bbcode/AttachmentBBCode.class.php');
AttachmentBBCode::setAttachments($this->attachmentsEditor->getSortedAttachm
ents()); WCF::getTPL()->assign('preview', PostEditor::createPreview($this->subject, $this->text, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes)); } // send message or save as draft if ($this->send) { $this->validate(); // no errors $this->save(); } } catch (UserInputException $e) { $this->errorField = $e->getField(); $this->errorType = $e->getType(); } } /** * @see Form::validate() */ public function validate() { // subject, text, captcha parent::validate(); // username $this->validateUsername(); // poll if ($this->showPoll) $this->pollEditor->checkParams(); } /** * Validates the username. */ protected function validateUsername() { // only for guests if (WCF::getUser()->userID == 0) { // username if (empty($this->username)) { throw new UserInputException('username'); } if (!UserUtil::isValidUsername($this->username)) { throw new UserInputException('username', 'notValid'); } if (!UserUtil::isAvailableUsername($this->username)) { throw new UserInputException('username', 'notAvailable'); } WCF::getSession()->setUsername($this->username); } else { $this->username = WCF::getUser()->username; } } /** * @see Form::save() */ public function save() { parent::save(); // search for double posts if ($postID = PostEditor::test($this->subject, $this->text, WCF::getUser()->userID, $this->username)) { HeaderUtil::redirect('index.php?page=Thread&postID=' . $postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $postID); exit; } // save poll if ($this->showPoll) { $this->pollEditor->save(); } // save thread in database $this->newThread = ThreadEditor::create($this->board->boardID, 0, '', $this->subject, $this->text, WCF::getUser()->userID, $this->username, 0, 0, 0, $this->getOptions(), 0, $this->attachmentsEditor, $this->pollEditor); // update user posts if (WCF::getUser()->userID && $this->board->countUserPosts) { require_once(WBB_DIR.'lib/data/user/WBBUser.class.php'); WBBUser::updateUserPosts(WCF::getUser()->userID, 1); if (ACTIVITY_POINTS_PER_THREAD) { require_once(WCF_DIR.'lib/data/user/rank/UserRank.class.php'); UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_THREAD); } } // refresh counter and last post $this->board->addThreads(); $this->board->setLastPost($this->newThread); // reset stat cache WCF::getCache()->clearResource('stat'); WCF::getCache()->clearResource('boardData'); // send notifications $this->saved(); // forward to post HeaderUtil::redirect('index.php?page=Thread&threadID=' . $this->newThread->threadID . SID_ARG_2ND_NOT_ENCODED); exit; } /** * @see Page::readData() */ public function readData() { parent::readData(); if (!count($_POST)) { // default values $this->username = WCF::getSession()->username; } } /** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( 'username' => $this->username, 'board' => $this->board, 'boardID' => $this->board->boardID, 'postID' => 0, 'boardIDs' => $this->boardIDs, 'editorEnableWysiwygView' => 0, 'wysiwygEditorMode' => 0 )); } /** * @see Page::show() */ public function show() { if (!$this->board->getPermission('canStartPoll')) { $this->showPoll = false; } if (!$this->board->getPermission('canUploadAttachment')) { $this->showAttachments = false; } // get attachments editor if ($this->attachmentsEditor == null) { $this->attachmentsEditor = new AttachmentsEditor(0, 'post', WCF::getUser()->getPermission('user.board.maxAttachmentSize'), WCF::getUser()->getPermission('user.board.allowedAttachmentExtensions'), 1); } // get poll editor if ($this->pollEditor == null) $this->pollEditor = new PollEditor(); // show form parent::show(); } } ?>
Fatal error: Class 'ThreadAddForm' not found in /usr/export/www/vhosts/funnetwork/hosting/venetis/wbb/lib/form/PostAddForm.
class.php on line 16
|
|