Another use statement sorting
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / files / lib / system / attachment / ConversationMessageAttachmentObjectType.class.php
CommitLineData
ce07ae0c
MW
1<?php
2namespace wcf\system\attachment;
c5a8bd8c 3use wcf\data\conversation\message\ConversationMessage;
ce07ae0c
MW
4use wcf\data\conversation\Conversation;
5use wcf\system\WCF;
6
7/**
8 * Attachment object type implementation for conversations.
9 *
10 * @author Marcel Werk
11 * @copyright 2009-2012 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf.conversation
14 * @subpackage system.attachment
61f754e0 15 * @category Community Framework
ce07ae0c
MW
16 */
17class ConversationMessageAttachmentObjectType extends AbstractAttachmentObjectType {
18 /**
61f754e0 19 * @see wcf\system\attachment\IAttachmentObjectType::canDownload()
ce07ae0c
MW
20 */
21 public function canDownload($objectID) {
22 if ($objectID) {
23 $message = new ConversationMessage($objectID);
24 $conversation = Conversation::getUserConversation($message->conversationID, WCF::getUser()->userID);
25 if ($conversation->canRead()) return true;
26 }
27
28 return false;
29 }
30
31 /**
61f754e0 32 * @see wcf\system\attachment\IAttachmentObjectType::canUpload()
ce07ae0c
MW
33 */
34 public function canUpload($objectID, $parentObjectID = 0) {
35 if ($objectID) {
36 $message = new ConversationMessage($objectID);
37 if ($message->userID == WCF::getUser()->userID) return true;
38 }
39
40 return WCF::getSession()->getPermission('user.conversation.canUploadAttachment');
41 }
42
43 /**
61f754e0 44 * @see wcf\system\attachment\IAttachmentObjectType::canDelete()
ce07ae0c
MW
45 */
46 public function canDelete($objectID) {
47 if ($objectID) {
48 $message = new ConversationMessage($objectID);
49 if ($message->userID == WCF::getUser()->userID) return true;
50 }
51
52 return false;
53 }
54}