mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Merge branch 'master' into chatTemplate
Conflicts: file/lib/page/ChatPage.class.php
This commit is contained in:
commit
44454e12e0
12
eventListener.xml
Normal file
12
eventListener.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/eventListener.xsd">
|
||||
<import>
|
||||
<eventlistener>
|
||||
<eventclassname>wcf\system\request\RouteHandler</eventclassname>
|
||||
<eventname>didInit</eventname>
|
||||
<environment>user</environment>
|
||||
<inherit>0</inherit>
|
||||
<listenerclassname>wcf\system\event\listener\ChatRouteListener</listenerclassname>
|
||||
</eventlistener>
|
||||
</import>
|
||||
</data>
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public function __toString() {
|
||||
* @see \wcf\system\request\IRouteController
|
||||
*/
|
||||
public function getTitle() {
|
||||
return $this->title;
|
||||
return WCF::getLanguage()->get($this->title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
17
file/lib/system/event/listener/ChatRouteListener.class.php
Normal file
17
file/lib/system/event/listener/ChatRouteListener.class.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace wcf\system\event\listener;
|
||||
use wcf\system\event\IEventListener;
|
||||
use wcf\system\request\Route;
|
||||
|
||||
class ChatRouteListener implements IEventListener {
|
||||
/**
|
||||
* @see wcf\system\event\IEventListener::execute()
|
||||
*/
|
||||
public function execute($eventObj, $className, $eventName) {
|
||||
$route = new Route('chatAction');
|
||||
$route->setSchema('/{controller}/{action}');
|
||||
$route->setParameterOption('controller', null, 'Chat');
|
||||
$route->setParameterOption('action', null, '(Log|Send)');
|
||||
$eventObj->addRoute($route);
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@
|
||||
<instruction type="objectType">objectType.xml</instruction>
|
||||
<instruction type="option">option.xml</instruction>
|
||||
<instruction type="pagemenu">pagemenu.xml</instruction>
|
||||
<instruction type="eventListener">eventListener.xml</instruction>
|
||||
<instruction type="templatelistener">templatelistener.xml</instruction>
|
||||
<instruction type="aclOption">acloptions.xml</instruction>
|
||||
</instructions>
|
||||
@ -41,6 +42,7 @@
|
||||
<instruction type="objectType">objectType.xml</instruction>
|
||||
<instruction type="option">option.xml</instruction>
|
||||
<instruction type="pagemenu">pagemenu.xml</instruction>
|
||||
<instruction type="eventListener">eventListener.xml</instruction>
|
||||
<instruction type="templatelistener">templatelistener.xml</instruction>
|
||||
<instruction type="aclOption">acloptions.xml</instruction>
|
||||
</instructions>
|
||||
|
Loading…
Reference in New Issue
Block a user