/**
  * Deletes the selected thread.
  */
 public function delete()
 {
     if ($this->thread == null) {
         throw new IllegalLinkException();
     }
     $this->board->checkModeratorPermission('canDeleteThreadCompletely');
     $this->thread->unmark();
     $this->thread->delete();
     if (!$this->thread->isDeleted || !THREAD_ENABLE_RECYCLE_BIN) {
         $this->removeThread();
     }
     if (strpos($this->url, 'page=Thread') !== false) {
         HeaderUtil::redirect('index.php?page=Board&boardID=' . $this->thread->boardID . SID_ARG_2ND_NOT_ENCODED);
     } else {
         HeaderUtil::redirect($this->url);
     }
     exit;
 }