diff --git a/eventListener.xml b/eventListener.xml new file mode 100644 index 0000000..612b7d8 --- /dev/null +++ b/eventListener.xml @@ -0,0 +1,12 @@ + + + + + wcf\system\request\RouteHandler + didInit + user + 0 + wcf\system\event\listener\ChatRouteListener + + + \ No newline at end of file diff --git a/file/lib/data/chat/message/ChatMessageEditor.class.php b/file/lib/data/chat/message/ChatMessageEditor.class.php index 0e8a80f..b2f8a60 100644 --- a/file/lib/data/chat/message/ChatMessageEditor.class.php +++ b/file/lib/data/chat/message/ChatMessageEditor.class.php @@ -24,7 +24,7 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor { * @return integer Number of deleted messages. */ public static function cleanup($lifetime = CHAT_ARCHIVETIME) { - $sql = "SELECT + $sql = "SELECT ".static::getDatabaseIndexName()." FROM ".static::getDatabaseTableName()." @@ -33,9 +33,7 @@ public static function cleanup($lifetime = CHAT_ARCHIVETIME) { $statement = \wcf\system\WCF::getDB()->prepareStatement($sql); $statement->execute(TIME_NOW - $lifetime); $objectIDs = array(); - while ($row = $statement->fetchArray()) { - $objectIDs[] = $row[static::getDatabaseIndexName()]; - } + while ($objectIDs[] = $statement->fetchColumn()); return static::deleteAll($objectIDs); } } diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/chat/room/ChatRoom.class.php index 4a4ed0d..7611a5b 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/chat/room/ChatRoom.class.php @@ -66,7 +66,7 @@ public function __toString() { * @see \wcf\system\request\IRouteController */ public function getTitle() { - return $this->title; + return WCF::getLanguage()->get($this->title); } /** diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 460aca4..75f60a5 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -102,6 +102,15 @@ public function readDefaultSmileys() { public function readParameters() { parent::readParameters(); + if ($this->action == 'Log') { + //TODO: Initialise LogPage + exit; + } + elseif($this->action == 'Send') { + //TODO: Safe message in database + exit; + } + if (isset($_REQUEST['id'])) $this->roomID = (int) $_REQUEST['id']; if (isset($_REQUEST['ajax'])) { $this->useTemplate = false; diff --git a/file/lib/system/event/listener/ChatRouteListener.class.php b/file/lib/system/event/listener/ChatRouteListener.class.php new file mode 100644 index 0000000..4f67713 --- /dev/null +++ b/file/lib/system/event/listener/ChatRouteListener.class.php @@ -0,0 +1,17 @@ +setSchema('/{controller}/{action}'); + $route->setParameterOption('controller', null, 'Chat'); + $route->setParameterOption('action', null, '(Log|Send)'); + $eventObj->addRoute($route); + } +} \ No newline at end of file diff --git a/package.xml b/package.xml index fc26253..15abc57 100644 --- a/package.xml +++ b/package.xml @@ -29,6 +29,7 @@ objectType.xml option.xml pagemenu.xml + eventListener.xml templatelistener.xml acloptions.xml @@ -41,6 +42,7 @@ objectType.xml option.xml pagemenu.xml + eventListener.xml templatelistener.xml acloptions.xml