/** * @see Form::save() */ public function save() { if (!$this->canEditPost()) { throw new PermissionDeniedException(); } // set the language temporarily to the thread language if ($this->thread->languageID && $this->thread->languageID != WCF::getLanguage()->getLanguageID()) { $this->setLanguage($this->thread->languageID); } MessageForm::save(); // update subscription $this->thread->setSubscription($this->subscription); // save poll if ($this->showPoll) { $this->pollEditor->save(); } // add edit note $postData = array(); if (!$this->hideEditNote && (WCF::getUser()->userID != $this->post->userID || $this->post->time <= TIME_NOW - POST_EDIT_HIDE_EDIT_NOTE_PERIOD * 60)) { $postData['editor'] = WCF::getUser()->username; $postData['editorID'] = WCF::getUser()->userID; $postData['lastEditTime'] = TIME_NOW; $postData['editCount'] = $this->post->editCount + 1; $postData['editReason'] = $this->editReason; } else { if (!empty($this->editReason)) { $postData['editReason'] = $this->editReason; } } // update database entry $this->post->update($this->subject, $this->text, $this->getOptions(), $this->attachmentListEditor, $this->pollEditor, $postData); // reset language if ($this->userInterfaceLanguageID !== null) { $this->setLanguage($this->userInterfaceLanguageID, true); } $threadData = array(); if ($this->thread->firstPostID == $this->post->postID) { // update thread topic if (!empty($this->subject)) { $threadData['topic'] = $this->subject; } // update thread prefix if ($this->board->getPermission('canUsePrefix')) { $threadData['prefix'] = $this->prefix; } // save tags if (MODULE_TAGGING && THREAD_ENABLE_TAGS && $this->board->getPermission('canSetTags')) { $this->thread->updateTags(TaggingUtil::splitString($this->tags)); } // announcement if ($this->board->getModeratorPermission('canStartAnnouncement')) { if ($this->thread->isAnnouncement) { $this->thread->removeAssignedBoards(); } if ($this->isImportant == 2) { $this->thread->assignBoards($this->boardIDs); } $threadData['isAnnouncement'] = intval($this->isImportant == 2); } // pin thread if ($this->board->getModeratorPermission('canPinThread')) { $threadData['isSticky'] = intval($this->isImportant == 1); } // set language if ($this->languageID != $this->thread->languageID) { $threadData['languageID'] = $this->languageID; } } // close / open thread if ($this->board->getModeratorPermission('canCloseThread')) { if (!$this->thread->isClosed && $this->closeThread) { $threadData['isClosed'] = 1; } else { if ($this->thread->isClosed && !$this->closeThread) { $threadData['isClosed'] = 0; } } } // update thread $this->thread->update($threadData); // update last posts if ($this->thread->firstPostID == $this->post->postID && $this->languageID != $this->thread->languageID) { $this->board->setLastPosts(); WCF::getCache()->clearResource('boardData'); } $this->saved(); // forward to post $url = 'index.php?page=Thread&postID=' . $this->postID . SID_ARG_2ND_NOT_ENCODED . '#post' . $this->postID; HeaderUtil::redirect($url); exit; }