<?php
namespace wcf\data\conversation\message;
+use wcf\data\attachment\GroupedAttachmentList;
use wcf\data\conversation\Conversation;
use wcf\data\DatabaseObject;
use wcf\data\IMessage;
+use wcf\system\bbcode\AttachmentBBCode;
use wcf\system\bbcode\MessageParser;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
* @see wcf\data\IMessage::getFormattedMessage()
*/
public function getFormattedMessage() {
+ // assign embedded attachments
+ AttachmentBBCode::setObjectID($this->messageID);
+
+ // parse and return message
MessageParser::getInstance()->setOutputType('text/html');
return MessageParser::getInstance()->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes);
}
+ /**
+ * Gets and assigns embedded attachments.
+ *
+ * @return wcf\data\attachment\GroupedAttachmentList
+ */
+ public function getAttachments() {
+ if (MODULE_ATTACHMENT == 1 && $this->attachments) {
+ $attachmentList = new GroupedAttachmentList('com.woltlab.wcf.conversation.message');
+ $attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', array($this->messageID));
+ $attachmentList->readObjects();
+ $attachmentList->setPermissions(array(
+ 'canDownload' => WCF::getSession()->getPermission('user.blog.canDownloadAttachment'),
+ 'canViewPreview' => WCF::getSession()->getPermission('user.blog.canViewAttachmentPreview')
+ ));
+
+ // set embedded attachments
+ AttachmentBBCode::setAttachmentList($attachmentList);
+
+ return $attachmentList;
+ }
+
+ return null;
+ }
+
/**
* Returns an excerpt of this message.
*
// load new message
$this->message = new ConversationMessage($this->message->messageID);
+ $this->message->getAttachments();
return array(
'actionName' => 'save',
<?php
namespace wcf\data\conversation\message;
use wcf\data\attachment\GroupedAttachmentList;
+use wcf\system\bbcode\AttachmentBBCode;
/**
* Represents a list of viewable conversation messages.
$this->attachmentList = new GroupedAttachmentList('com.woltlab.wcf.conversation.message');
$this->attachmentList->getConditionBuilder()->add('attachment.objectID IN (?)', array($this->attachmentObjectIDs));
$this->attachmentList->readObjects();
+
+ // set embedded attachments
+ AttachmentBBCode::setAttachmentList($this->attachmentList);
}
}
$messageIDs[] = $message->messageID;
}
MessageQuoteManager::getInstance()->initObjects('com.woltlab.wcf.conversation.message', $messageIDs);
+
+ // set attachment permissions
+ if ($this->objectList->getAttachmentList() !== null) {
+ $this->objectList->getAttachmentList()->setPermissions(array(
+ 'canDownload' => true,
+ 'canViewPreview' => true
+ ));
+ }
}
/**
use wcf\data\conversation\message\ConversationMessage;
use wcf\data\conversation\Conversation;
use wcf\system\WCF;
+use wcf\util\ArrayUtil;
/**
* Attachment object type implementation for conversations.
*
* @author Marcel Werk
- * @copyright 2009-2012 WoltLab GmbH
+ * @copyright 2009-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.conversation
* @subpackage system.attachment
* @category Community Framework
*/
class ConversationMessageAttachmentObjectType extends AbstractAttachmentObjectType {
+ /**
+ * @see wcf\system\attachment\IAttachmentObjectType::getMaxSize()
+ */
+ public function getMaxSize() {
+ return WCF::getSession()->getPermission('user.conversation.maxAttachmentSize');
+ }
+
+ /**
+ * @see wcf\system\attachment\IAttachmentObjectType::getAllowedExtensions()
+ */
+ public function getAllowedExtensions() {
+ return ArrayUtil::trim(explode("\n", WCF::getSession()->getPermission('user.conversation.allowedAttachmentExtensions')));
+ }
+
+ /**
+ * @see wcf\system\attachment\IAttachmentObjectType::getMaxCount()
+ */
+ public function getMaxCount() {
+ return WCF::getSession()->getPermission('user.conversation.maxAttachmentCount');
+ }
+
/**
* @see wcf\system\attachment\IAttachmentObjectType::canDownload()
*/
<option name="user.conversation.maxAttachmentSize">
<categoryname>user.conversation</categoryname>
<optiontype>integer</optiontype>
- <defaultvalue>150000</defaultvalue>
+ <defaultvalue>1000000</defaultvalue>
<options>module_attachment</options>
</option>
<option name="user.conversation.allowedAttachmentExtensions">