/**
  * @see	\wcf\form\IPage::readParameters()
  */
 public function readParameters()
 {
     MessageForm::readParameters();
     if (isset($_REQUEST['id'])) {
         $this->messageID = intval($_REQUEST['id']);
     }
     $this->message = new ConversationMessage($this->messageID);
     if (!$this->message->messageID) {
         throw new IllegalLinkException();
     }
     if (!$this->message->canEdit()) {
         throw new PermissionDeniedException();
     }
     // get conversation
     $this->conversationID = $this->message->conversationID;
     $this->conversation = $this->message->getConversation();
     if ($this->conversation->firstMessageID == $this->message->messageID) {
         $this->isFirstMessage = true;
     }
     // set attachment object id
     $this->attachmentObjectID = $this->message->messageID;
 }
 /**
  * @see	\wcf\data\IMessageInlineEditorAction::save()
  */
 public function save()
 {
     $data = array('message' => PreParser::getInstance()->parse(MessageUtil::stripCrap($this->parameters['data']['message']), explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes'))));
     if (!$this->message->getConversation()->isDraft) {
         $data['lastEditTime'] = TIME_NOW;
         $data['editCount'] = $this->message->editCount + 1;
     }
     // execute update action
     $action = new ConversationMessageAction(array($this->message), 'update', array('data' => $data));
     $action->executeAction();
     // load new message
     $this->message = new ConversationMessage($this->message->messageID);
     $this->message->getAttachments();
     if (MODULE_ATTACHMENT) {
         $attachmentList = $this->message->getAttachments(true);
         $count = 0;
         if ($attachmentList !== null) {
             // set permisions
             $attachmentList->setPermissions(array('canDownload' => true, 'canViewPreview' => true));
             $count = count($attachmentList);
         }
         // update count to reflect number of attachments after edit
         if ($count != $this->message->attachments) {
             $messageEditor = new ConversationMessageEditor($this->message);
             $messageEditor->update(array('attachments' => $count));
         }
     }
     // load embedded objects
     MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.conversation.message', array($this->message->messageID));
     $data = array('actionName' => 'save', 'message' => $this->message->getFormattedMessage());
     if (MODULE_ATTACHMENT) {
         WCF::getTPL()->assign(array('attachmentList' => $attachmentList, 'objectID' => $this->message->messageID));
         $data['attachmentList'] = WCF::getTPL()->fetch('attachments');
     }
     return $data;
 }