From 8ee9b0a2077d4c6f8b292cbed54f11dcdb4a7779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 26 Nov 2011 17:37:46 +0100 Subject: [PATCH] Validating ID-Parameter --- file/lib/data/chat/room/ChatRoom.class.php | 20 ++++++++++++-------- file/lib/page/ChatPage.class.php | 12 +++++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index dc1bc5b..f15e5e1 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -1,5 +1,6 @@ addResource( - 'chatrooms', - WCF_DIR.'cache/cache.chatrooms.php', - 'wcf\system\cache\builder\ChatRoomCacheBuilder' - ); - self::$cache = CacheHandler::getInstance()->get('chatrooms'); + public static function getCache() { + if (self::$cache === null) { + CacheHandler::getInstance()->addResource( + 'chatrooms', + WCF_DIR.'cache/cache.chatrooms.php', + 'wcf\system\cache\builder\ChatRoomCacheBuilder' + ); + self::$cache = CacheHandler::getInstance()->get('chatrooms'); + } + + return self::$cache; } /** diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index e0996f2..19abe1f 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -1,6 +1,7 @@ rooms = chat\room\ChatRoom::getCache(); + if (isset($this->rooms[$this->roomID])) { + $this->room = $this->rooms[$this->roomID]; + } + else { + throw new \wcf\system\exception\IllegalLinkException(); + } } /**