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:
parent
c78bb37f92
commit
d1101fe101
@ -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();
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace wcf\page;
|
||||
use \wcf\system\exception\IllegalLinkException;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
|
@ -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();
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user