/** * Deletes the selected post. */ public function delete() { if ($this->post == null) { throw new IllegalLinkException(); } // check permission $this->board->checkModeratorPermission('canDeletePostCompletely'); // remove user stats ThreadEditor::updateUserStats($this->thread->threadID, 'delete'); PostEditor::updateUserStats(ThreadEditor::getAllPostIDs($this->thread->threadID), 'delete'); $this->post->unmark(); $this->post->delete(false); if ($this->thread->hasPosts()) { // delete only post $this->thread->checkVisibility(); if (!$this->post->isDeleted || !THREAD_ENABLE_RECYCLE_BIN) { $this->removePost(); } else { ThreadEditor::refreshFirstPostIDAll($this->thread->threadID); } // re-add user stats ThreadEditor::updateUserStats($this->thread->threadID, 'enable'); PostEditor::updateUserStats(ThreadEditor::getAllPostIDs($this->thread->threadID), 'enable'); // forward HeaderUtil::redirect($this->url); exit; } else { // delete complete thread $this->thread->delete(false, false); if (!$this->post->isDeleted || !THREAD_ENABLE_RECYCLE_BIN) { $this->board->refresh(); if ($this->post->time >= $this->board->getLastPostTime($this->thread->languageID)) { $this->board->setLastPosts(); } // reset cache ThreadAction::resetCache(); } HeaderUtil::redirect('index.php?page=Board&boardID=' . $this->board->boardID . SID_ARG_2ND_NOT_ENCODED); exit; } }