1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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
namespace wcf\data\chat\room;
use \wcf\system\cache\CacheHandler;
/**
* Represents a chat room.
@ -31,14 +32,17 @@ class ChatRoom extends \wcf\data\DatabaseObject {
/**
* Loads the room cache.
*/
protected static function getCache() {
if (self::$cache !== null) return;
CacheHandler::getInstance()->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;
}
/**

View File

@ -1,6 +1,7 @@
<?php
namespace wcf\page;
use \wcf\system\WCF;
use \wcf\data\chat;
/**
* Shows the chat-interface
@ -12,9 +13,11 @@
* @subpackage page
*/
class ChatPage extends AbstractPage {
public $roomID = 0;
//public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter');
public $room = null;
public $roomID = 0;
public $rooms = array();
/**
* @see \wcf\page\IPage::assignVariables()
@ -32,6 +35,13 @@ public function assignVariables() {
*/
public function 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();
}
}
/**