mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fixup last commit #495680c3d359e504186c
These changes should have been in the last commit too.
This commit is contained in:
parent
495680c3d3
commit
75c09e2a5d
@ -70,7 +70,7 @@ public function __toString() {
|
|||||||
public function getFormattedMessage($type = 'text/html') {
|
public function getFormattedMessage($type = 'text/html') {
|
||||||
$message = $this->message;
|
$message = $this->message;
|
||||||
$messageParser = \wcf\system\bbcode\MessageParser::getInstance();
|
$messageParser = \wcf\system\bbcode\MessageParser::getInstance();
|
||||||
$messageParser->setOutputType('text/html');
|
$messageParser->setOutputType($type);
|
||||||
|
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case self::TYPE_JOIN:
|
case self::TYPE_JOIN:
|
||||||
@ -91,7 +91,7 @@ public function getFormattedMessage($type = 'text/html') {
|
|||||||
case self::TYPE_NORMAL:
|
case self::TYPE_NORMAL:
|
||||||
case self::TYPE_ME:
|
case self::TYPE_ME:
|
||||||
default:
|
default:
|
||||||
if ($type !== 'text/html') return $message;
|
if ($type === 'text/plain') return $message;
|
||||||
|
|
||||||
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
|
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
|
||||||
break;
|
break;
|
||||||
|
@ -60,4 +60,23 @@ public static function getMessagesSince(\chat\data\room\Room $room, $since) {
|
|||||||
$messageList->readObjects();
|
$messageList->readObjects();
|
||||||
return $messageList->getObjects();
|
return $messageList->getObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the message between the given timestamps for the given room.
|
||||||
|
*
|
||||||
|
* @param \chat\data\room\Room $room
|
||||||
|
* @param integer $start
|
||||||
|
* @param integer $end
|
||||||
|
* @return array<\chat\data\message\Message>
|
||||||
|
*/
|
||||||
|
public static function getMessagesBetween(\chat\data\room\Room $room, $start, $end) {
|
||||||
|
$messageList = new static();
|
||||||
|
$messageList->sqlOrderBy = "message.messageID ASC";
|
||||||
|
$messageList->getConditionBuilder()->add('message.receiver IS NULL', array());
|
||||||
|
$messageList->getConditionBuilder()->add('message.roomID = ?', array($room->roomID));
|
||||||
|
$messageList->getConditionBuilder()->add('message.time BETWEEN ? AND ?', array($start, $end));
|
||||||
|
|
||||||
|
$messageList->readObjects();
|
||||||
|
return $messageList->getObjects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace chat\page;
|
|
||||||
use \chat\data;
|
|
||||||
use \wcf\system\exception\IllegalLinkException;
|
|
||||||
use \wcf\system\exception\PermissionDeniedException;
|
|
||||||
use \wcf\system\WCF;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows the chat-log.
|
|
||||||
*
|
|
||||||
* @author Tim Düsterhus
|
|
||||||
* @copyright 2010-2013 Tim Düsterhus
|
|
||||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
||||||
* @package be.bastelstu.chat
|
|
||||||
* @subpackage page
|
|
||||||
*/
|
|
||||||
class LogPage extends \wcf\page\AbstractPage {
|
|
||||||
/**
|
|
||||||
* @see wcf\page\AbstractPage::$loginRequired
|
|
||||||
*/
|
|
||||||
public $loginRequired = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: comment this
|
|
||||||
*
|
|
||||||
* @var array<\wcf\data\chat\message\ChatMessage>
|
|
||||||
*/
|
|
||||||
public $messages = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\AbstractPage::$neededModules
|
|
||||||
*/
|
|
||||||
public $neededModules = array('MODULE_CHAT');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
|
||||||
*/
|
|
||||||
public $neededPermissions = array('mod.chat.canReadLog');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* given roomID
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
public $roomID = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* given room
|
|
||||||
* @var \chat\data\room\Chat
|
|
||||||
*/
|
|
||||||
public $room = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\IPage::assignVariables()
|
|
||||||
*/
|
|
||||||
public function assignVariables() {
|
|
||||||
parent::assignVariables();
|
|
||||||
|
|
||||||
WCF::getTPL()->assign(array(
|
|
||||||
'messages' => $this->messages,
|
|
||||||
'room' => $this->room,
|
|
||||||
'roomID' => $this->roomID
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\IPage::readParameters()
|
|
||||||
*/
|
|
||||||
public function readParameters() {
|
|
||||||
parent::readParameters();
|
|
||||||
|
|
||||||
if (isset($_REQUEST['id'])) $this->roomID = intval($_REQUEST['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\IPage::readData()
|
|
||||||
*/
|
|
||||||
public function readData() {
|
|
||||||
parent::readData();
|
|
||||||
|
|
||||||
$this->room = data\room\RoomCache::getInstance()->getRoom($this->roomID);
|
|
||||||
if (!$this->room) throw new IllegalLinkException();
|
|
||||||
if (!$this->room->canEnter()) throw new PermissionDeniedException();
|
|
||||||
|
|
||||||
// TODO: actually read the correct messages
|
|
||||||
$this->messages = data\message\MessageList::getNewestMessages($this->room, 150);
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,8 +21,16 @@
|
|||||||
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von {$suspension->revokerUsername}]]></item>
|
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von {$suspension->revokerUsername}]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
|
<category name="chat.acp.log">
|
||||||
|
<item name="chat.acp.log.title"><![CDATA[Nachrichten-Protokoll]]></item>
|
||||||
|
<item name="chat.acp.log.message"><![CDATA[Nachricht]]></item>
|
||||||
|
<item name="chat.acp.log.date.error.inFuture"><![CDATA[Das angegebene Datum befindet sich in der Zukunft.]]></item>
|
||||||
|
<item name="chat.acp.log.date.error.tooLongAgo"><![CDATA[Das angegebene Datum befindet sich außerhalb der protokollierten Zeitspanne von {CHAT_LOG_ARCHIVETIME / 1440|ceil} Tagen.]]></item>
|
||||||
|
</category>
|
||||||
|
|
||||||
<category name="chat.acp.menu">
|
<category name="chat.acp.menu">
|
||||||
<item name="chat.acp.menu.link"><![CDATA[Chat]]></item>
|
<item name="chat.acp.menu.link"><![CDATA[Chat]]></item>
|
||||||
|
<item name="chat.acp.menu.link.log"><![CDATA[Nachrichten-Protokoll]]></item>
|
||||||
<item name="chat.acp.menu.link.room.list"><![CDATA[Chaträume auflisten]]></item>
|
<item name="chat.acp.menu.link.room.list"><![CDATA[Chaträume auflisten]]></item>
|
||||||
<item name="chat.acp.menu.link.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
<item name="chat.acp.menu.link.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
||||||
<item name="chat.acp.menu.link.suspension.list"><![CDATA[Sanktionen auflisten]]></item>
|
<item name="chat.acp.menu.link.suspension.list"><![CDATA[Sanktionen auflisten]]></item>
|
||||||
|
Loading…
Reference in New Issue
Block a user