/**
  * @see Action::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get post
     $this->post = new PostEditor($this->objectID);
     if (!$this->post->postID) {
         throw new IllegalLinkException();
     }
     // get thread
     $this->thread = new ThreadEditor($this->post->threadID);
     $this->thread->enter();
 }
 /**
  * @see Action::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['threadID'])) {
         $this->threadID = intval($_REQUEST['threadID']);
     }
     // get thread
     $this->thread = new ThreadEditor($this->threadID);
     // get board
     $this->board = Board::getBoard($this->thread->boardID);
     // enter thread
     $this->thread->enter($this->board);
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get post
     if (isset($_REQUEST['postID'])) {
         $this->postID = intval($_REQUEST['postID']);
     }
     $this->post = new Post($this->postID);
     if (!$this->post->postID) {
         throw new IllegalLinkException();
     }
     // get thread
     $this->thread = new Thread($this->post->threadID);
     $this->thread->enter();
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // count threads
     $sql = "SELECT\tCOUNT(*) AS count\n\t\t\tFROM\twbb" . WBB_N . "_thread";
     $row = WCF::getDB()->getFirstRow($sql);
     $count = $row['count'];
     // get thread ids
     $threadIDs = '';
     $sql = "SELECT\t\tthreadID, topic\n\t\t\tFROM\t\twbb" . WBB_N . "_thread\n\t\t\tORDER BY\tthreadID";
     $result = WCF::getDB()->sendQuery($sql, $this->limit, $this->limit * $this->loop);
     if (!WCF::getDB()->countRows($result)) {
         $this->calcProgress();
         $this->finish();
     }
     while ($row = WCF::getDB()->fetchArray($result)) {
         // delete old entries
         $sql = "DELETE FROM\twbb" . WBB_N . "_thread_similar\n\t\t\t\tWHERE\t\tthreadID = " . $row['threadID'];
         WCF::getDB()->sendQuery($sql);
         // update entries
         ThreadEditor::updateSimilarThreads($row['threadID'], $row['topic']);
     }
     $this->executed();
     $this->calcProgress($this->limit * $this->loop, $count);
     $this->nextLoop();
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['boardID'])) {
         $this->boardID = intval($_REQUEST['boardID']);
     }
     if (isset($_REQUEST['threadID'])) {
         $this->threadID = ArrayUtil::toIntegerArray($_REQUEST['threadID']);
     }
     if (isset($_REQUEST['reason'])) {
         $this->reason = StringUtil::trim($_REQUEST['reason']);
         if (CHARSET != 'UTF-8') {
             $this->reason = StringUtil::convertEncoding('UTF-8', CHARSET, $this->reason);
         }
     }
     if (isset($_REQUEST['topic'])) {
         $this->topic = StringUtil::trim($_REQUEST['topic']);
         if (CHARSET != 'UTF-8') {
             $this->topic = StringUtil::convertEncoding('UTF-8', CHARSET, $this->topic);
         }
     }
     if (isset($_REQUEST['prefix'])) {
         $this->prefix = $_REQUEST['prefix'];
         if (CHARSET != 'UTF-8') {
             $this->prefix = StringUtil::convertEncoding('UTF-8', CHARSET, $this->prefix);
         }
     }
     if (isset($_REQUEST['url'])) {
         $this->url = $_REQUEST['url'];
     }
     if (!is_array($this->threadID) && $this->threadID != 0) {
         $this->thread = new ThreadEditor($this->threadID);
         $this->boardID = $this->thread->boardID;
         if ($this->thread->movedThreadID) {
             $movedThread = new ThreadEditor($this->thread->movedThreadID);
             $movedThread->enter();
         } else {
             $this->thread->enter();
         }
     }
     if ($this->boardID != 0) {
         $this->board = new BoardEditor($this->boardID);
         if ($this->thread == null) {
             $this->board->enter();
         }
     }
 }
 /**
  * Marks a thread as undone.
  */
 public function markAsUndone()
 {
     // check permission
     $this->board->checkModeratorPermission('canMarkAsDoneThread');
     if ($this->thread == null) {
         throw new IllegalLinkException();
     }
     $this->thread->markAsUndone();
     exit;
 }
 /**
  * @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 Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['postID'])) {
         $this->postID = intval($_REQUEST['postID']);
     }
     $this->post = new PostEditor($this->postID);
     $this->thread = new ThreadEditor($this->post->threadID);
     $this->board = new BoardEditor($this->thread->boardID);
     $this->thread->enter($this->board);
     if (!WCF::getUser()->userID) {
         throw new PermissionDeniedException();
     }
     // check whether this post was already reported
     $sql = "SELECT \tpostID\n\t\t\tFROM\twbb" . WBB_N . "_post_report\n\t\t\tWHERE\tpostID = " . $this->postID;
     $row = WCF::getDB()->getFirstRow($sql);
     if (isset($row['postID'])) {
         throw new NamedUserException(WCF::getLanguage()->get('wbb.report.error.alreadyReported'));
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     if (!count($_POST)) {
         $this->closeThread = $this->thread->isClosed;
         $this->text = $this->post->message;
         $this->subject = $this->post->subject;
         $this->subscription = $this->thread->subscribed;
         $this->prefix = $this->thread->prefix;
         if ($this->thread->isSticky) {
             $this->isImportant = 1;
         }
         if ($this->thread->isAnnouncement) {
             $this->isImportant = 2;
         }
         $this->boardIDs = $this->thread->getAssignedBoards();
         $this->languageID = $this->thread->languageID;
         $this->editReason = $this->post->editReason;
         $this->enableSmilies = $this->post->enableSmilies;
         $this->enableHtml = $this->post->enableHtml;
         $this->enableBBCodes = $this->post->enableBBCodes;
         $this->showSignature = $this->post->showSignature;
         // tags
         if (THREAD_ENABLE_TAGS && $this->thread->firstPostID == $this->postID) {
             $this->tags = TaggingUtil::buildString($this->thread->getTags(array($this->languageID)));
         }
     }
     // get post list
     if ($this->thread->firstPostID != $this->postID) {
         try {
             require_once WBB_DIR . 'lib/data/post/PostEditPostList.class.php';
             $this->postList = new PostEditPostList($this->post, $this->thread, $this->board);
             $this->attachments = $this->postList->attachments;
             if (count($this->attachments) > 0) {
                 require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
                 MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
             }
         } catch (SystemException $e) {
         }
     }
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if ($eventObj->action == 'enable') {
         if ($eventObj->thread->userID && $eventObj->board->countUserPosts && $eventObj->board->getModeratorPermission('canEnableThread') && !$eventObj->thread->everEnabled) {
             WBBUser::updateUserPosts($eventObj->thread->userID, -1);
             if (ACTIVITY_POINTS_PER_THREAD) {
                 UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_THREAD * -1, $eventObj->thread->userID);
             }
             $postIDs = explode(',', ThreadEditor::getAllPostIDs((string) $eventObj->thread->threadID));
             foreach ($postIDs as $postID) {
                 $post = new Post($postID);
                 if ($post->postID != $eventObj->thread->firstPostID && !$post->everEnabled) {
                     WBBUser::updateUserPosts($post->userID, -1);
                     if (ACTIVITY_POINTS_PER_POST) {
                         UserRank::updateActivityPoints(ACTIVITY_POINTS_PER_POST * -1, $post->userID);
                     }
                 }
             }
         }
     }
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permissions
     $boardIDs = Board::getModeratedBoards('canDeleteThreadCompletely');
     if (empty($boardIDs)) {
         throw new PermissionDeniedException();
     }
     // delete threads
     $threadIDArray = array();
     $sql = "SELECT\tthreadID\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tisDeleted = 1\n\t\t\t\tAND boardID IN (" . $boardIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $threadIDArray[] = $row['threadID'];
     }
     if (count($threadIDArray)) {
         ThreadEditor::deleteAllCompletely(implode(',', $threadIDArray));
     }
     $this->executed();
     // forward
     HeaderUtil::redirect('index.php?page=ModerationDeletedThreads' . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
 /**
  * @see Cronjob::execute()
  */
 public function execute($data)
 {
     if (THREAD_ENABLE_RECYCLE_BIN && THREAD_EMPTY_RECYCLE_BIN_CYCLE > 0) {
         // delete threads first
         $sql = "SELECT\tthreadID\n\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\tWHERE\tisDeleted = 1\n\t\t\t\t\tAND deleteTime < " . (TIME_NOW - THREAD_EMPTY_RECYCLE_BIN_CYCLE * 86400);
         $result = WCF::getDB()->sendQuery($sql);
         if (WCF::getDB()->countRows($result) > 0) {
             require_once WBB_DIR . 'lib/data/thread/ThreadEditor.class.php';
             $threadIDs = '';
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($threadIDs)) {
                     $threadIDs .= ',';
                 }
                 $threadIDs .= $row['threadID'];
             }
             ThreadEditor::deleteAllCompletely($threadIDs);
         }
         // delete posts
         $sql = "SELECT\tpostID\n\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\tWHERE\tisDeleted = 1\n\t\t\t\t\tAND deleteTime < " . (TIME_NOW - THREAD_EMPTY_RECYCLE_BIN_CYCLE * 86400);
         $result = WCF::getDB()->sendQuery($sql);
         if (WCF::getDB()->countRows($result) > 0) {
             require_once WBB_DIR . 'lib/data/post/PostEditor.class.php';
             $postIDs = '';
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($postIDs)) {
                     $postIDs .= ',';
                 }
                 $postIDs .= $row['postID'];
             }
             PostEditor::deleteAllCompletely($postIDs);
         }
     }
     if (THREAD_DELETE_LINK_CYCLE > 0) {
         $sql = "DELETE FROM\twbb" . WBB_N . "_thread\n\t\t\t\tWHERE\t\tmovedTime > 0\n\t\t\t\t\t\tAND movedTime < " . (TIME_NOW - THREAD_DELETE_LINK_CYCLE * 86400);
         WCF::getDB()->sendQuery($sql);
     }
 }
 /**
  * @see Page::readData()
  */
 public function readData()
 {
     parent::readData();
     // get post list
     $this->postList = new PostAddPostList($this->thread, $this->board);
     // old thread warning
     if (REPLY_OLD_THREAD_WARNING && $this->thread->lastPostTime > 0) {
         $this->oldThreadWarning = intval(floor((TIME_NOW - $this->thread->lastPostTime) / 86400));
         if ($this->oldThreadWarning < REPLY_OLD_THREAD_WARNING) {
             $this->oldThreadWarning = 0;
         }
     }
     $this->attachments = $this->postList->attachments;
     if (count($this->attachments) > 0) {
         require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
         MessageAttachmentList::removeEmbeddedAttachments($this->attachments);
     }
     // default values
     if (!count($_POST)) {
         $this->closeThread = $this->thread->isClosed;
         $this->subscription = $this->thread->subscribed;
         if (!$this->subscription && WCF::getUser()->enableSubscription) {
             $this->subscription = 1;
         }
         // single quote
         if ($this->action == 'quote') {
             $post = $this->thread->getPost();
             if ($post) {
                 $this->text = "[quote='" . StringUtil::replace("'", "\\'", $post->username) . "',index.php?page=Thread&postID=" . $post->postID . "#post" . $post->postID . "]" . $post->message . "[/quote]";
                 if ($post->subject) {
                     $this->subject = WCF::getLanguage()->get('wbb.postAdd.quote.subject', array('$subject' => $post->subject));
                 }
             }
         }
     }
 }
 /**
  * Enables the threads with the given thread ids.
  */
 public static function enableAll($threadIDs, $enablePosts = true)
 {
     if (empty($threadIDs)) {
         return;
     }
     // send notifications
     $statThreadIDs = '';
     $sql = "SELECT\t*\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")\n\t\t\t\tAND isDisabled = 1\n\t\t\t\tAND everEnabled = 0";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!empty($statThreadIDs)) {
             $statThreadIDs .= ',';
         }
         $statThreadIDs .= $row['threadID'];
         // send notifications
         $thread = new ThreadEditor(null, $row);
         $thread->sendNotification();
     }
     // update user posts & activity points
     self::updateUserStats($statThreadIDs, 'enable');
     // enable thread
     $sql = "UPDATE \twbb" . WBB_N . "_thread\n\t\t\tSET\tisDisabled = 0,\n\t\t\t\teverEnabled = 1\n\t\t\tWHERE \tthreadID IN (" . $threadIDs . ")";
     WCF::getDB()->registerShutdownUpdate($sql);
     // enable post
     if ($enablePosts) {
         PostEditor::enableAll(self::getAllPostIDs($threadIDs));
     }
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     // build conditions
     $this->conditions = new ConditionBuilder();
     parent::save();
     // time
     if ($this->timeAfterDay && $this->timeAfterMonth && $this->timeAfterYear) {
         $time = @gmmktime(0, 0, 0, $this->timeAfterMonth, $this->timeAfterDay, $this->timeAfterYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("time > " . $time);
         }
     }
     if ($this->timeBeforeDay && $this->timeBeforeMonth && $this->timeBeforeYear) {
         $time = @gmmktime(0, 0, 0, $this->timeBeforeMonth, $this->timeBeforeDay, $this->timeBeforeYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("time < " . $time);
         }
     }
     // last post time
     if ($this->lastPostTimeAfterDay && $this->lastPostTimeAfterMonth && $this->lastPostTimeAfterYear) {
         $time = @gmmktime(0, 0, 0, $this->lastPostTimeAfterMonth, $this->lastPostTimeAfterDay, $this->lastPostTimeAfterYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("lastPostTime > " . $time);
         }
     }
     if ($this->lastPostTimeBeforeDay && $this->lastPostTimeBeforeMonth && $this->lastPostTimeBeforeYear) {
         $time = @gmmktime(0, 0, 0, $this->lastPostTimeBeforeMonth, $this->lastPostTimeBeforeDay, $this->lastPostTimeBeforeYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("lastPostTime < " . $time);
         }
     }
     // replies
     if ($this->repliesMoreThan !== '') {
         $this->conditions->add('replies > ' . $this->repliesMoreThan);
     }
     if ($this->repliesLessThan !== '') {
         $this->conditions->add('replies < ' . $this->repliesLessThan);
     }
     // username
     if ($this->createdBy != '') {
         $users = preg_split('/\\s*,\\s*/', $this->createdBy, -1, PREG_SPLIT_NO_EMPTY);
         $users = array_map('escapeString', $users);
         $this->conditions->add("username IN ('" . implode("','", $users) . "')");
     }
     if ($this->postsBy != '') {
         $users = preg_split('/\\s*,\\s*/', $this->postsBy, -1, PREG_SPLIT_NO_EMPTY);
         $users = array_map('escapeString', $users);
         $this->conditions->add("threadID IN (SELECT DISTINCT threadID FROM wbb" . WBB_N . "_post WHERE username IN ('" . implode("','", $users) . "'))");
     }
     // prefix
     if ($this->prefix != '') {
         $this->conditions->add("prefix = '" . escapeString($this->prefix) . "'");
     }
     // boardIDs
     if (count($this->boardIDs)) {
         $this->conditions->add("boardID IN (" . implode(',', $this->boardIDs) . ")");
     }
     // language ids
     if (count($this->languageIDs)) {
         $this->conditions->add("languageID IN (" . implode(',', $this->languageIDs) . ")");
     }
     if ($this->deleted) {
         $this->conditions->add("isDeleted = 1");
     }
     if ($this->notDeleted) {
         $this->conditions->add("isDeleted = 0");
     }
     if ($this->disabled) {
         $this->conditions->add("isDisabled = 1");
     }
     if ($this->notDisabled) {
         $this->conditions->add("isDisabled = 0");
     }
     if ($this->closed) {
         $this->conditions->add("isClosed = 1");
     }
     if ($this->open) {
         $this->conditions->add("isClosed = 0");
     }
     if ($this->redirect) {
         $this->conditions->add("movedThreadID <> 0");
     }
     if ($this->notRedirect) {
         $this->conditions->add("movedThreadID = 0");
     }
     if ($this->announcement) {
         $this->conditions->add("isAnnouncement = 1");
     }
     if ($this->sticky) {
         $this->conditions->add("isSticky = 1");
     }
     if ($this->normal) {
         $this->conditions->add("isAnnouncement = 0 AND isSticky = 0");
     }
     // execute action
     $conditions = $this->conditions->get();
     switch ($this->action) {
         case 'move':
             $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\tSET\tboardID = " . $this->moveTo . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'delete':
             $threadIDs = '';
             $sql = "SELECT\tthreadID\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t" . $conditions;
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($threadIDs)) {
                     $threadIDs .= ',';
                 }
                 $threadIDs .= $row['threadID'];
                 $this->affectedThreads++;
             }
             require_once WBB_DIR . 'lib/data/thread/ThreadEditor.class.php';
             ThreadEditor::deleteAllCompletely($threadIDs);
             break;
         case 'trash':
         case 'restore':
             $threadIDs = '';
             $sql = "SELECT\tthreadID\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t" . $conditions;
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($threadIDs)) {
                     $threadIDs .= ',';
                 }
                 $threadIDs .= $row['threadID'];
             }
             if (!empty($threadIDs)) {
                 // trash/restore posts
                 $sql = "UPDATE\twbb" . WBB_N . "_post\n\t\t\t\t\t\tSET\tisDeleted = " . ($this->action == 'trash' ? 1 : 0) . "\n\t\t\t\t\t\t\t" . ($this->action == 'trash' ? ",deleteTime = " . TIME_NOW . ", deletedBy = '" . escapeString(WCF::getUser()->username) . "', deletedByID = " . WCF::getUser()->userID : '') . "\n\t\t\t\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")";
                 WCF::getDB()->sendQuery($sql);
                 // trash/restore threads
                 $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\t\tSET\tisDeleted = " . ($this->action == 'trash' ? 1 : 0) . "\n\t\t\t\t\t\t\t" . ($this->action == 'trash' ? ",deleteTime = " . TIME_NOW . ", deletedBy = '" . escapeString(WCF::getUser()->username) . "', deletedByID = " . WCF::getUser()->userID : '') . "\n\t\t\t\t\t\tWHERE\tthreadID IN (" . $threadIDs . ")";
                 WCF::getDB()->sendQuery($sql);
                 $this->affectedThreads = WCF::getDB()->getAffectedRows();
             }
             break;
         case 'disable':
         case 'enable':
             $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\tSET\tisDisabled = " . ($this->action == 'disable' ? 1 : 0) . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'close':
         case 'open':
             $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\tSET\tisClosed = " . ($this->action == 'close' ? 1 : 0) . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'deleteSubscriptions':
             $sql = "DELETE FROM\twbb" . WBB_N . "_thread_subscription\n\t\t\t\t\tWHERE\t\tthreadID IN (\n\t\t\t\t\t\t\t\tSELECT\tthreadID\n\t\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t\t\t\t" . $conditions . "\t\n\t\t\t\t\t\t\t)";
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'changeLanguage':
             $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\tSET\tlanguageID = " . $this->newLanguageID . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'changePrefix':
             $sql = "UPDATE\twbb" . WBB_N . "_thread\n\t\t\t\t\tSET\tprefix = '" . escapeString($this->newPrefix) . "'\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedThreads = WCF::getDB()->getAffectedRows();
             break;
         case 'deleteLinks':
             $threadIDs = '';
             $sql = "SELECT\tthreadID\n\t\t\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t" . $conditions;
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($threadIDs)) {
                     $threadIDs .= ',';
                 }
                 $threadIDs .= $row['threadID'];
                 $this->affectedThreads++;
             }
             if (!empty($threadIDs)) {
                 $sql = "DELETE FROM\twbb" . WBB_N . "_thread\n\t\t\t\t\t\tWHERE\t\tmovedThreadID IN (" . $threadIDs . ")";
                 WCF::getDB()->sendQuery($sql);
                 $this->affectedThreads = WCF::getDB()->getAffectedRows();
             }
             break;
     }
     $this->saved();
     WCF::getTPL()->assign('affectedThreads', $this->affectedThreads);
 }
 /**
  * Copies all SQL data of the posts with the given posts ids. 
  */
 public static function copyAll($postIDs, $threadID, $threadMapping = null, $boardID = 0, $updateUserStats = true)
 {
     if (empty($postIDs)) {
         return;
     }
     // copy 'post' data
     $postMapping = array();
     $sql = "SELECT\t*\n\t\t\tFROM \twbb" . WBB_N . "_post\n\t\t\tWHERE \tpostID IN (" . $postIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $post = new PostEditor(null, $row);
         $postMapping[$post->postID] = $post->copy($threadID ? $threadID : $threadMapping[$row['threadID']]);
     }
     // refresh first post ids
     require_once WBB_DIR . 'lib/data/thread/ThreadEditor.class.php';
     ThreadEditor::refreshFirstPostIDAll($threadID ? $threadID : implode(',', $threadMapping));
     // update user posts and activity points
     if ($updateUserStats) {
         self::updateUserStats(implode(',', $postMapping), 'copy', $boardID);
     }
     // copy 'post_cache' data
     $sql = "SELECT\t*\n\t\t\tFROM \twbb" . WBB_N . "_post_cache\n\t\t\tWHERE \tpostID IN (" . $postIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $sql = "INSERT INTO \twbb" . WBB_N . "_post_cache\n\t\t\t\t\t\t(postID, threadID, messageCache)\n\t\t\t\tVALUES\t\t(" . $postMapping[$row['postID']] . ",\n\t\t\t\t\t\t" . ($threadID ? $threadID : $threadMapping[$row['threadID']]) . ",\n\t\t\t\t\t\t'" . escapeString($row['messageCache']) . "')";
         WCF::getDB()->sendQuery($sql);
     }
     // copy 'post_report' data
     $sql = "SELECT \t*\n\t\t\tFROM \twbb" . WBB_N . "_post_report\n\t\t\tWHERE \tpostID IN (" . $postIDs . ")";
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $sql = "INSERT INTO \twbb" . WBB_N . "_post_report\n\t\t\t\t\t\t(postID, userID, report, reportTime)\n\t\t\t\tVALUES\t\t(" . $postMapping[$row['postID']] . ",\n\t\t\t\t\t\t" . $row['userID'] . ",\n\t\t\t\t\t\t'" . escapeString($row['report']) . "',\n\t\t\t\t\t\t" . $row['reportTime'] . ")";
         WCF::getDB()->sendQuery($sql);
     }
     // copy polls
     require_once WCF_DIR . 'lib/data/message/poll/PollEditor.class.php';
     $pollMapping = PollEditor::copyAll($postIDs, $postMapping);
     if (is_array($pollMapping)) {
         foreach ($pollMapping as $oldPollID => $newPollID) {
             $sql = "UPDATE\t\twbb" . WBB_N . "_post\n\t\t\t\t\tSET \t\tpollID = " . $newPollID . "\n\t\t\t\t\tWHERE \t\tpollID = " . $oldPollID . "\n\t\t\t\t\t\t\tAND postID NOT IN (SELECT messageID FROM wcf" . WCF_N . "_poll WHERE pollID = " . $oldPollID . ")";
             WCF::getDB()->sendQuery($sql);
         }
     }
     // copy attachments
     require_once WCF_DIR . 'lib/data/message/attachment/AttachmentsEditor.class.php';
     $attachment = new AttachmentsEditor($postIDs);
     $attachmentMapping = $attachment->copyAll($postMapping);
     // update inline attachments
     if (count($attachmentMapping) > 0) {
         $sql = "SELECT\tpostID, message\n\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\tWHERE\tpostID IN (" . implode(',', array_keys($attachmentMapping)) . ")\n\t\t\t\t\tAND message LIKE '%[attach%'";
         $result = WCF::getDB()->sendQuery($sql);
         while ($row = WCF::getDB()->fetchArray($result)) {
             $messageChanged = false;
             foreach ($attachmentMapping[$row['postID']] as $oldAttachmentID => $newAttachmentID) {
                 $row['message'] = StringUtil::replaceIgnoreCase('[attach=' . $oldAttachmentID . ']', '[attach=' . $newAttachmentID . ']', $row['message']);
                 $row['message'] = StringUtil::replaceIgnoreCase('[attach]' . $oldAttachmentID . '[/attach]', '[attach]' . $newAttachmentID . '[/attach]', $row['message']);
                 $messageChanged = true;
             }
             if ($messageChanged) {
                 // update message
                 $sql = "UPDATE\twbb" . WBB_N . "_post\n\t\t\t\t\t\tSET\tmessage = '" . escapeString($row['message']) . "'\n\t\t\t\t\t\tWHERE\tpostID = " . $row['postID'];
                 WCF::getDB()->sendQuery($sql);
                 // delete post cache
                 $sql = "DELETE FROM\twbb" . WBB_N . "_post_cache\n\t\t\t\t\t\tWHERE\t\tpostID = " . $row['postID'];
                 WCF::getDB()->sendQuery($sql);
             }
         }
     }
 }
 /**
  * Deletes this board.
  */
 public function delete()
 {
     // empty board
     // get alle thread ids
     $threadIDs = '';
     $sql = "SELECT\tthreadID\n\t\t\tFROM\twbb" . WBB_N . "_thread\n\t\t\tWHERE\tboardID = " . $this->boardID;
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         if (!empty($threadIDs)) {
             $threadIDs .= ',';
         }
         $threadIDs .= $row['threadID'];
     }
     if (!empty($threadIDs)) {
         // delete threads
         require_once WBB_DIR . 'lib/data/thread/ThreadEditor.class.php';
         ThreadEditor::deleteAllCompletely($threadIDs);
     }
     $this->removePositions();
     // update sub boards
     $sql = "UPDATE\twbb" . WBB_N . "_board\n\t\t\tSET\tparentID = " . $this->parentID . "\n\t\t\tWHERE\tparentID = " . $this->boardID;
     WCF::getDB()->sendQuery($sql);
     $sql = "UPDATE\twbb" . WBB_N . "_board_structure\n\t\t\tSET\tparentID = " . $this->parentID . "\n\t\t\tWHERE\tparentID = " . $this->boardID;
     WCF::getDB()->sendQuery($sql);
     // delete board
     self::deleteData($this->boardID);
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     // build conditions
     $this->conditions = new ConditionBuilder();
     parent::save();
     // boardIDs
     if (count($this->boardIDs)) {
         $this->conditions->add("threadID IN (SELECT threadID FROM wbb" . WBB_N . "_thread WHERE boardID IN (" . implode(',', $this->boardIDs) . "))");
     }
     // time
     if ($this->timeAfterDay && $this->timeAfterMonth && $this->timeAfterYear) {
         $time = @gmmktime(0, 0, 0, $this->timeAfterMonth, $this->timeAfterDay, $this->timeAfterYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("time > " . $time);
         }
     }
     if ($this->timeBeforeDay && $this->timeBeforeMonth && $this->timeBeforeYear) {
         $time = @gmmktime(0, 0, 0, $this->timeBeforeMonth, $this->timeBeforeDay, $this->timeBeforeYear);
         if ($time !== false && $time !== -1) {
             $this->conditions->add("time < " . $time);
         }
     }
     // username
     if ($this->createdBy != '') {
         $users = preg_split('/\\s*,\\s*/', $this->createdBy, -1, PREG_SPLIT_NO_EMPTY);
         $users = array_map('escapeString', $users);
         $this->conditions->add("username IN ('" . implode("','", $users) . "')");
     }
     // status
     if ($this->deleted) {
         $this->conditions->add("isDeleted = 1");
     }
     if ($this->notDeleted) {
         $this->conditions->add("isDeleted = 0");
     }
     if ($this->disabled) {
         $this->conditions->add("isDisabled = 1");
     }
     if ($this->notDisabled) {
         $this->conditions->add("isDisabled = 0");
     }
     if ($this->closed) {
         $this->conditions->add("isClosed = 1");
     }
     if ($this->open) {
         $this->conditions->add("isClosed = 0");
     }
     // execute action
     $conditions = $this->conditions->get();
     switch ($this->action) {
         case 'delete':
             $postIDs = '';
             $sql = "SELECT\tpostID\n\t\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\t\t" . $conditions;
             $result = WCF::getDB()->sendQuery($sql);
             while ($row = WCF::getDB()->fetchArray($result)) {
                 if (!empty($postIDs)) {
                     $postIDs .= ',';
                 }
                 $postIDs .= $row['postID'];
                 $this->affectedPosts++;
             }
             // get thread ids
             $threadIDs = PostEditor::getThreadIDs($postIDs);
             // delete posts
             PostEditor::deleteAllCompletely($postIDs);
             // check threads
             ThreadEditor::checkVisibilityAll($threadIDs);
             break;
         case 'trash':
         case 'restore':
             $sql = "UPDATE\twbb" . WBB_N . "_post\n\t\t\t\t\tSET\tisDeleted = " . ($this->action == 'trash' ? 1 : 0) . "\n\t\t\t\t\t\t" . ($this->action == 'trash' ? ",deleteTime = " . TIME_NOW . ", deletedBy = '" . escapeString(WCF::getUser()->username) . "', deletedByID = " . WCF::getUser()->userID : '') . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedPosts = WCF::getDB()->getAffectedRows();
             break;
         case 'disable':
         case 'enable':
             $sql = "UPDATE\twbb" . WBB_N . "_post\n\t\t\t\t\tSET\tisDisabled = " . ($this->action == 'disable' ? 1 : 0) . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedPosts = WCF::getDB()->getAffectedRows();
             break;
         case 'close':
         case 'open':
             $sql = "UPDATE\twbb" . WBB_N . "_post\n\t\t\t\t\tSET\tisClosed = " . ($this->action == 'close' ? 1 : 0) . "\n\t\t\t\t\t" . $conditions;
             WCF::getDB()->sendQuery($sql);
             $this->affectedPosts = WCF::getDB()->getAffectedRows();
             break;
     }
     $this->saved();
     WCF::getTPL()->assign('affectedPosts', $this->affectedPosts);
 }
 /**
  * Merges posts.
  */
 public function merge()
 {
     if ($this->post === null || empty($this->postIDs)) {
         throw new IllegalLinkException();
     }
     // remove target post from source
     $postIDArray = explode(',', $this->postIDs);
     if (($key = array_search($this->post->postID, $postIDArray)) !== false) {
         unset($postIDArray[$key]);
         $this->postIDs = implode(',', $postIDArray);
     }
     // get thread ids
     $threadIDs = PostEditor::getThreadIDs($this->postIDs);
     // get boards
     list($boards, $boardIDs) = ThreadEditor::getBoards($threadIDs);
     // check permissions
     $this->board->checkModeratorPermission('canMergePost');
     foreach ($boards as $board) {
         $board->checkModeratorPermission('canMergePost');
     }
     // remove user stats
     ThreadEditor::updateUserStats($threadIDs, 'delete');
     PostEditor::updateUserStats(ThreadEditor::getAllPostIDs($threadIDs), 'delete');
     // merge posts
     PostEditor::mergeAll($this->postIDs, $this->post->postID);
     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
     $this->board->setLastPosts();
     foreach ($boards as $board) {
         $board->setLastPosts();
     }
     HeaderUtil::redirect($this->url);
     exit;
 }
 /**
  * @see EventListener::execute()
  */
 public function execute($eventObj, $className, $eventName)
 {
     if (MODULE_USER_NOTIFICATION) {
         if ($className === 'PostActionPage') {
             $markedPostIDs = WCF::getSession()->getVar('markedPosts');
             if ($eventObj->post !== null && $eventObj->post->userID != WCF::getUser()->userID) {
                 if ($eventObj->action === 'trash') {
                     if (!THREAD_ENABLE_RECYCLE_BIN || !$eventObj->board->getModeratorPermission('canDeletePost') || $eventObj->post->isDeleted) {
                         return;
                     }
                     NotificationHandler::fireEvent('trashed', 'postDelete', $eventObj->post->postID, $eventObj->post->userID, array('trashedByUserID' => WCF::getUser()->userID, 'trashedByUsername' => WCF::getUser()->username, 'trashReason' => $eventObj->reason, 'threadID' => $eventObj->thread->threadID, 'threadTopic' => $eventObj->thread->topic));
                     return true;
                 } else {
                     if ($eventObj->action === 'delete') {
                         if (!$eventObj->board->getModeratorPermission('canDeletePostCompletely')) {
                             return;
                         }
                         NotificationHandler::revokeEvent(array('trashed'), 'postDelete', $eventObj->post->postID);
                         NotificationHandler::fireEvent('deleted', 'postDelete', $eventObj->post->postID, $eventObj->post->userID, array('deletedByUserID' => WCF::getUser()->userID, 'deletedByUsername' => WCF::getUser()->username, 'threadID' => $eventObj->thread->threadID, 'threadTopic' => $eventObj->thread->topic));
                         return true;
                     } else {
                         if ($eventObj->action === 'recover') {
                             if (!$eventObj->board->getModeratorPermission('canDeletePostCompletely') || !$eventObj->post->isDeleted) {
                                 return;
                             }
                             NotificationHandler::revokeEvent(array('trashed'), 'postDelete', $eventObj->post);
                             return true;
                         }
                     }
                 }
             }
             if ($markedPostIDs !== null && count($markedPostIDs)) {
                 if ($eventObj->action === 'deleteAll') {
                     $trashPosts = array();
                     $trashPostsThreadIDs = array();
                     $deletePosts = array();
                     $deletePostsThreadIDs = array();
                     $sql = "SELECT\t\tpost.*, thread.threadID, thread.topic\n\t\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\t\tON\t\t(post.threadID = thread.threadID)\n\t\t\t\t\t\t\tWHERE\t\tpost.postID IN (" . implode(',', $markedPostIDs) . ")";
                     $result = WCF::getDB()->sendQuery($sql);
                     while ($row = WCF::getDB()->fetchArray($result)) {
                         if ($row['userID'] != WCF::getUser()->userID) {
                             if ($row['isDeleted'] || !THREAD_ENABLE_RECYCLE_BIN) {
                                 $deletePosts[$row['postID']] = new PostDeleteNotificationObject(null, $row);
                                 $deletePostsThreadIDs[] = $row['threadID'];
                             } else {
                                 $trashPosts[$row['postID']] = new PostDeleteNotificationObject(null, $row);
                                 $trashPostsThreadIDs[] = $row['threadID'];
                             }
                         }
                     }
                     list($trashPostsBoards, $trashPostsBoardIDs) = ThreadEditor::getBoards(implode(',', $trashPostsThreadIDs));
                     list($deletePostsBoards, $deletePostsBoardIDs) = ThreadEditor::getBoards(implode(',', $deletePostsThreadIDs));
                     foreach ($trashPostsBoards as $trashPostsBoard) {
                         $trashPostsBoard->checkModeratorPermission('canDeletePost');
                     }
                     foreach ($deletePostsBoards as $deletePostsBoard) {
                         $deletePostsBoard->checkModeratorPermission('canDeletePostCompletely');
                     }
                     unset($trashPostsThreadIDs, $deletePostsThreadIDs, $trashPostsBoards, $deletePostsBoards, $trashPostsBoardIDs, $deletePostsBoardIDs);
                     foreach ($trashPosts as $trashPost) {
                         NotificationHandler::fireEvent('trashed', 'postDelete', $trashPost, $trashPost->userID, array('trashedByUserID' => WCF::getUser()->userID, 'trashedByUsername' => WCF::getUser()->username, 'trashReason' => $eventObj->reason, 'threadID' => $trashPost->threadID, 'threadTopic' => $trashPost->topic));
                     }
                     foreach ($deletePosts as $deletePost) {
                         NotificationHandler::revokeEvent(array('trashed'), 'postDelete', $deletePost);
                         NotificationHandler::fireEvent('deleted', 'postDelete', $deletePost, $deletePost->userID, array('deletedByUserID' => WCF::getUser()->userID, 'deletedByUsername' => WCF::getUser()->username, 'threadID' => $deletePost->threadID, 'threadTopic' => $deletePost->topic));
                     }
                     return true;
                 } else {
                     if ($eventObj->action === 'recoverAll') {
                         $threadIDs = PostEditor::getThreadIDs(implode(',', $markedPostIDs));
                         $notificationObjectObjects = NotificationHandler::getNotificationObjectTypeObject('postDelete')->getObjects($markedPostIDs);
                         list($boards, $boardIDs) = ThreadEditor::getBoards($threadIDs);
                         foreach ($boards as $board) {
                             $board->checkModeratorPermission('canDeletePostCompletely');
                         }
                         unset($threadIDs, $boards, $boardIDs);
                         foreach ($notificationObjectObjects as $notificationObjectObject) {
                             NotificationHandler::revokeEvent(array('trashed'), 'postDelete', $notificationObjectObject);
                         }
                         return true;
                     }
                 }
             }
         } else {
             if ($className === 'ThreadPage') {
                 $posts = $eventObj->postList->posts;
                 $postIDs = array();
                 $user = new NotificationUser(null, WCF::getUser(), false);
                 $packageID = NotificationHandler::getNotificationObjectTypeObject('postDelete')->getPackageID();
                 foreach ($posts as $post) {
                     if ($post->isDeleted && $post->userID == $user->userID) {
                         $postIDs[] = $post->postID;
                     }
                 }
                 unset($posts);
                 if (isset($user->notificationFlags[$packageID]) && $user->notificationFlags[$packageID] > 0) {
                     $count = NotificationEditor::markConfirmedByObjectVisit($user->userID, array('trashed'), 'postDelete', $postIDs);
                     $user->removeOutstandingNotification($packageID, $count);
                 }
             } else {
                 if ($className === 'PostEditForm' && $eventObj->post->userID != WCF::getUser()->userID && isset($_POST['deletePost']) && isset($_POST['sure'])) {
                     if ((!THREAD_ENABLE_RECYCLE_BIN || THREAD_ENABLE_RECYCLE_BIN && $eventObj->post->isDeleted) && $eventObj->board->getModeratorPermission('canDeletePostCompletely')) {
                         NotificationHandler::revokeEvent(array('trashed'), 'postDelete', $eventObj->post->postID);
                         NotificationHandler::fireEvent('deleted', 'postDelete', $eventObj->post->postID, $eventObj->post->userID, array('deletedByUserID' => WCF::getUser()->userID, 'deletedByUsername' => WCF::getUser()->username, 'threadID' => $eventObj->thread->threadID, 'threadTopic' => $eventObj->thread->topic));
                     } else {
                         if (!$eventObj->post->isDeleted && THREAD_ENABLE_RECYCLE_BIN && $eventObj->board->getModeratorPermission('canDeletePost')) {
                             NotificationHandler::fireEvent('trashed', 'postDelete', $eventObj->post->postID, $eventObj->post->userID, array('trashedByUserID' => WCF::getUser()->userID, 'trashedByUsername' => WCF::getUser()->username, 'trashReason' => $eventObj->deleteReason, 'threadID' => $eventObj->thread->threadID, 'threadTopic' => $eventObj->thread->topic));
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     // set the language temporarily to the thread language
     if ($this->languageID && $this->languageID != WCF::getLanguage()->getLanguageID()) {
         $this->setLanguage($this->languageID);
     }
     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, $this->languageID, $this->prefix, $this->subject, $this->text, WCF::getUser()->userID, $this->username, intval($this->isImportant == 1), intval($this->isImportant == 2), $this->closeThread, $this->getOptions(), $this->subscription, $this->attachmentListEditor, $this->pollEditor, intval($this->disableThread || !$this->board->getPermission('canStartThreadWithoutModeration')));
     if ($this->isImportant == 2) {
         $this->newThread->assignBoards($this->boardIDs);
     }
     // save tags
     if (MODULE_TAGGING && THREAD_ENABLE_TAGS && $this->board->getPermission('canSetTags')) {
         $tagArray = TaggingUtil::splitString($this->tags);
         if (count($tagArray)) {
             $this->newThread->updateTags($tagArray);
         }
     }
     // reset language
     if ($this->userInterfaceLanguageID !== null) {
         $this->setLanguage($this->userInterfaceLanguageID, true);
     }
     if (!$this->disableThread && $this->board->getPermission('canStartThreadWithoutModeration')) {
         // 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->newThread->sendNotification(new Post(null, array('postID' => $this->newThread->firstPostID, 'message' => $this->text, 'enableSmilies' => $this->enableSmilies, 'enableHtml' => $this->enableHtml, 'enableBBCodes' => $this->enableBBCodes)), $this->attachmentListEditor);
         $this->saved();
         // forward to post
         HeaderUtil::redirect('index.php?page=Thread&threadID=' . $this->newThread->threadID . SID_ARG_2ND_NOT_ENCODED);
     } else {
         $this->saved();
         if ($this->disableThread) {
             // forward to post
             HeaderUtil::redirect('index.php?page=Thread&threadID=' . $this->newThread->threadID . SID_ARG_2ND_NOT_ENCODED);
         } else {
             WCF::getTPL()->assign(array('url' => 'index.php?page=Board&boardID=' . $this->boardID . SID_ARG_2ND_NOT_ENCODED, 'message' => WCF::getLanguage()->get('wbb.threadAdd.moderation.redirect'), 'wait' => 5));
             WCF::getTPL()->display('redirect');
         }
     }
     exit;
 }