mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fixing Chat*(Page|Form|Action)
This commit is contained in:
parent
ec0154e3a4
commit
f777bc1d2e
@ -67,8 +67,9 @@ public function execute() {
|
||||
|
||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
|
||||
$this->room = chat\room\ChatRoom::getCache()->search($this->userData['roomID']);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$cache = chat\room\ChatRoom::getCache();
|
||||
if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->room = $cache[$this->userData['roomID']];
|
||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
|
||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||
|
@ -95,8 +95,10 @@ public function readData() {
|
||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
$this->userData['away'] = \wcf\util\ChatUtil::readUserData('away');
|
||||
|
||||
$this->room = chat\room\ChatRoom::getCache()->search($this->userData['roomID']);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$cache = chat\room\ChatRoom::getCache();
|
||||
if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->room = $cache[$this->userData['roomID']];
|
||||
|
||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
if (!$this->room->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
parent::readData();
|
||||
|
@ -133,9 +133,10 @@ 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();
|
||||
|
||||
$this->room = chat\room\ChatRoom::getCache()->search($roomID);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->room = $cache[$roomID];
|
||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
}
|
||||
|
||||
|
@ -213,22 +213,20 @@ public function readRoom() {
|
||||
|
||||
if ($this->roomID === 0) {
|
||||
// no room given
|
||||
try {
|
||||
// redirect to first chat-room
|
||||
$this->rooms->seek(0);
|
||||
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||
'object' => $this->rooms->current()
|
||||
)));
|
||||
exit;
|
||||
}
|
||||
catch (\OutOfBoundsException $e) {
|
||||
$room = reset($this->rooms);
|
||||
if ($room === null) {
|
||||
// no valid room found
|
||||
throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
// redirect to first chat-room
|
||||
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||
'object' => $room
|
||||
)));
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->room = $this->rooms->search($this->roomID);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
if (!isset($this->rooms[$this->roomID])) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->room = $this->rooms[$this->roomID];
|
||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,8 @@ public function readData() {
|
||||
$this->rooms = chat\room\ChatRoom::getCache();
|
||||
|
||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
||||
$this->room = $this->rooms->search($roomID);
|
||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
||||
if (!isset($this->rooms[$roomID])) throw new \wcf\system\exception\IllegalLinkException();
|
||||
$this->room = $this->rooms[$roomID];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user