use wcf\data\IMessage;
use wcf\data\TUserContent;
use wcf\system\bbcode\MessageParser;
+use wcf\system\html\output\HtmlOutputProcessor;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
// assign embedded objects
MessageEmbeddedObjectManager::getInstance()->setActiveMessage('com.woltlab.wcf.conversation.message', $this->messageID);
+ // TODO
+ return (new HtmlOutputProcessor())->process($this->message);
+
+ // TODO
// parse and return message
- MessageParser::getInstance()->setOutputType('text/html');
- return MessageParser::getInstance()->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes);
+ /*MessageParser::getInstance()->setOutputType('text/html');
+ return MessageParser::getInstance()->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes);*/
}
/**
use wcf\system\bbcode\PreParser;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
+use wcf\system\html\input\HtmlInputProcessor;
use wcf\system\message\censorship\Censorship;
use wcf\system\message\embedded\object\MessageEmbeddedObjectManager;
use wcf\system\message\quote\MessageQuoteManager;
}
}
+ if (!empty($this->parameters['htmlInputProcessor'])) {
+ /** @var HtmlInputProcessor $htmlInputProcessor */
+ $htmlInputProcessor = $this->parameters['htmlInputProcessor'];
+ $this->parameters['data']['message'] = $htmlInputProcessor->getHtml();
+ }
+
// create message
$message = parent::create();
$messageEditor = new ConversationMessageEditor($message);
}
$this->validateBeginEdit();
- $this->validateMessage($this->conversation, $this->parameters['data']['message']);
+
+ $this->validateMessage($this->conversation, $this->getHtmlInputProcessor($this->parameters['data']['message']));
}
/**
*/
public function save() {
$data = [
- 'message' => PreParser::getInstance()->parse(MessageUtil::stripCrap($this->parameters['data']['message']), explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')))
+ //'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;
/**
* @inheritDoc
*/
- public function validateMessage(DatabaseObject $container, $message) {
- if (mb_strlen($message) > WCF::getSession()->getPermission('user.conversation.maxLength')) {
+ public function validateMessage(DatabaseObject $container, HtmlInputProcessor $htmlInputProcessor) {
+ /*if (mb_strlen($message) > WCF::getSession()->getPermission('user.conversation.maxLength')) {
throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.tooLong', ['maxTextLength' => WCF::getSession()->getPermission('user.conversation.maxLength')]));
}
if ($result) {
throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', ['censoredWords' => $result]));
}
- }
+ }*/
}
/**
public function getAttachmentHandler(DatabaseObject $conversation) {
return new AttachmentHandler('com.woltlab.wcf.conversation.message', 0, $this->parameters['tmpHash']);
}
+
+ /**
+ * @inheritDoc
+ */
+ public function getHtmlInputProcessor($message = null) {
+ if ($message === null) {
+ return $this->htmlInputProcessor;
+ }
+
+ $this->htmlInputProcessor = new HtmlInputProcessor();
+ $this->htmlInputProcessor->process($message);
+
+ return $this->htmlInputProcessor;
+ }
}
$conversationData = [
'data' => $data,
'attachmentHandler' => $this->attachmentHandler,
- 'messageData' => [
- 'message' => $this->text,
- 'enableBBCodes' => $this->enableBBCodes,
- 'enableHtml' => $this->enableHtml,
- 'enableSmilies' => $this->enableSmilies,
- 'showSignature' => $this->showSignature
- ]
+ 'htmlInputProcessor' => $this->htmlInputProcessor,
+ 'messageData' => []
];
if (!$this->draft) {
$conversationData['participants'] = $this->participantIDs;