/**
  * Deletes all marked posts.
  */
 public function deleteAll()
 {
     if (!empty($this->postIDs)) {
         // get threadids
         $threadIDs = PostEditor::getThreadIDs($this->postIDs);
         // get boards
         list($boards, $boardIDs) = ThreadEditor::getBoards($threadIDs);
         // check permissions
         foreach ($boards as $board) {
             $board->checkModeratorPermission('canDeletePost');
         }
         // get thread ids of deleted posts
         $threadIDs2 = '';
         $sql = "SELECT \tDISTINCT threadID\n\t\t\t\tFROM \twbb" . WBB_N . "_post\n\t\t\t\tWHERE \tpostID IN (" . $this->postIDs . ")\n\t\t\t\t\tAND isDeleted = 1";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             if (!empty($threadIDs2)) {
                 $threadIDs2 .= ',';
             }
             $threadIDs2 .= $row['threadID'];
         }
         // get boards of deleted posts
         list($boards2, $boardIDs2) = ThreadEditor::getBoards($threadIDs2);
         // check permissions (delete completely)
         foreach ($boards2 as $board2) {
             $board2->checkModeratorPermission('canDeletePostCompletely');
         }
         // remove user stats
         ThreadEditor::updateUserStats($threadIDs, 'delete');
         PostEditor::updateUserStats(ThreadEditor::getAllPostIDs($threadIDs), 'delete');
         // delete posts
         PostEditor::deleteAll($this->postIDs, false, $this->reason);
         PostEditor::unmarkAll();
         // handle threads (check for empty, deleted and hidden threads)
         ThreadEditor::checkVisibilityAll($threadIDs);
         // refresh last post, replies, attachments, polls in threads
         ThreadEditor::refreshAll($threadIDs);
         // re-add user stats
         ThreadEditor::updateUserStats($threadIDs, 'enable');
         PostEditor::updateUserStats(ThreadEditor::getAllPostIDs($threadIDs), 'enable');
         // refresh counts
         BoardEditor::refreshAll($boardIDs);
         // refresh last post in boards
         foreach ($boards as $board) {
             $board->setLastPosts();
         }
         // reset cache
         ThreadAction::resetCache();
     }
     // check whether the enable exists and forward
     if ($this->thread != null && $this->thread->hasPosts()) {
         HeaderUtil::redirect($this->url);
     } else {
         if ($this->board != null) {
             HeaderUtil::redirect('index.php?page=Board&boardID=' . $this->board->boardID . SID_ARG_2ND_NOT_ENCODED);
         } else {
             HeaderUtil::redirect('index.php' . SID_ARG_1ST);
         }
     }
     exit;
 }