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->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
||||||
|
|
||||||
$this->room = chat\room\ChatRoom::getCache()->search($this->userData['roomID']);
|
$cache = chat\room\ChatRoom::getCache();
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
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->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
|
@ -95,8 +95,10 @@ public function readData() {
|
|||||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
||||||
$this->userData['away'] = \wcf\util\ChatUtil::readUserData('away');
|
$this->userData['away'] = \wcf\util\ChatUtil::readUserData('away');
|
||||||
|
|
||||||
$this->room = chat\room\ChatRoom::getCache()->search($this->userData['roomID']);
|
$cache = chat\room\ChatRoom::getCache();
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
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->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
if (!$this->room->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canWrite()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
parent::readData();
|
parent::readData();
|
||||||
|
@ -133,9 +133,10 @@ 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();
|
||||||
|
if (!isset($cache[$roomID])) throw new \wcf\system\exception\IllegalLinkException();
|
||||||
|
|
||||||
$this->room = chat\room\ChatRoom::getCache()->search($roomID);
|
$this->room = $cache[$roomID];
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,22 +213,20 @@ public function readRoom() {
|
|||||||
|
|
||||||
if ($this->roomID === 0) {
|
if ($this->roomID === 0) {
|
||||||
// no room given
|
// no room given
|
||||||
try {
|
$room = reset($this->rooms);
|
||||||
// redirect to first chat-room
|
if ($room === null) {
|
||||||
$this->rooms->seek(0);
|
|
||||||
\wcf\util\HeaderUtil::redirect(\wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
|
||||||
'object' => $this->rooms->current()
|
|
||||||
)));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
catch (\OutOfBoundsException $e) {
|
|
||||||
// no valid room found
|
// no valid room found
|
||||||
throw new \wcf\system\exception\IllegalLinkException();
|
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 (!isset($this->rooms[$this->roomID])) throw new \wcf\system\exception\IllegalLinkException();
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
$this->room = $this->rooms[$this->roomID];
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ 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');
|
||||||
$this->room = $this->rooms->search($roomID);
|
if (!isset($this->rooms[$roomID])) throw new \wcf\system\exception\IllegalLinkException();
|
||||||
if (!$this->room) throw new \wcf\system\exception\IllegalLinkException();
|
$this->room = $this->rooms[$roomID];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user