mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Merge remote-tracking branch 'origin/master' into invite
This commit is contained in:
commit
09fb08b633
@ -1,7 +1,6 @@
|
||||
language: php
|
||||
php:
|
||||
- 5.5
|
||||
- 5.4
|
||||
- 5.6
|
||||
- 5.3
|
||||
before_install:
|
||||
- pear config-set auto_discover 1
|
||||
@ -17,4 +16,4 @@ before_script:
|
||||
script:
|
||||
- find file -type f -name '*.php' |xargs -I file php -l file
|
||||
- phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" file
|
||||
- phpcpd --verbose --min-lines 10 file ; exit 0
|
||||
- phpcpd --verbose --min-lines 10 file || true
|
||||
|
@ -13,7 +13,7 @@
|
||||
{foreach from=$messages item="message"}
|
||||
<tr>
|
||||
<td class="columnID">{$message->messageID}</td>
|
||||
<td style="width: 1px !important;">{$message->time|date:"H:i:s"}</td>
|
||||
<td style="width: 1px !important;">{$message->time|date:"chat.global.timeFormat"}</td>
|
||||
<td class="columnIcon"><p class="framed">{@$message->getUserProfile()->getAvatar()->getImageTag(24)}</p></td>
|
||||
<td class="columnTitle columnUsername right" style="width: 1px !important;">{$message->username}</td>
|
||||
<td>{@$message->getFormattedMessage("text/simplified-html")}</td>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{foreach from=$messages item=$rawMessage}{*
|
||||
*}{assign var=message value=$rawMessage->jsonify(true)}{*
|
||||
*}({$message['time']|date:'H:i:s'}) {$message[username]|str_pad:15:' ':STR_PAD_LEFT}{$message[separator]} {$message[message]}
|
||||
*}({$message['time']|date:'chat.global.timeFormat'}) {$message[username]|str_pad:15:' ':STR_PAD_LEFT}{$message[separator]} {$message[message]}
|
||||
|
||||
{/foreach}
|
||||
|
@ -43,9 +43,9 @@ class MessageLogDownloadPage extends \wcf\page\AbstractPage {
|
||||
/**
|
||||
* given date
|
||||
*
|
||||
* @var integer
|
||||
* @var \DateTime
|
||||
*/
|
||||
public $date = 0;
|
||||
public $date = null;
|
||||
|
||||
/**
|
||||
* active room
|
||||
@ -69,11 +69,13 @@ class MessageLogDownloadPage extends \wcf\page\AbstractPage {
|
||||
public function readData() {
|
||||
parent::readData();
|
||||
|
||||
if ($this->date > TIME_NOW) {
|
||||
$now = new \DateTime('now', WCF::getUser()->getTimeZone());
|
||||
if ($this->date->getTimestamp() > $now->getTimestamp()) {
|
||||
throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
|
||||
if (CHAT_LOG_ARCHIVETIME !== -1 && $this->date < strtotime('today 00:00:00 -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day')) {
|
||||
$oldest = new \DateTime('today -'.ceil(CHAT_LOG_ARCHIVETIME / 1440).'day', WCF::getUser()->getTimeZone());
|
||||
if (CHAT_LOG_ARCHIVETIME !== -1 && $this->date->getTimestamp() < $oldest->getTimestamp()) {
|
||||
throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
|
||||
@ -85,7 +87,7 @@ public function readData() {
|
||||
$file = new \wcf\system\io\File($this->tmpFile);
|
||||
$file->write(WCF::getLanguage()->get('chat.acp.log.title') . ': ' . (string) $this->room . "\n");
|
||||
|
||||
for ($start = $this->date, $end = $start + 86399; $start < $end; $start += 1800) {
|
||||
for ($start = $this->date->getTimestamp(), $end = $this->date->add(\DateInterval::createFromDateString('1day'))->sub(\DateInterval::createFromDateString('1second'))->getTimestamp(); $start < $end; $start += 1800) {
|
||||
$file->write(WCF::getTpl()->fetch('messageLogDownload', 'chat', array('messages' => \chat\data\message\MessageList::getMessagesBetween($this->room, $start, $start + 1799))));
|
||||
}
|
||||
|
||||
@ -117,8 +119,12 @@ public function readParameters() {
|
||||
if (isset($_REQUEST['date'])) $date = $_REQUEST['date'].' 00:00:00';
|
||||
else $date = 'today 00:00:00';
|
||||
|
||||
$this->date = @strtotime($date);
|
||||
if ($this->date === false) throw new \wcf\system\exception\IllegalLinkException();
|
||||
try {
|
||||
$this->date = new \DateTime($date, WCF::getUser()->getTimeZone());
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,9 +133,7 @@ public function readParameters() {
|
||||
public function show() {
|
||||
parent::show();
|
||||
|
||||
$dateTime = \wcf\util\DateUtil::getDateTimeByTimestamp($this->date);
|
||||
|
||||
$fileReader = new \wcf\util\FileReader($this->tmpFile, array('mimeType' => 'text/plain', 'filename' => str_replace(' ', '-', WCF::getLanguage()->get('chat.acp.log.title') . ' ' . $this->room.'-'.\wcf\util\DateUtil::format($dateTime, 'Y-m-d').'.txt')));
|
||||
$fileReader = new \wcf\util\FileReader($this->tmpFile, array('mimeType' => 'text/plain', 'filename' => str_replace(' ', '-', WCF::getLanguage()->get('chat.acp.log.title') . ' ' . $this->room.'-'.\wcf\util\DateUtil::format($this->date, 'Y-m-d').'.txt')));
|
||||
$fileReader->send();
|
||||
|
||||
exit;
|
||||
|
@ -153,10 +153,12 @@ public function jsonify($raw = false) {
|
||||
break;
|
||||
}
|
||||
|
||||
$time = \wcf\util\DateUtil::getDateTimeByTimestamp($this->time);
|
||||
$startOfDay = new \DateTime('today', WCF::getUser()->getTimezone());
|
||||
$array = array(
|
||||
'formattedUsername' => $this->getUsername(true),
|
||||
'formattedMessage' => $this->getFormattedMessage('text/html'),
|
||||
'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'),
|
||||
'formattedTime' => ($time->getTimestamp() < $startOfDay->getTimestamp() ? \wcf\util\DateUtil::format($time, 'chat.global.dateFormat').' ' : '').\wcf\util\DateUtil::format($time, 'chat.global.timeFormat'),
|
||||
'separator' => $separator,
|
||||
'message' => $this->getFormattedMessage('text/plain'),
|
||||
'sender' => (int) $this->sender,
|
||||
|
@ -69,16 +69,12 @@ public function prune() {
|
||||
WHERE
|
||||
permanent = ?
|
||||
AND roomID NOT IN (
|
||||
SELECT
|
||||
fieldValue AS roomID
|
||||
FROM
|
||||
wcf".WCF_N."_user_storage
|
||||
WHERE
|
||||
field = ?
|
||||
AND fieldValue IS NOT NULL
|
||||
SELECT chatRoomID
|
||||
FROM wcf".WCF_N."_user
|
||||
WHERE chatRoomID IS NOT NULL
|
||||
)";
|
||||
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute(array(0, 'roomID'));
|
||||
$stmt->execute(array(0));
|
||||
$objectIDs = array();
|
||||
|
||||
while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID;
|
||||
|
@ -134,7 +134,7 @@ public function readData() {
|
||||
}
|
||||
|
||||
if (MODULE_ATTACHMENT) {
|
||||
$this->attachmentHandler = new \wcf\system\attachment\AttachmentHandler('be.bastelstu.chat.message', 0, '', 0);
|
||||
$this->attachmentHandler = new \wcf\system\attachment\AttachmentHandler('be.bastelstu.chat.message', 0, \wcf\util\StringUtil::getRandomID(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,9 @@ public function init(\wcf\data\dashboard\box\DashboardBox $box, \wcf\page\IPage
|
||||
* @see wcf\system\dashboard\box\AbstractContentDashboardBox::render()
|
||||
*/
|
||||
protected function render() {
|
||||
if (!MODULE_CHAT) return false;
|
||||
if (!\wcf\system\WCF::getUser()->userID) return false;
|
||||
|
||||
\wcf\system\WCF::getTPL()->assign(array(
|
||||
'rooms' => $this->rooms
|
||||
));
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace chat\util;
|
||||
use \wcf\data\package\PackageCache;
|
||||
use \wcf\system\user\storage\UserStorageHandler;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
|
@ -198,6 +198,9 @@ Probieren Sie, den Chat neu zu laden<!-- , bei Risiken und Nebenwirkungen fragen
|
||||
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}Sie befinden sich in einem privaten Kanal mit „{$username}“.{/literal}]]></item>
|
||||
<item name="chat.global.closePrivateChannel"><![CDATA[Privaten Kanal schließen]]></item>
|
||||
<item name="chat.global.closeTopic"><![CDATA[Thema ausblenden]]></item>
|
||||
|
||||
<item name="chat.global.timeFormat"><![CDATA[H:i:s]]></item>
|
||||
<item name="chat.global.dateFormat"><![CDATA[Y-m-d]]></item>
|
||||
</category>
|
||||
|
||||
<category name="chat.header">
|
||||
|
@ -198,6 +198,9 @@ Please try to reload the chat.]]></item>
|
||||
<item name="chat.global.privateChannelTopic"><![CDATA[{literal}You are in a private conversation with “{$username}”{/literal}]]></item>
|
||||
<item name="chat.global.closePrivateChannel"><![CDATA[Close Private Conversation]]></item>
|
||||
<item name="chat.global.closeTopic"><![CDATA[Hide Topic]]></item>
|
||||
|
||||
<item name="chat.global.timeFormat"><![CDATA[g:i:sa]]></item>
|
||||
<item name="chat.global.dateFormat"><![CDATA[Y-m-d]]></item>
|
||||
</category>
|
||||
|
||||
<category name="chat.header">
|
||||
|
Loading…
Reference in New Issue
Block a user