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

Validating ID-Parameter

This commit is contained in:
Tim Düsterhus 2011-11-26 17:37:46 +01:00
parent 063fb644b0
commit 8ee9b0a207
2 changed files with 23 additions and 9 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
namespace wcf\data\chat\room; namespace wcf\data\chat\room;
use \wcf\system\cache\CacheHandler;
/** /**
* Represents a chat room. * Represents a chat room.
@ -31,14 +32,17 @@ class ChatRoom extends \wcf\data\DatabaseObject {
/** /**
* Loads the room cache. * Loads the room cache.
*/ */
protected static function getCache() { public static function getCache() {
if (self::$cache !== null) return; if (self::$cache === null) {
CacheHandler::getInstance()->addResource( CacheHandler::getInstance()->addResource(
'chatrooms', 'chatrooms',
WCF_DIR.'cache/cache.chatrooms.php', WCF_DIR.'cache/cache.chatrooms.php',
'wcf\system\cache\builder\ChatRoomCacheBuilder' 'wcf\system\cache\builder\ChatRoomCacheBuilder'
); );
self::$cache = CacheHandler::getInstance()->get('chatrooms'); self::$cache = CacheHandler::getInstance()->get('chatrooms');
}
return self::$cache;
} }
/** /**

View File

@ -1,6 +1,7 @@
<?php <?php
namespace wcf\page; namespace wcf\page;
use \wcf\system\WCF; use \wcf\system\WCF;
use \wcf\data\chat;
/** /**
* Shows the chat-interface * Shows the chat-interface
@ -12,9 +13,11 @@
* @subpackage page * @subpackage page
*/ */
class ChatPage extends AbstractPage { class ChatPage extends AbstractPage {
public $roomID = 0;
//public $neededModules = array('CHAT_ACTIVE'); //public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter'); //public $neededPermissions = array('user.chat.canEnter');
public $room = null;
public $roomID = 0;
public $rooms = array();
/** /**
* @see \wcf\page\IPage::assignVariables() * @see \wcf\page\IPage::assignVariables()
@ -32,6 +35,13 @@ public function assignVariables() {
*/ */
public function readData() { public function readData() {
parent::readData(); parent::readData();
$this->rooms = chat\room\ChatRoom::getCache();
if (isset($this->rooms[$this->roomID])) {
$this->room = $this->rooms[$this->roomID];
}
else {
throw new \wcf\system\exception\IllegalLinkException();
}
} }
/** /**