From 730dbd7770820c695498464dc9497bb362325889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 3 Mar 2012 23:12:21 +0100 Subject: [PATCH] Adding array with default permission values --- .../chat/permission/ChatPermissionHandler.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/file/lib/system/chat/permission/ChatPermissionHandler.class.php b/file/lib/system/chat/permission/ChatPermissionHandler.class.php index f61a749..fc3e79e 100644 --- a/file/lib/system/chat/permission/ChatPermissionHandler.class.php +++ b/file/lib/system/chat/permission/ChatPermissionHandler.class.php @@ -16,6 +16,12 @@ */ class ChatPermissionHandler extends \wcf\system\SingletonFactory { protected $chatPermissions = array(); + protected static $defaults = array( + 'user.canEnter' => true, + 'user.canWrite' => true, + 'mod.canAlwaysEnter' => false, + 'mod.canAlwaysWrite' => false + ); /** * @see \wcf\system\SingletonFactory::init() @@ -81,7 +87,9 @@ protected function init() { * @return boolean */ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { - if (!isset($this->chatPermissions[$room->roomID][$permission])) return true; + if (!isset($this->chatPermissions[$room->roomID][$permission])) { + return isset(self::$defaults[$permission]) ? self::$defaults[$permission] : false; + } return (boolean) $this->chatPermissions[$room->roomID][$permission]; }