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:
parent
063fb644b0
commit
8ee9b0a207
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace wcf\data\chat\room;
|
||||
use \wcf\system\cache\CacheHandler;
|
||||
|
||||
/**
|
||||
* Represents a chat room.
|
||||
@ -31,8 +32,8 @@ class ChatRoom extends \wcf\data\DatabaseObject {
|
||||
/**
|
||||
* Loads the room cache.
|
||||
*/
|
||||
protected static function getCache() {
|
||||
if (self::$cache !== null) return;
|
||||
public static function getCache() {
|
||||
if (self::$cache === null) {
|
||||
CacheHandler::getInstance()->addResource(
|
||||
'chatrooms',
|
||||
WCF_DIR.'cache/cache.chatrooms.php',
|
||||
@ -41,6 +42,9 @@ protected static function getCache() {
|
||||
self::$cache = CacheHandler::getInstance()->get('chatrooms');
|
||||
}
|
||||
|
||||
return self::$cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this chat-room.
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user