1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Properly import IllegalLinkException

This commit is contained in:
Tim Düsterhus 2012-10-20 16:20:52 +02:00
parent c78bb37f92
commit d1101fe101
4 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,7 @@
<?php
namespace wcf\action;
use \wcf\data\chat;
use \wcf\system\exception\IllegalLinkException;
use \wcf\system\WCF;
/**
@ -68,7 +69,7 @@ public function execute() {
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
$cache = chat\room\ChatRoom::getCache();
if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
if (!isset($cache[$this->userData['roomID']])) throw new IllegalLinkException();
$this->room = $cache[$this->userData['roomID']];
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();

View File

@ -1,5 +1,6 @@
<?php
namespace wcf\page;
use \wcf\system\exception\IllegalLinkException;
use \wcf\system\WCF;
/**

View File

@ -1,6 +1,7 @@
<?php
namespace wcf\page;
use \wcf\data\chat;
use \wcf\system\exception\IllegalLinkException;
use \wcf\system\WCF;
/**
@ -134,7 +135,7 @@ public function readMessages() {
public function readRoom() {
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
$cache = chat\room\ChatRoom::getCache();
if (!isset($cache[$roomID])) throw new \wcf\system\exception\IllegalLinkException();
if (!isset($cache[$roomID])) throw new IllegalLinkException();
$this->room = $cache[$roomID];
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();

View File

@ -2,6 +2,7 @@
namespace wcf\page;
use \wcf\data\chat;
use \wcf\system\cache\CacheHandler;
use \wcf\ystem\exception\IllegalLinkException;
use \wcf\system\WCF;
/**
@ -28,7 +29,17 @@ class ChatRefreshRoomListPage extends AbstractPage {
* @see \wcf\page\AbstractPage::$neededPermissions
*/
public $neededPermissions = array();
/**
* the room the user current is in
* @var \wcf\data\chat\room\ChatRoom
*/
public $room = null;
/**
* all rooms in the current installation
* @var array<\wcf\data\chat\room\ChatRoom>
*/
public $rooms = array();
/**
@ -62,7 +73,7 @@ public function readData() {
$this->rooms = chat\room\ChatRoom::getCache();
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
if (!isset($this->rooms[$roomID])) throw new \wcf\system\exception\IllegalLinkException();
if (!isset($this->rooms[$roomID])) throw new IllegalLinkException();
$this->room = $this->rooms[$roomID];
}
@ -76,6 +87,7 @@ public function show() {
$json = array();
foreach ($this->rooms as $room) {
if (!$room->canEnter()) continue;
$json[] = array(
'title' => WCF::getLanguage()->get($room->title),
'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(