1
0
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:
Tim Düsterhus 2011-12-10 21:53:56 +01:00
commit 44454e12e0
6 changed files with 43 additions and 5 deletions

12
eventListener.xml Normal file
View 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>

View File

@ -24,7 +24,7 @@ class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
* @return integer Number of deleted messages. * @return integer Number of deleted messages.
*/ */
public static function cleanup($lifetime = CHAT_ARCHIVETIME) { public static function cleanup($lifetime = CHAT_ARCHIVETIME) {
$sql = "SELECT $sql = "SELECT
".static::getDatabaseIndexName()." ".static::getDatabaseIndexName()."
FROM FROM
".static::getDatabaseTableName()." ".static::getDatabaseTableName()."
@ -33,9 +33,7 @@ public static function cleanup($lifetime = CHAT_ARCHIVETIME) {
$statement = \wcf\system\WCF::getDB()->prepareStatement($sql); $statement = \wcf\system\WCF::getDB()->prepareStatement($sql);
$statement->execute(TIME_NOW - $lifetime); $statement->execute(TIME_NOW - $lifetime);
$objectIDs = array(); $objectIDs = array();
while ($row = $statement->fetchArray()) { while ($objectIDs[] = $statement->fetchColumn());
$objectIDs[] = $row[static::getDatabaseIndexName()];
}
return static::deleteAll($objectIDs); return static::deleteAll($objectIDs);
} }
} }

View File

@ -66,7 +66,7 @@ public function __toString() {
* @see \wcf\system\request\IRouteController * @see \wcf\system\request\IRouteController
*/ */
public function getTitle() { public function getTitle() {
return $this->title; return WCF::getLanguage()->get($this->title);
} }
/** /**

View File

@ -102,6 +102,15 @@ public function readDefaultSmileys() {
public function readParameters() { public function readParameters() {
parent::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['id'])) $this->roomID = (int) $_REQUEST['id'];
if (isset($_REQUEST['ajax'])) { if (isset($_REQUEST['ajax'])) {
$this->useTemplate = false; $this->useTemplate = false;

View 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);
}
}

View File

@ -29,6 +29,7 @@
<instruction type="objectType">objectType.xml</instruction> <instruction type="objectType">objectType.xml</instruction>
<instruction type="option">option.xml</instruction> <instruction type="option">option.xml</instruction>
<instruction type="pagemenu">pagemenu.xml</instruction> <instruction type="pagemenu">pagemenu.xml</instruction>
<instruction type="eventListener">eventListener.xml</instruction>
<instruction type="templatelistener">templatelistener.xml</instruction> <instruction type="templatelistener">templatelistener.xml</instruction>
<instruction type="aclOption">acloptions.xml</instruction> <instruction type="aclOption">acloptions.xml</instruction>
</instructions> </instructions>
@ -41,6 +42,7 @@
<instruction type="objectType">objectType.xml</instruction> <instruction type="objectType">objectType.xml</instruction>
<instruction type="option">option.xml</instruction> <instruction type="option">option.xml</instruction>
<instruction type="pagemenu">pagemenu.xml</instruction> <instruction type="pagemenu">pagemenu.xml</instruction>
<instruction type="eventListener">eventListener.xml</instruction>
<instruction type="templatelistener">templatelistener.xml</instruction> <instruction type="templatelistener">templatelistener.xml</instruction>
<instruction type="aclOption">acloptions.xml</instruction> <instruction type="aclOption">acloptions.xml</instruction>
</instructions> </instructions>