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
|
<?php
|
||||||
namespace wcf\action;
|
namespace wcf\action;
|
||||||
use \wcf\data\chat;
|
use \wcf\data\chat;
|
||||||
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +69,7 @@ public function execute() {
|
|||||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
||||||
|
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$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']];
|
$this->room = $cache[$this->userData['roomID']];
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace wcf\page;
|
||||||
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace wcf\page;
|
||||||
use \wcf\data\chat;
|
use \wcf\data\chat;
|
||||||
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +135,7 @@ public function readMessages() {
|
|||||||
public function readRoom() {
|
public function readRoom() {
|
||||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$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];
|
$this->room = $cache[$roomID];
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
namespace wcf\page;
|
namespace wcf\page;
|
||||||
use \wcf\data\chat;
|
use \wcf\data\chat;
|
||||||
use \wcf\system\cache\CacheHandler;
|
use \wcf\system\cache\CacheHandler;
|
||||||
|
use \wcf\ystem\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +29,17 @@ class ChatRefreshRoomListPage extends AbstractPage {
|
|||||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||||
*/
|
*/
|
||||||
public $neededPermissions = array();
|
public $neededPermissions = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the room the user current is in
|
||||||
|
* @var \wcf\data\chat\room\ChatRoom
|
||||||
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all rooms in the current installation
|
||||||
|
* @var array<\wcf\data\chat\room\ChatRoom>
|
||||||
|
*/
|
||||||
public $rooms = array();
|
public $rooms = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +73,7 @@ public function readData() {
|
|||||||
$this->rooms = chat\room\ChatRoom::getCache();
|
$this->rooms = chat\room\ChatRoom::getCache();
|
||||||
|
|
||||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
$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];
|
$this->room = $this->rooms[$roomID];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +87,7 @@ public function show() {
|
|||||||
$json = array();
|
$json = array();
|
||||||
foreach ($this->rooms as $room) {
|
foreach ($this->rooms as $room) {
|
||||||
if (!$room->canEnter()) continue;
|
if (!$room->canEnter()) continue;
|
||||||
|
|
||||||
$json[] = array(
|
$json[] = array(
|
||||||
'title' => WCF::getLanguage()->get($room->title),
|
'title' => WCF::getLanguage()->get($room->title),
|
||||||
'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||||
|
Loading…
Reference in New Issue
Block a user