From a7e6bab0cd3f9ee15809c8b572eabef7321b0b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 18 Feb 2012 17:21:57 +0100 Subject: [PATCH] Adding ChatLeaveAction to Routing --- file/lib/page/ChatPage.class.php | 37 +++++++++---------- .../listener/ChatRouteListener.class.php | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index d7dbe78..0023607 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -105,25 +105,24 @@ public function readDefaultSmileys() { public function readParameters() { parent::readParameters(); - if ($this->action == 'Message') { - new ChatMessagePage(); - exit; - } - else if ($this->action == 'Log') { - //TODO: Initialise LogPage - exit; - } - else if ($this->action == 'RefreshRoomList') { - new ChatRefreshRoomListPage(); - exit; - } - else if ($this->action == 'Send') { - new \wcf\form\ChatForm(); - exit; - } - else if ($this->action == 'Copyright') { - new ChatCopyrightPage(); - exit; + switch ($this->action) { + case 'Message': + new ChatMessagePage(); + exit; + case 'Log': + exit; + case 'RefreshRoomList': + new ChatRefreshRoomListPage(); + exit; + case 'Send': + new \wcf\form\ChatForm(); + exit; + case 'Leave': + new \wcf\action\ChatLeaveAction(); + exit; + case 'Copyright': + new ChatCopyrightPage(); + exit; } if (isset($_REQUEST['id'])) $this->roomID = (int) $_REQUEST['id']; diff --git a/file/lib/system/event/listener/ChatRouteListener.class.php b/file/lib/system/event/listener/ChatRouteListener.class.php index 991bb35..385fe37 100644 --- a/file/lib/system/event/listener/ChatRouteListener.class.php +++ b/file/lib/system/event/listener/ChatRouteListener.class.php @@ -18,7 +18,7 @@ public function execute($eventObj, $className, $eventName) { $route = new \wcf\system\request\Route('chatAction'); $route->setSchema('/{controller}/{action}'); $route->setParameterOption('controller', null, 'Chat'); - $route->setParameterOption('action', null, '(Message|Log|Send|RefreshRoomList|Copyright)'); + $route->setParameterOption('action', null, '(Message|Log|Send|RefreshRoomList|Copyright|Leave)'); $eventObj->addRoute($route); } }