1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Fix MessageAttachmentObjectType.class.php

This commit is contained in:
Maximilian Mader 2013-09-14 23:25:56 +02:00
parent 7a49d825ae
commit b90d21a224

View File

@ -1,5 +1,6 @@
<?php <?php
namespace chat\system\attachment; namespace chat\system\attachment;
use \wcf\system\WCF;
/** /**
* Attachment object type implementation for chat messages. * Attachment object type implementation for chat messages.
@ -10,7 +11,7 @@
* @package be.bastelstu.chat * @package be.bastelstu.chat
* @subpackage system.attachment * @subpackage system.attachment
*/ */
class MessageAttachmentObjectType extends AbstractAttachmentObjectType { class MessageAttachmentObjectType extends \wcf\system\attachment\AbstractAttachmentObjectType {
/** /**
* @see wcf\system\attachment\IAttachmentObjectType::getMaxSize() * @see wcf\system\attachment\IAttachmentObjectType::getMaxSize()
*/ */
@ -22,7 +23,7 @@ public function getMaxSize() {
* @see wcf\system\attachment\IAttachmentObjectType::getAllowedExtensions() * @see wcf\system\attachment\IAttachmentObjectType::getAllowedExtensions()
*/ */
public function getAllowedExtensions() { public function getAllowedExtensions() {
return ArrayUtil::trim(explode("\n", WCF::getSession()->getPermission('user.chat.allowedAttachmentExtensions'))); return \wcf\util\ArrayUtil::trim(explode("\n", WCF::getSession()->getPermission('user.chat.allowedAttachmentExtensions')));
} }
/** /**
@ -49,8 +50,8 @@ public function canDownload($objectID) {
*/ */
public function canUpload($objectID, $parentObjectID = 0) { public function canUpload($objectID, $parentObjectID = 0) {
if ($objectID) { if ($objectID) {
$room = \chat\data\room\RoomCache::getInstance()->getRoom($objectID); $room = \chat\data\room\RoomCache::getInstance()->getRoom($parentObjectID);
if ($room && $room->canWrite()) return true; if (!$room || !$room->canWrite()) return false;
} }
return WCF::getSession()->getPermission('user.chat.canUploadAttachment'); return WCF::getSession()->getPermission('user.chat.canUploadAttachment');