/** * Opens the selected post. */ public function open() { if (!$this->board->getModeratorPermission('canClosePost')) { return; } if ($this->post != null && $this->post->isClosed) { $this->post->open(); } }
/** * Opens the selected thread. */ public function open() { if (!$this->board->getModeratorPermission('canCloseThread')) { return; } if ($this->thread != null && $this->thread->isClosed) { $this->thread->open(); } }
/** * @see Action::readParameters() */ public function readParameters() { parent::readParameters(); try { // get post if (isset($_REQUEST['postID'])) { $this->postID = intval($_REQUEST['postID']); } $this->post = new PostEditor($this->postID); if (!$this->post->postID) { throw new IllegalLinkException(); } // get thread $this->thread = new ThreadEditor($this->post->threadID); $this->board = new BoardEditor($this->thread->boardID); $this->thread->enter($this->board); // check permissions $isModerator = $this->board->getModeratorPermission('canEditPost') || $this->board->getModeratorPermission('canDeletePost'); $isAuthor = $this->post->userID && $this->post->userID == WCF::getUser()->userID; $canEditPost = $this->board->getModeratorPermission('canEditPost') || $isAuthor && $this->board->getPermission('canEditOwnPost'); if (!$canEditPost || !$isModerator && ($this->board->isClosed || $this->thread->isClosed || $this->post->isClosed)) { throw new PermissionDeniedException(); } // check post edit timeout if (!$isModerator && WCF::getUser()->getPermission('user.board.postEditTimeout') != -1 && TIME_NOW - $this->post->time > WCF::getUser()->getPermission('user.board.postEditTimeout') * 60) { throw new NamedUserException(WCF::getLanguage()->get('wbb.postEdit.error.timeout', array('$timeout' => WCF::getUser()->getPermission('user.board.postEditTimeout')))); } // get message if (isset($_POST['text'])) { $this->text = StringUtil::trim($_POST['text']); if (CHARSET != 'UTF-8') { $this->text = StringUtil::convertEncoding('UTF-8', CHARSET, $this->text); } if (empty($this->text)) { throw new IllegalLinkException(); } } } catch (UserException $e) { @header('HTTP/1.0 403 Forbidden'); echo $e->getMessage(); exit; } }
/** * @see Form::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); if (isset($_POST['username'])) { $this->username = StringUtil::trim($_POST['username']); } if (isset($_POST['prefix']) && $this->board->getPermission('canUsePrefix')) { $this->prefix = $_POST['prefix']; } if (isset($_POST['preview'])) { $this->preview = (bool) $_POST['preview']; } if (isset($_POST['send'])) { $this->send = (bool) $_POST['send']; } if (isset($_POST['boardIDs'])) { $this->boardIDs = ArrayUtil::toIntegerArray($_POST['boardIDs']); } if (isset($_POST['languageID'])) { $this->languageID = intval($_POST['languageID']); } if (isset($_POST['tags'])) { $this->tags = StringUtil::trim($_POST['tags']); } $this->subscription = $this->closeThread = $this->isImportant = 0; // subscription if (isset($_POST['subscription'])) { $this->subscription = intval($_POST['subscription']); } // close thread if (isset($_POST['closeThread']) && $this->board->getModeratorPermission('canCloseThread')) { $this->closeThread = intval($_POST['closeThread']); } // disable thread if (isset($_POST['disableThread']) && $this->board->getModeratorPermission('canEnableThread')) { $this->disableThread = intval($_POST['disableThread']); } // thread status if (isset($_POST['isImportant'])) { $this->isImportant = intval($_POST['isImportant']); } if ($this->isImportant < 0 || $this->isImportant > 2) { $this->isImportant = 0; } if ($this->isImportant == 1 && !$this->board->getModeratorPermission('canPinThread')) { $this->isImportant = 0; } if ($this->isImportant == 2 && !$this->board->getModeratorPermission('canStartAnnouncement')) { $this->isImportant = 0; } }