mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Merge branch 'app'
Conflicts: file/icon/chatColored.svg
This commit is contained in:
commit
8c151106c3
@ -3,42 +3,42 @@
|
|||||||
<import>
|
<import>
|
||||||
<categories>
|
<categories>
|
||||||
<category name="user">
|
<category name="user">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
</category>
|
</category>
|
||||||
<category name="mod">
|
<category name="mod">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
</category>
|
</category>
|
||||||
</categories>
|
</categories>
|
||||||
|
|
||||||
<options>
|
<options>
|
||||||
<option name="user.canEnter">
|
<option name="user.canEnter">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>user</categoryname>
|
<categoryname>user</categoryname>
|
||||||
</option>
|
</option>
|
||||||
<option name="user.canWrite">
|
<option name="user.canWrite">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>user</categoryname>
|
<categoryname>user</categoryname>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
|
||||||
<option name="mod.canAlwaysEnter">
|
<option name="mod.canAlwaysEnter">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>mod</categoryname>
|
<categoryname>mod</categoryname>
|
||||||
</option>
|
</option>
|
||||||
<option name="mod.canAlwaysWrite">
|
<option name="mod.canAlwaysWrite">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>mod</categoryname>
|
<categoryname>mod</categoryname>
|
||||||
</option>
|
</option>
|
||||||
<option name="mod.canMute">
|
<option name="mod.canMute">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>mod</categoryname>
|
<categoryname>mod</categoryname>
|
||||||
</option>
|
</option>
|
||||||
<option name="mod.canBan">
|
<option name="mod.canBan">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>mod</categoryname>
|
<categoryname>mod</categoryname>
|
||||||
</option>
|
</option>
|
||||||
<option name="mod.canReadLog">
|
<option name="mod.canReadLog">
|
||||||
<objecttype>be.bastelstu.wcf.chat.room</objecttype>
|
<objecttype>be.bastelstu.chat.room</objecttype>
|
||||||
<categoryname>mod</categoryname>
|
<categoryname>mod</categoryname>
|
||||||
</option>
|
</option>
|
||||||
</options>
|
</options>
|
||||||
|
22
acpMenu.xml
22
acpMenu.xml
@ -1,21 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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/acpMenu.xsd">
|
<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/acpMenu.xsd">
|
||||||
<import>
|
<import>
|
||||||
<acpmenuitem name="wcf.acp.menu.link.chat">
|
<acpmenuitem name="chat.acp.menu.link">
|
||||||
<parent>wcf.acp.menu.link.community</parent>
|
<parent>wcf.acp.menu.link.community</parent>
|
||||||
</acpmenuitem>
|
</acpmenuitem>
|
||||||
|
|
||||||
<acpmenuitem name="wcf.acp.menu.link.chat.room.list">
|
<acpmenuitem name="chat.acp.menu.link.chat">
|
||||||
<controller><![CDATA[wcf\acp\page\ChatRoomListPage]]></controller>
|
<parent>chat.acp.menu.link</parent>
|
||||||
<parent>wcf.acp.menu.link.chat</parent>
|
</acpmenuitem>
|
||||||
<permissions>admin.content.chat.canEditRoom,admin.content.chat.canDeleteRoom</permissions>
|
|
||||||
|
<acpmenuitem name="chat.acp.menu.link.room.list">
|
||||||
|
<controller><![CDATA[chat\acp\page\RoomListPage]]></controller>
|
||||||
|
<parent>chat.acp.menu.link.chat</parent>
|
||||||
|
<permissions>admin.chat.canEditRoom,admin.chat.canDeleteRoom</permissions>
|
||||||
<showorder>1</showorder>
|
<showorder>1</showorder>
|
||||||
</acpmenuitem>
|
</acpmenuitem>
|
||||||
|
|
||||||
<acpmenuitem name="wcf.acp.menu.link.chat.room.add">
|
<acpmenuitem name="chat.acp.menu.link.room.add">
|
||||||
<controller><![CDATA[wcf\acp\form\ChatRoomAddForm]]></controller>
|
<controller><![CDATA[chat\acp\form\RoomAddForm]]></controller>
|
||||||
<parent>wcf.acp.menu.link.chat</parent>
|
<parent>chat.acp.menu.link.chat</parent>
|
||||||
<permissions>admin.content.chat.canAddRoom</permissions>
|
<permissions>admin.chat.canAddRoom</permissions>
|
||||||
<showorder>2</showorder>
|
<showorder>2</showorder>
|
||||||
</acpmenuitem>
|
</acpmenuitem>
|
||||||
</import>
|
</import>
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
{include file='header' pageTitle='wcf.acp.chat.room.list'}
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
//<![CDATA[
|
|
||||||
$(function() {
|
|
||||||
new WCF.Action.Delete('\\wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow'));
|
|
||||||
new WCF.Sortable.List('chatRoomList', '\\wcf\\data\\chat\\room\\ChatRoomAction', {@$startIndex-1});
|
|
||||||
});
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="boxHeadline">
|
|
||||||
<hgroup>
|
|
||||||
<h1>{lang}wcf.acp.chat.room.list{/lang}</h1>
|
|
||||||
</hgroup>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="contentNavigation">
|
|
||||||
{pages print=true assign=pagesLinks controller="ChatRoomList" link="pageNo=%d"}
|
|
||||||
|
|
||||||
{if $__wcf->session->getPermission('admin.content.chat.canAddRoom')}
|
|
||||||
<nav>
|
|
||||||
<ul>
|
|
||||||
<li><a href="{link controller='ChatRoomAdd'}{/link}" title="{lang}wcf.acp.chat.room.add{/lang}" class="button"><img src="{@$__wcf->getPath('wcf')}icon/add.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.chat.room.add{/lang}</span></a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{hascontent}
|
|
||||||
<section id="chatRoomList" class="container containerPadding sortableListContainer marginTop shadow">
|
|
||||||
<ol class="sortableList" data-object-id="0" start="{$startIndex}">
|
|
||||||
{content}
|
|
||||||
{foreach from=$objects item=chatRoom}
|
|
||||||
<li class="sortableNode sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}">
|
|
||||||
<span class="sortableNodeLabel">
|
|
||||||
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}
|
|
||||||
<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a>
|
|
||||||
{else}
|
|
||||||
{$chatRoom->title|language}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<span class="statusDisplay sortableButtonContainer">
|
|
||||||
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}
|
|
||||||
<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}"><img src="{@$__wcf->getPath('wcf')}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip icon16" /></a>
|
|
||||||
{/if}
|
|
||||||
{if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')}
|
|
||||||
<img src="{@$__wcf->getPath('wcf')}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip icon16" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}wcf.acp.chat.delete.sure{/lang}" />
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<ol class="sortableList" data-object-id="{@$chatRoom->roomID}"></ol></li>
|
|
||||||
</li>
|
|
||||||
{/foreach}
|
|
||||||
{/content}
|
|
||||||
</ol>
|
|
||||||
<div class="formSubmit">
|
|
||||||
<button class="button" data-type="submit">{lang}wcf.global.button.submit{/lang}</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{hascontentelse}
|
|
||||||
<p class="warning">{lang}wcf.acp.chat.room.noneAvailable{/lang}</p>
|
|
||||||
{/hascontent}
|
|
||||||
|
|
||||||
|
|
||||||
{include file='footer'}
|
|
@ -1,15 +1,9 @@
|
|||||||
{include file='header' pageTitle='wcf.acp.chat.room.'|concat:$action}
|
{include file='header' pageTitle='chat.acp.room.'|concat:$action}
|
||||||
|
|
||||||
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script>
|
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
$(function() {
|
$(function() {
|
||||||
WCF.Icon.addObject({
|
|
||||||
'wcf.icon.delete': '{@$__wcf->getPath('wcf')}icon/delete.svg',
|
|
||||||
'wcf.icon.user': '{@$__wcf->getPath('wcf')}icon/user.svg',
|
|
||||||
'wcf.icon.users': '{@$__wcf->getPath('wcf')}icon/users.svg'
|
|
||||||
});
|
|
||||||
|
|
||||||
new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if});
|
new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if});
|
||||||
});
|
});
|
||||||
//]]>
|
//]]>
|
||||||
@ -17,7 +11,7 @@
|
|||||||
|
|
||||||
<header class="boxHeadline">
|
<header class="boxHeadline">
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h1>{lang}wcf.acp.chat.room.{$action}{/lang}</h1>
|
<h1>{lang}chat.acp.room.{$action}{/lang}</h1>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -32,18 +26,18 @@
|
|||||||
<div class="contentNavigation">
|
<div class="contentNavigation">
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{link controller='ChatRoomList'}{/link}" title="{lang}wcf.acp.menu.link.chat.room.list{/lang}" class="button"><img src="{@$__wcf->getPath('wcf')}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.chat.room.list{/lang}</span></a></li>
|
<li><a href="{link application='chat' controller='RoomList'}{/link}" title="{lang}chat.acp.menu.link.room.list{/lang}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}chat.acp.menu.link.room.list{/lang}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="post" action="{if $action == 'add'}{link controller='ChatRoomAdd'}{/link}{else}{link controller='ChatRoomEdit' id=$roomID}{/link}{/if}">
|
<form method="post" action="{if $action == 'add'}{link application='chat' controller='RoomAdd'}{/link}{else}{link application='chat' controller='roomEdit' id=$roomID}{/link}{/if}">
|
||||||
<div class="container containerPadding sortableListContainer marginTop shadow">
|
<div class="container containerPadding sortableListContainer marginTop shadow">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{lang}wcf.acp.chat.room.data{/lang}</legend>
|
<legend>{lang}chat.acp.room.data{/lang}</legend>
|
||||||
|
|
||||||
<dl{if $errorField == 'title'} class="formError"{/if}>
|
<dl{if $errorField == 'title'} class="formError"{/if}>
|
||||||
<dt><label for="title">{lang}wcf.acp.chat.room.title{/lang}</label></dt>
|
<dt><label for="title">{lang}chat.acp.room.title{/lang}</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="title" name="title" value="{$title}" autofocus="autofocus" class="long" />
|
<input type="text" id="title" name="title" value="{$title}" autofocus="autofocus" class="long" />
|
||||||
{if $errorField == 'title'}
|
{if $errorField == 'title'}
|
||||||
@ -51,17 +45,17 @@
|
|||||||
{if $errorType == 'empty'}
|
{if $errorType == 'empty'}
|
||||||
{lang}wcf.global.form.error.empty{/lang}
|
{lang}wcf.global.form.error.empty{/lang}
|
||||||
{else}
|
{else}
|
||||||
{lang}wcf.acp.chat.room.title.error.{@$errorType}{/lang}
|
{lang}chat.acp.room.title.error.{@$errorType}{/lang}
|
||||||
{/if}
|
{/if}
|
||||||
</small>
|
</small>
|
||||||
{/if}
|
{/if}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{include file='multipleLanguageInputJavascript' elementIdentifier='title'}
|
{include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection=false}
|
||||||
|
|
||||||
<dl{if $errorField == 'topic'} class="formError"{/if}>
|
<dl{if $errorField == 'topic'} class="formError"{/if}>
|
||||||
<dt><label for="topic">{lang}wcf.acp.chat.room.topic{/lang}</label></dt>
|
<dt><label for="topic">{lang}chat.acp.room.topic{/lang}</label></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="topic" name="topic" value="{$topic}" class="long" />
|
<input type="text" id="topic" name="topic" value="{$topic}" class="long" />
|
||||||
{if $errorField == 'topic'}
|
{if $errorField == 'topic'}
|
||||||
@ -69,14 +63,14 @@
|
|||||||
{if $errorType == 'empty'}
|
{if $errorType == 'empty'}
|
||||||
{lang}wcf.global.form.error.empty{/lang}
|
{lang}wcf.global.form.error.empty{/lang}
|
||||||
{else}
|
{else}
|
||||||
{lang}wcf.acp.chat.room.topic.error.{@$errorType}{/lang}
|
{lang}chat.acp.room.topic.error.{@$errorType}{/lang}
|
||||||
{/if}
|
{/if}
|
||||||
</small>
|
</small>
|
||||||
{/if}
|
{/if}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{include file='multipleLanguageInputJavascript' elementIdentifier='topic'}
|
{include file='multipleLanguageInputJavascript' elementIdentifier='topic' forceSelection=false}
|
||||||
|
|
||||||
<dl id="groupPermissions">
|
<dl id="groupPermissions">
|
||||||
<dt>{lang}wcf.acp.acl.permissions{/lang}</dt>
|
<dt>{lang}wcf.acp.acl.permissions{/lang}</dt>
|
62
acptemplate/roomList.tpl
Normal file
62
acptemplate/roomList.tpl
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{include file='header' pageTitle='chat.acp.room.list'}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
$(function() {
|
||||||
|
new WCF.Action.Delete('\\chat\\data\\room\\RoomAction', $('.chatRoomRow'));
|
||||||
|
new WCF.Sortable.List('roomList', '\\chat\\data\\room\\RoomAction', {@$startIndex-1});
|
||||||
|
});
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="boxHeadline">
|
||||||
|
<hgroup>
|
||||||
|
<h1>{lang}chat.acp.room.list{/lang}</h1>
|
||||||
|
</hgroup>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="contentNavigation">
|
||||||
|
{if $__wcf->session->getPermission('admin.chat.canAddRoom')}
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{link application='chat' controller='roomAdd'}{/link}" title="{lang}chat.acp.room.add{/lang}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}chat.acp.room.add{/lang}</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{hascontent}
|
||||||
|
<section id="roomList" class="container containerPadding sortableListContainer marginTop shadow">
|
||||||
|
<ol class="sortableList" data-object-id="0" start="{$startIndex}">
|
||||||
|
{content}
|
||||||
|
{foreach from=$objects item=chatRoom}
|
||||||
|
<li class="sortableNode sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}">
|
||||||
|
<span class="sortableNodeLabel">
|
||||||
|
{if $__wcf->session->getPermission('admin.chat.canEditRoom')}
|
||||||
|
<a href="{link application='chat' controller='roomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a>
|
||||||
|
{else}
|
||||||
|
{$chatRoom->title|language}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<span class="statusDisplay sortableButtonContainer">
|
||||||
|
{if $__wcf->session->getPermission('admin.chat.canEditRoom')}
|
||||||
|
<a href="{link application='chat' controller='roomEdit' id=$chatRoom->roomID}{/link}"><span title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip icon icon16 icon-edit" /></a>
|
||||||
|
{/if}
|
||||||
|
{if $__wcf->session->getPermission('admin.chat.canDeleteRoom')}
|
||||||
|
<span title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip icon icon16 icon-remove" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}chat.acp.room.delete.sure{/lang}" />
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<ol class="sortableList" data-object-id="{@$chatRoom->roomID}"></ol></li>
|
||||||
|
</li>
|
||||||
|
{/foreach}
|
||||||
|
{/content}
|
||||||
|
</ol>
|
||||||
|
<div class="formSubmit">
|
||||||
|
<button class="button" data-type="submit">{lang}wcf.global.button.submit{/lang}</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{hascontentelse}
|
||||||
|
<p class="warning">{lang}chat.acp.room.noneAvailable{/lang}</p>
|
||||||
|
{/hascontent}
|
||||||
|
|
||||||
|
{include file='footer'}
|
@ -5,9 +5,9 @@
|
|||||||
* Builds the Chat
|
* Builds the Chat
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
*/
|
*/
|
||||||
$packageXML = file_get_contents('package.xml');
|
$packageXML = file_get_contents('package.xml');
|
||||||
preg_match('/<version>(.*?)<\/version>/', $packageXML, $matches);
|
preg_match('/<version>(.*?)<\/version>/', $packageXML, $matches);
|
||||||
@ -26,10 +26,10 @@
|
|||||||
if (file_exists('file.tar')) unlink('file.tar');
|
if (file_exists('file.tar')) unlink('file.tar');
|
||||||
if (file_exists('template.tar')) unlink('template.tar');
|
if (file_exists('template.tar')) unlink('template.tar');
|
||||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
foreach (glob('file/acp/be.bastelstu.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
||||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||||
if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar');
|
if (file_exists('be.bastelstu.chat.tar')) unlink('be.bastelstu.chat.tar');
|
||||||
echo <<<EOT
|
echo <<<EOT
|
||||||
|
|
||||||
Building JavaScript
|
Building JavaScript
|
||||||
@ -41,7 +41,7 @@
|
|||||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
||||||
if ($code != 0) exit($code);
|
if ($code != 0) exit($code);
|
||||||
}
|
}
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.coffee') as $coffeeFile) {
|
foreach (glob('file/acp/be.bastelstu.chat.nodePush/lib/*.coffee') as $coffeeFile) {
|
||||||
echo $coffeeFile."\n";
|
echo $coffeeFile."\n";
|
||||||
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
passthru('coffee -cb '.escapeshellarg($coffeeFile), $code);
|
||||||
if ($code != 0) exit($code);
|
if ($code != 0) exit($code);
|
||||||
@ -108,14 +108,14 @@
|
|||||||
if ($code != 0) exit($code);
|
if ($code != 0) exit($code);
|
||||||
echo <<<EOT
|
echo <<<EOT
|
||||||
|
|
||||||
Building be.bastelstu.wcf.chat.tar
|
Building be.bastelstu.chat.tar
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
chdir('..');
|
chdir('..');
|
||||||
file_put_contents('package.xml.old', file_get_contents('package.xml'));
|
file_put_contents('package.xml.old', file_get_contents('package.xml'));
|
||||||
file_put_contents('package.xml', preg_replace('~<date>\d{4}-\d{2}-\d{2}</date>~', '<date>'.date('Y-m-d').'</date>', file_get_contents('package.xml')));
|
file_put_contents('package.xml', preg_replace('~<date>\d{4}-\d{2}-\d{2}</date>~', '<date>'.date('Y-m-d').'</date>', file_get_contents('package.xml')));
|
||||||
passthru('tar cvf be.bastelstu.wcf.chat.tar * --exclude=*.old --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code);
|
passthru('tar cvf be.bastelstu.chat.tar * --exclude=*.old --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code);
|
||||||
if (file_exists('package.xml.old')) {
|
if (file_exists('package.xml.old')) {
|
||||||
file_put_contents('package.xml', file_get_contents('package.xml.old'));
|
file_put_contents('package.xml', file_get_contents('package.xml.old'));
|
||||||
unlink('package.xml.old');
|
unlink('package.xml.old');
|
||||||
@ -125,6 +125,6 @@
|
|||||||
if (file_exists('file.tar')) unlink('file.tar');
|
if (file_exists('file.tar')) unlink('file.tar');
|
||||||
if (file_exists('template.tar')) unlink('template.tar');
|
if (file_exists('template.tar')) unlink('template.tar');
|
||||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||||
foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
foreach (glob('file/acp/be.bastelstu.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
|
||||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
<!--
|
<!--
|
||||||
@author Maximilian Mader
|
@author Maximilian Mader
|
||||||
@copyright 2011 Tim Düsterhus
|
@copyright 2011 - 2013 Tim Düsterhus
|
||||||
@license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
@license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
@package be.bastelstu.wcf.chat
|
@package be.bastelstu.chat
|
||||||
-->
|
-->
|
||||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve">
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" xml:space="preserve">
|
||||||
<title>Chat</title>
|
<title>Chat</title>
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -2,7 +2,7 @@
|
|||||||
<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/cronjob.xsd">
|
<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/cronjob.xsd">
|
||||||
<import>
|
<import>
|
||||||
<cronjob>
|
<cronjob>
|
||||||
<classname>wcf\system\cronjob\ChatCleanupCronjob</classname>
|
<classname>chat\system\cronjob\CleanupCronjob</classname>
|
||||||
<description>Cleans up Tims Chat</description>
|
<description>Cleans up Tims Chat</description>
|
||||||
<startminute>*/15</startminute>
|
<startminute>*/15</startminute>
|
||||||
<starthour>*</starthour>
|
<starthour>*</starthour>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<eventname>didInit</eventname>
|
<eventname>didInit</eventname>
|
||||||
<environment>user</environment>
|
<environment>user</environment>
|
||||||
<inherit>0</inherit>
|
<inherit>0</inherit>
|
||||||
<listenerclassname>wcf\system\event\listener\ChatRouteListener</listenerclassname>
|
<listenerclassname>chat\system\event\listener\RouteHandlerListener</listenerclassname>
|
||||||
</eventlistener>
|
</eventlistener>
|
||||||
</import>
|
</import>
|
||||||
</data>
|
</data>
|
@ -5,9 +5,9 @@
|
|||||||
* Handles installation of Tims Chat.
|
* Handles installation of Tims Chat.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
*/
|
*/
|
||||||
// @codingStandardsIgnoreFile
|
// @codingStandardsIgnoreFile
|
||||||
final class Install {
|
final class Install {
|
0
file/acp/be.bastelstu.wcf.chat.nodePush/bin/run.sh → file/acp/be.bastelstu.chat.nodePush/bin/run.sh
Executable file → Normal file
0
file/acp/be.bastelstu.wcf.chat.nodePush/bin/run.sh → file/acp/be.bastelstu.chat.nodePush/bin/run.sh
Executable file → Normal file
@ -2,9 +2,9 @@
|
|||||||
# node.js Pushserver for Tims Chat.
|
# node.js Pushserver for Tims Chat.
|
||||||
#
|
#
|
||||||
# @author Tim Düsterhus
|
# @author Tim Düsterhus
|
||||||
# @copyright 2010-2012 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>
|
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
# @package be.bastelstu.wcf.chat
|
# @package be.bastelstu.chat
|
||||||
# @subpackage nodePush
|
# @subpackage nodePush
|
||||||
###
|
###
|
||||||
process.title = 'nodePush - Tims Chat'
|
process.title = 'nodePush - Tims Chat'
|
||||||
@ -16,7 +16,7 @@ fs = require 'fs'
|
|||||||
config = require('../config.js')
|
config = require('../config.js')
|
||||||
|
|
||||||
log = (message) ->
|
log = (message) ->
|
||||||
console.log '[be.bastelstu.wcf.chat.nodePush] '+message
|
console.log '[be.bastelstu.chat.nodePush] '+message
|
||||||
|
|
||||||
class Server
|
class Server
|
||||||
constructor: () ->
|
constructor: () ->
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name" : "be.bastelstu.wcf.chat.nodePush",
|
"name" : "be.bastelstu.chat.nodePush",
|
||||||
"description" : "node.js-Pushing for Tims Chat",
|
"description" : "node.js-Pushing for Tims Chat",
|
||||||
"homepage" : "https://github.com/wbbaddons/Tims-Chat",
|
"homepage" : "https://github.com/wbbaddons/Tims-Chat",
|
||||||
"keywords" : ["chat"],
|
"keywords" : ["chat"],
|
||||||
"author" : "Tim Düsterhus <timwolla@googlemail.com>",
|
"author" : "Tim Düsterhus <timwolla@googlemail.com>",
|
||||||
"contributors" : [
|
"contributors" : [
|
||||||
],
|
],
|
||||||
"dependencies" : {
|
"dependencies" : {
|
@ -5,9 +5,9 @@
|
|||||||
* Handles updates of Tims Chat.
|
* Handles updates of Tims Chat.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
*/
|
*/
|
||||||
// @codingStandardsIgnoreFile
|
// @codingStandardsIgnoreFile
|
||||||
final class Update {
|
final class Update {
|
||||||
@ -26,7 +26,7 @@ final class Update {
|
|||||||
private $styles = null;
|
private $styles = null;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rooms = \wcf\data\chat\room\ChatRoom::getCache();
|
$this->rooms = \chat\data\room\Room::getCache();
|
||||||
$this->styles = \wcf\system\style\StyleHandler::getInstance()->getAvailableStyles();
|
$this->styles = \wcf\system\style\StyleHandler::getInstance()->getAvailableStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,11 +36,11 @@ public function __construct() {
|
|||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
foreach ($this->rooms as $room) {
|
foreach ($this->rooms as $room) {
|
||||||
$messageAction = new \wcf\data\chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new \chat\data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $room->roomID,
|
'roomID' => $room->roomID,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION,
|
'type' => \chat\data\message\Message::TYPE_INFORMATION,
|
||||||
'message' => \wcf\system\WCF::getLanguage()->get('wcf.chat.information.chatUpdate')
|
'message' => \wcf\system\WCF::getLanguage()->get('wcf.chat.information.chatUpdate')
|
||||||
)
|
)
|
||||||
));
|
));
|
@ -1,3 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
port: 9001
|
|
||||||
}
|
|
15
file/acp/global.php
Normal file
15
file/acp/global.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
// define paths
|
||||||
|
define('RELATIVE_CHAT_DIR', '../');
|
||||||
|
|
||||||
|
// include config
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/config.inc.php');
|
||||||
|
|
||||||
|
// include WCF
|
||||||
|
require_once(RELATIVE_WCF_DIR.'acp/global.php');
|
9
file/acp/index.php
Normal file
9
file/acp/index.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
require_once(__DIR__.'/global.php');
|
||||||
|
wcf\system\request\RequestHandler::getInstance()->handle('chat', true);
|
12
file/global.php
Normal file
12
file/global.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
// include config
|
||||||
|
require_once(__DIR__.'/config.inc.php');
|
||||||
|
|
||||||
|
// include wcf
|
||||||
|
require_once(RELATIVE_WCF_DIR.'global.php');
|
9
file/index.php
Normal file
9
file/index.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
require_once(__DIR__.'/global.php');
|
||||||
|
wcf\system\request\RequestHandler::getInstance()->handle('chat');
|
@ -2,13 +2,13 @@
|
|||||||
# be.bastelstu.WCF.Chat.Log
|
# be.bastelstu.WCF.Chat.Log
|
||||||
#
|
#
|
||||||
# @author Tim Düsterhus
|
# @author Tim Düsterhus
|
||||||
# @copyright 2010-2012 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>
|
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
# @package be.bastelstu.wcf.chat
|
# @package be.bastelstu.chat
|
||||||
###
|
###
|
||||||
|
|
||||||
(($, window) ->
|
(($, window) ->
|
||||||
be.bastelstu.WCF.Chat.Log = be.bastelstu.WCF.Chat.extend
|
be.bastelstu.Chat.Log = be.bastelstu.Chat.extend
|
||||||
init: (@chat) ->
|
init: (@chat) ->
|
||||||
handleMessages: (messages) ->
|
handleMessages: (messages) ->
|
||||||
# Insert the messages
|
# Insert the messages
|
||||||
@ -23,11 +23,12 @@
|
|||||||
|
|
||||||
li.appendTo $ '#timsChatLog .timsChatMessageContainer > ul'
|
li.appendTo $ '#timsChatLog .timsChatMessageContainer > ul'
|
||||||
|
|
||||||
be.bastelstu.WCF.Chat.Log.loadOverlay = () ->
|
be.bastelstu.Chat.Log.loadOverlay = () ->
|
||||||
if !$.wcfIsset 'timsChatLogDialog'
|
if !$.wcfIsset 'timsChatLogDialog'
|
||||||
container = $ '<fieldset id="timsChatLogDialog"></fieldset>'
|
container = $ '<fieldset id="timsChatLogDialog"></fieldset>'
|
||||||
$('#content').append container
|
$('#content').append container
|
||||||
|
|
||||||
|
# TODO: Proper path
|
||||||
$('#timsChatLogDialog').load 'http://127.0.0.1/wbb/wbb4/index.php/Chat/Log/1-Hauptchat/', () ->
|
$('#timsChatLogDialog').load 'http://127.0.0.1/wbb/wbb4/index.php/Chat/Log/1-Hauptchat/', () ->
|
||||||
WCF.showDialog 'timsChatLogDialog',
|
WCF.showDialog 'timsChatLogDialog',
|
||||||
title: 'Log'
|
title: 'Log'
|
@ -2,9 +2,9 @@
|
|||||||
# be.bastelstu.WCF.Chat
|
# be.bastelstu.WCF.Chat
|
||||||
#
|
#
|
||||||
# @author Tim Düsterhus
|
# @author Tim Düsterhus
|
||||||
# @copyright 2010-2012 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>
|
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
# @package be.bastelstu.wcf.chat
|
# @package be.bastelstu.chat
|
||||||
###
|
###
|
||||||
|
|
||||||
window.console ?=
|
window.console ?=
|
||||||
@ -15,18 +15,17 @@ window.console ?=
|
|||||||
(($, window, _console) ->
|
(($, window, _console) ->
|
||||||
window.be ?= {}
|
window.be ?= {}
|
||||||
be.bastelstu ?= {}
|
be.bastelstu ?= {}
|
||||||
be.bastelstu.WCF ?= {}
|
|
||||||
|
|
||||||
console =
|
console =
|
||||||
log: (message) ->
|
log: (message) ->
|
||||||
_console.log '[be.bastelstu.WCF.Chat] '+message
|
_console.log "[be.bastelstu.Chat] #{message}"
|
||||||
warn: (message) ->
|
warn: (message) ->
|
||||||
_console.warn '[be.bastelstu.WCF.Chat] '+message
|
_console.warn "[be.bastelstu.Chat] #{message}"
|
||||||
error: (message) ->
|
error: (message) ->
|
||||||
_console.error '[be.bastelstu.WCF.Chat] '+message
|
_console.error "[be.bastelstu.Chat] #{message}"
|
||||||
|
|
||||||
|
|
||||||
be.bastelstu.WCF.Chat = Class.extend
|
be.bastelstu.Chat = Class.extend
|
||||||
# Tims Chat stops loading when this reaches zero
|
# Tims Chat stops loading when this reaches zero
|
||||||
# TODO: We need an explosion animation
|
# TODO: We need an explosion animation
|
||||||
shields: 3
|
shields: 3
|
||||||
@ -156,13 +155,13 @@ window.console ?=
|
|||||||
toComplete = toComplete.substring 0, nextSpace
|
toComplete = toComplete.substring 0, nextSpace
|
||||||
|
|
||||||
return if toComplete.length is 0
|
return if toComplete.length is 0
|
||||||
console.log 'Autocompleting "' + toComplete + '"'
|
console.log "Autocompleting '#{toComplete}'"
|
||||||
|
|
||||||
# Insert name and increment offset
|
# Insert name and increment offset
|
||||||
name = @autocomplete toComplete
|
name = @autocomplete toComplete
|
||||||
|
|
||||||
$('#timsChatInput').val beforeComplete + name + ' ' + afterComplete
|
$('#timsChatInput').val "#{beforeComplete}#{name} #{afterComplete}"
|
||||||
$('#timsChatInput').setCaret((beforeComplete + name).length + 1);
|
$('#timsChatInput').setCaret (beforeComplete + name).length + 1
|
||||||
@autocompleteOffset++
|
@autocompleteOffset++
|
||||||
else
|
else
|
||||||
@autocompleteOffset = 0
|
@autocompleteOffset = 0
|
||||||
@ -177,7 +176,22 @@ window.console ?=
|
|||||||
, @
|
, @
|
||||||
|
|
||||||
# Refreshes the roomlist
|
# Refreshes the roomlist
|
||||||
$('#timsChatRoomList button').click $.proxy(@refreshRoomList, @)
|
$('#timsChatRoomList button').click $.proxy @refreshRoomList, @
|
||||||
|
|
||||||
|
# Toggle Buttons
|
||||||
|
$('.timsChatToggle').click (event) ->
|
||||||
|
element = $ @
|
||||||
|
icon = element.find 'span.icon'
|
||||||
|
if element.data('status') is 1
|
||||||
|
element.data 'status', 0
|
||||||
|
icon.removeClass('icon-circle-blank').addClass('icon-off')
|
||||||
|
element.attr 'title', element.data 'enableMessage'
|
||||||
|
else
|
||||||
|
element.data 'status', 1
|
||||||
|
icon.removeClass('icon-off').addClass('icon-circle-blank')
|
||||||
|
element.attr 'title', element.data 'disableMessage'
|
||||||
|
|
||||||
|
$('#timsChatInput').focus()
|
||||||
|
|
||||||
# Clears the stream
|
# Clears the stream
|
||||||
$('#timsChatClear').click (event) ->
|
$('#timsChatClear').click (event) ->
|
||||||
@ -186,20 +200,11 @@ window.console ?=
|
|||||||
@oldScrollTop = null
|
@oldScrollTop = null
|
||||||
$('#timsChatMessageContainer').scrollTop $('#timsChatMessageContainer ul').height()
|
$('#timsChatMessageContainer').scrollTop $('#timsChatMessageContainer ul').height()
|
||||||
|
|
||||||
# Toggle Buttons
|
$('#timsChatSmilies.click (event) ->
|
||||||
$('.timsChatToggle').click (event) ->
|
if $(@).data 'status'
|
||||||
element = $ @
|
$('#smilies').removeClass 'disabled'
|
||||||
icon = element.find 'img'
|
|
||||||
if element.data('status') is 1
|
|
||||||
element.data 'status', 0
|
|
||||||
icon.attr 'src', icon.attr('src').replace /enabled(.*).svg$/, 'disabled$1.svg'
|
|
||||||
element.attr 'title', element.data 'enableMessage'
|
|
||||||
else
|
else
|
||||||
element.data 'status', 1
|
$('#smilies').addClass 'disabled'
|
||||||
icon.attr 'src', icon.attr('src').replace /disabled(.*).svg$/, 'enabled$1.svg'
|
|
||||||
element.attr 'title', element.data 'disableMessage'
|
|
||||||
|
|
||||||
$('#timsChatInput').focus()
|
|
||||||
|
|
||||||
# Enable fullscreen-mode
|
# Enable fullscreen-mode
|
||||||
$('#timsChatFullscreen').click (event) ->
|
$('#timsChatFullscreen').click (event) ->
|
||||||
@ -234,9 +239,9 @@ window.console ?=
|
|||||||
data:
|
data:
|
||||||
ajax: 1
|
ajax: 1
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
success: $.proxy((data, textStatus, jqXHR) ->
|
success: $.proxy (data, textStatus, jqXHR) ->
|
||||||
@loading = false
|
@loading = false
|
||||||
target.parent().removeClass 'ajaxLoad'
|
target.parent().removeClass 'loading'
|
||||||
|
|
||||||
# Mark as active
|
# Mark as active
|
||||||
$('.activeMenuItem .timsChatRoom').parent().removeClass 'activeMenuItem'
|
$('.activeMenuItem .timsChatRoom').parent().removeClass 'activeMenuItem'
|
||||||
@ -250,21 +255,21 @@ window.console ?=
|
|||||||
$(@).text ''
|
$(@).text ''
|
||||||
else
|
else
|
||||||
$('#timsChatTopic').text data.topic
|
$('#timsChatTopic').text data.topic
|
||||||
$('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden')
|
$('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is ':hidden'
|
||||||
|
|
||||||
$('.timsChatMessage').addClass 'unloaded', 800
|
$('.timsChatMessage').addClass 'unloaded', 800
|
||||||
@handleMessages data.messages
|
@handleMessages data.messages
|
||||||
document.title = @titleTemplate.fetch data
|
document.title = @titleTemplate.fetch data
|
||||||
, @)
|
, @
|
||||||
error: () ->
|
error: () ->
|
||||||
# Reload the page to change the room the old fashion-way
|
# Reload the page to change the room the old fashion-way
|
||||||
# inclusive the error-message :)
|
# inclusive the error-message :)
|
||||||
window.location.reload true
|
window.location.reload true
|
||||||
beforeSend: $.proxy(() ->
|
beforeSend: $.proxy(() ->
|
||||||
return false if target.parent().hasClass('ajaxLoad') or target.parent().hasClass 'activeMenuItem'
|
return false if target.parent().hasClass('loading') or target.parent().hasClass 'activeMenuItem'
|
||||||
|
|
||||||
@loading = true
|
@loading = true
|
||||||
target.parent().addClass 'ajaxLoad'
|
target.parent().addClass 'loading'
|
||||||
, @)
|
, @)
|
||||||
###
|
###
|
||||||
# Frees the fish
|
# Frees the fish
|
||||||
@ -378,7 +383,7 @@ window.console ?=
|
|||||||
element.addClass 'away'
|
element.addClass 'away'
|
||||||
element.attr 'title', user.awayStatus
|
element.attr 'title', user.awayStatus
|
||||||
else
|
else
|
||||||
element.removeClass 'timsChatAway'
|
element.removeClass 'away'
|
||||||
element.removeAttr 'title'
|
element.removeAttr 'title'
|
||||||
element.data 'tooltip', ''
|
element.data 'tooltip', ''
|
||||||
if user.suspended
|
if user.suspended
|
||||||
@ -413,10 +418,11 @@ window.console ?=
|
|||||||
menu = $ '<ul></ul>'
|
menu = $ '<ul></ul>'
|
||||||
#menu.addClass 'timsChatUserMenu'
|
#menu.addClass 'timsChatUserMenu'
|
||||||
menu.addClass 'dropdownMenu'
|
menu.addClass 'dropdownMenu'
|
||||||
menu.append $ '<li><a>' + WCF.Language.get('wcf.chat.query') + '</a></li>'
|
menu.append $ '<li><a>' + WCF.Language.get('chat.general.query') + '</a></li>'
|
||||||
menu.append $ '<li><a>' + WCF.Language.get('wcf.chat.kick') + '</a></li>'
|
menu.append $ '<li><a>' + WCF.Language.get('chat.general.kick') + '</a></li>'
|
||||||
menu.append $ '<li><a>' + WCF.Language.get('wcf.chat.ban') + '</a></li>'
|
menu.append $ '<li><a>' + WCF.Language.get('chat.general.ban') + '</a></li>'
|
||||||
menu.append $ '<li><a href="index.php/User/' + user.userID + '-' + encodeURI(user.username) + '/">' + WCF.Language.get('wcf.chat.profile') + '</a></li>'
|
# TODO: SID and co
|
||||||
|
menu.append $ '<li><a href="index.php/User/' + user.userID + '-' + encodeURI(user.username) + '/">' + WCF.Language.get('chat.general.profile') + '</a></li>'
|
||||||
@events.userMenu.fire user, menu
|
@events.userMenu.fire user, menu
|
||||||
li.append menu
|
li.append menu
|
||||||
|
|
||||||
@ -443,13 +449,13 @@ window.console ?=
|
|||||||
console.log 'Connected to nodePush'
|
console.log 'Connected to nodePush'
|
||||||
@pe.getMessages.stop()
|
@pe.getMessages.stop()
|
||||||
, @)
|
, @)
|
||||||
@socket.on 'disconnect', $.proxy((data) ->
|
@socket.on 'disconnect', $.proxy (data) ->
|
||||||
console.log 'Lost connection to nodePush'
|
console.log 'Lost connection to nodePush'
|
||||||
@pe.getMessages = new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1e3
|
@pe.getMessages = new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1e3
|
||||||
, @)
|
, @
|
||||||
@socket.on 'newMessage', $.proxy((data) ->
|
@socket.on 'newMessage', $.proxy (data) ->
|
||||||
@getMessages()
|
@getMessages()
|
||||||
, @)
|
, @
|
||||||
###
|
###
|
||||||
# Inserts text into our input.
|
# Inserts text into our input.
|
||||||
#
|
#
|
||||||
@ -485,8 +491,8 @@ window.console ?=
|
|||||||
# Desktop Notifications
|
# Desktop Notifications
|
||||||
if typeof window.webkitNotifications isnt 'undefined'
|
if typeof window.webkitNotifications isnt 'undefined'
|
||||||
if window.webkitNotifications.checkPermission() is 0
|
if window.webkitNotifications.checkPermission() is 0
|
||||||
title = WCF.Language.get 'wcf.chat.notify.title'
|
title = WCF.Language.get 'chat.general.notify.title'
|
||||||
icon = WCF.Icon.get 'be.bastelstu.wcf.chat.chat'
|
icon = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D" # empty gif
|
||||||
content = message.username + message.separator + (if message.separator is ' ' then '' else ' ') + message.message
|
content = message.username + message.separator + (if message.separator is ' ' then '' else ' ') + message.message
|
||||||
notification = window.webkitNotifications.createNotification icon, title, content
|
notification = window.webkitNotifications.createNotification icon, title, content
|
||||||
notification.show()
|
notification.show()
|
||||||
@ -500,14 +506,14 @@ window.console ?=
|
|||||||
###
|
###
|
||||||
refreshRoomList: () ->
|
refreshRoomList: () ->
|
||||||
console.log 'Refreshing the roomlist'
|
console.log 'Refreshing the roomlist'
|
||||||
$('#toggleRooms a').addClass 'ajaxLoad'
|
$('#toggleRooms .ajaxLoad').show()
|
||||||
|
|
||||||
$.ajax $('#toggleRooms a').data('refreshUrl'),
|
$.ajax $('#toggleRooms a').data('refreshUrl'),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
success: $.proxy((data, textStatus, jqXHR) ->
|
success: $.proxy (data, textStatus, jqXHR) ->
|
||||||
$('#timsChatRoomList li').remove()
|
$('#timsChatRoomList li').remove()
|
||||||
$('#toggleRooms a').removeClass 'ajaxLoad'
|
$('#toggleRooms .ajaxLoad').hide()
|
||||||
$('#toggleRooms .badge').text data.length
|
$('#toggleRooms .badge').text data.length
|
||||||
|
|
||||||
for room in data
|
for room in data
|
||||||
@ -522,8 +528,8 @@ window.console ?=
|
|||||||
@changeRoom $ event.target
|
@changeRoom $ event.target
|
||||||
, @
|
, @
|
||||||
|
|
||||||
console.log 'Found ' + data.length + ' rooms'
|
console.log "Found #{data.length} rooms"
|
||||||
, @)
|
, @
|
||||||
###
|
###
|
||||||
# Handles submitting of messages.
|
# Handles submitting of messages.
|
||||||
#
|
#
|
||||||
@ -549,12 +555,10 @@ window.console ?=
|
|||||||
smilies: $('#timsChatSmilies').data 'status'
|
smilies: $('#timsChatSmilies').data 'status'
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
beforeSend: (jqXHR) ->
|
beforeSend: (jqXHR) ->
|
||||||
$('#timsChatInput').addClass 'ajaxLoad'
|
success: $.proxy (data, textStatus, jqXHR) ->
|
||||||
success: $.proxy((data, textStatus, jqXHR) ->
|
|
||||||
@getMessages()
|
@getMessages()
|
||||||
, @)
|
, @
|
||||||
complete: () ->
|
complete: () ->
|
||||||
$('#timsChatInput').removeClass 'ajaxLoad'
|
|
||||||
###
|
###
|
||||||
# Toggles between user- and room-list.
|
# Toggles between user- and room-list.
|
||||||
#
|
#
|
@ -15,44 +15,36 @@
|
|||||||
width: '100%'
|
width: '100%'
|
||||||
, options
|
, options
|
||||||
|
|
||||||
if @.attr('maxlength')
|
max = if @.attr('maxlength')? then @.attr 'maxlength' else options.max
|
||||||
max = @.attr('maxlength')
|
|
||||||
else max = options.max
|
|
||||||
|
|
||||||
if !container
|
if not container?
|
||||||
if !@.hasClass('jCounterInput')
|
@.addClass 'jCounterInput'
|
||||||
@.addClass('jCounterInput')
|
|
||||||
@.wrap('<div class="jCounterContainer" style="width: ' + options.width + '"><div></div></div>').parent().append('<div class="' + options.counterClass + ' color-1">' + max + '</div>');
|
@.wrap("""<div class="jCounterContainer" style="width: #{options.width}"><div></div></div>""").parent().append """<div class="#{options.counterClass} color-1">#{max}</div>"""
|
||||||
jCounterContainer = $(@).parent().children('.' + options.counterClass)
|
jCounterContainer = $(@).parent().children ".#{options.counterClass}"
|
||||||
else
|
else
|
||||||
if typeof container is 'object'
|
jCounterContainer = if typeof container is 'object' then container else $ container
|
||||||
jCounterContainer = container
|
|
||||||
else
|
|
||||||
jCounterContainer = $ container
|
|
||||||
|
|
||||||
@.on 'keypress keyup', $.proxy () ->
|
@.on 'keypress keyup', $.proxy () ->
|
||||||
if options.countUp
|
length = if options.countUp then @.val().length else max - @.val().length
|
||||||
length = @.val().length
|
|
||||||
else
|
|
||||||
length = max - @.val().length
|
|
||||||
|
|
||||||
if options.countUp && max > 0
|
if options.countUp && max > 0
|
||||||
if length < max / 2
|
if length < max / 2
|
||||||
color = 1
|
color = 1
|
||||||
else if length >= max / 2 and length <= max / 1.2
|
else if max / 2 < length <= max / 1.2
|
||||||
color = 2
|
color = 2
|
||||||
else
|
else
|
||||||
color = 3
|
color = 3
|
||||||
else if options.countUp
|
else if options.countUp
|
||||||
color = 1
|
color = 1
|
||||||
else
|
else
|
||||||
if length > max / 2
|
if max / 2 < length
|
||||||
color = 1
|
color = 1
|
||||||
else if length <= max / 2 and length >= max / 6
|
else if max / 6 <= length <= max / 2
|
||||||
color = 2
|
color = 2
|
||||||
else
|
else
|
||||||
color = 3
|
color = 3
|
||||||
|
|
||||||
jCounterContainer.text(length).attr('class', '').addClass(options.counterClass + ' color-'+color)
|
jCounterContainer.text(length).removeClass().addClass "#{options.counterClass} color-#{color}"
|
||||||
, @
|
, @
|
||||||
)(jQuery)
|
)(jQuery)
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\acp\form;
|
namespace chat\acp\form;
|
||||||
use \wcf\system\exception\UserInputException;
|
use \wcf\system\exception\UserInputException;
|
||||||
use \wcf\system\language\I18nHandler;
|
use \wcf\system\language\I18nHandler;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
@ -8,21 +8,21 @@
|
|||||||
* Shows the chatroom add form.
|
* Shows the chatroom add form.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage acp.form
|
* @subpackage acp.form
|
||||||
*/
|
*/
|
||||||
class ChatRoomAddForm extends \wcf\form\AbstractForm {
|
class RoomAddForm extends \wcf\form\AbstractForm {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\acp\page\AbstractPage::$activeMenuItem
|
* @see \wcf\acp\page\AbstractPage::$activeMenuItem
|
||||||
*/
|
*/
|
||||||
public $activeMenuItem = 'wcf.acp.menu.link.chat.room.add';
|
public $activeMenuItem = 'chat.acp.menu.link.room.add';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||||
*/
|
*/
|
||||||
public $neededPermissions = array('admin.content.chat.canAddRoom');
|
public $neededPermissions = array('admin.chat.canAddRoom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title of the room
|
* Title of the room
|
||||||
@ -42,7 +42,7 @@ class ChatRoomAddForm extends \wcf\form\AbstractForm {
|
|||||||
* @see \wcf\page\AbstractPage::__construct()
|
* @see \wcf\page\AbstractPage::__construct()
|
||||||
*/
|
*/
|
||||||
public function __run() {
|
public function __run() {
|
||||||
$this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room');
|
$this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room');
|
||||||
|
|
||||||
parent::__run();
|
parent::__run();
|
||||||
}
|
}
|
||||||
@ -88,35 +88,35 @@ public function save() {
|
|||||||
parent::save();
|
parent::save();
|
||||||
|
|
||||||
// save room
|
// save room
|
||||||
$this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array(
|
$this->objectAction = new \chat\data\room\RoomAction(array(), 'create', array('data' => array(
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'topic' => $this->topic
|
'topic' => $this->topic
|
||||||
)));
|
)));
|
||||||
$this->objectAction->executeAction();
|
$this->objectAction->executeAction();
|
||||||
$returnValues = $this->objectAction->getReturnValues();
|
$returnValues = $this->objectAction->getReturnValues();
|
||||||
$chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']);
|
$roomEditor = new \chat\data\room\RoomEditor($returnValues['returnValues']);
|
||||||
$roomID = $returnValues['returnValues']->roomID;
|
$roomID = $returnValues['returnValues']->roomID;
|
||||||
|
|
||||||
if (!I18nHandler::getInstance()->isPlainValue('title')) {
|
if (!I18nHandler::getInstance()->isPlainValue('title')) {
|
||||||
I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->save('title', 'chat.room.title'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID());
|
||||||
|
|
||||||
// update title
|
// update title
|
||||||
$chatRoomEditor->update(array(
|
$roomEditor->update(array(
|
||||||
'title' => 'wcf.chat.room.title'.$roomID
|
'title' => 'chat.room.title'.$roomID
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!I18nHandler::getInstance()->isPlainValue('topic')) {
|
if (!I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||||
I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->save('topic', 'chat.room.topic'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID());
|
||||||
|
|
||||||
// update topic
|
// update topic
|
||||||
$chatRoomEditor->update(array(
|
$roomEditor->update(array(
|
||||||
'topic' => 'wcf.chat.room.topic'.$roomID
|
'topic' => 'chat.room.topic'.$roomID
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
\wcf\system\acl\ACLHandler::getInstance()->save($roomID, $this->objectTypeID);
|
\wcf\system\acl\ACLHandler::getInstance()->save($roomID, $this->objectTypeID);
|
||||||
\wcf\system\chat\permission\ChatPermissionHandler::clearCache();
|
\chat\system\permission\permissionHandler::clearCache();
|
||||||
|
|
||||||
$this->saved();
|
$this->saved();
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\acp\form;
|
namespace chat\acp\form;
|
||||||
use \wcf\system\language\I18nHandler;
|
use \wcf\system\language\I18nHandler;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -7,26 +7,26 @@
|
|||||||
* Shows the chatroom edit form.
|
* Shows the chatroom edit form.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage acp.form
|
* @subpackage acp.form
|
||||||
*/
|
*/
|
||||||
class ChatRoomEditForm extends ChatRoomAddForm {
|
class RoomEditForm extends RoomAddForm {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$templateName
|
* @see \wcf\page\AbstractPage::$templateName
|
||||||
*/
|
*/
|
||||||
public $templateName = 'chatRoomAdd';
|
public $templateName = 'roomAdd';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\acp\form\ACPForm::$activeMenuItem
|
* @see \wcf\acp\form\ACPForm::$activeMenuItem
|
||||||
*/
|
*/
|
||||||
public $activeMenuItem = 'wcf.acp.menu.link.chat.room.list';
|
public $activeMenuItem = 'chat.acp.menu.link.room.list';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||||
*/
|
*/
|
||||||
public $neededPermissions = array('admin.content.chat.canEditRoom');
|
public $neededPermissions = array('admin.chat.canEditRoom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* room id
|
* room id
|
||||||
@ -38,7 +38,7 @@ class ChatRoomEditForm extends ChatRoomAddForm {
|
|||||||
/**
|
/**
|
||||||
* room object
|
* room object
|
||||||
*
|
*
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Room
|
||||||
*/
|
*/
|
||||||
public $roomObj = null;
|
public $roomObj = null;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public function readParameters() {
|
|||||||
parent::readParameters();
|
parent::readParameters();
|
||||||
|
|
||||||
if (isset($_REQUEST['id'])) $this->roomID = intval($_REQUEST['id']);
|
if (isset($_REQUEST['id'])) $this->roomID = intval($_REQUEST['id']);
|
||||||
$this->roomObj = new \wcf\data\chat\room\ChatRoom($this->roomID);
|
$this->roomObj = new \chat\data\room\Room($this->roomID);
|
||||||
if (!$this->roomObj->roomID) {
|
if (!$this->roomObj->roomID) {
|
||||||
throw new \wcf\system\exception\IllegalLinkException();
|
throw new \wcf\system\exception\IllegalLinkException();
|
||||||
}
|
}
|
||||||
@ -59,31 +59,31 @@ public function readParameters() {
|
|||||||
* @see \wcf\form\IForm::save()
|
* @see \wcf\form\IForm::save()
|
||||||
*/
|
*/
|
||||||
public function save() {
|
public function save() {
|
||||||
ACPForm::save();
|
\wcf\form\AbstractForm::save();
|
||||||
|
|
||||||
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
|
$this->title = 'chat.room.title'.$this->roomObj->roomID;
|
||||||
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
||||||
I18nHandler::getInstance()->remove($this->title);
|
I18nHandler::getInstance()->remove($this->title);
|
||||||
$this->title = I18nHandler::getInstance()->getValue('title');
|
$this->title = I18nHandler::getInstance()->getValue('title');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->save('title', $this->title, 'chat.room', \chat\util\ChatUtil::getPackageID());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
|
$this->topic = 'chat.room.topic'.$this->roomObj->roomID;
|
||||||
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||||
I18nHandler::getInstance()->remove($this->topic);
|
I18nHandler::getInstance()->remove($this->topic);
|
||||||
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->save('topic', $this->topic, 'chat.room', \chat\util\ChatUtil::getPackageID());
|
||||||
}
|
}
|
||||||
|
|
||||||
\wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID);
|
\wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID);
|
||||||
\wcf\system\chat\permission\ChatPermissionHandler::clearCache();
|
\chat\system\permission\PermissionHandler::clearCache();
|
||||||
|
|
||||||
// update room
|
// update room
|
||||||
$this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array($this->roomID), 'update', array('data' => array(
|
$this->objectAction = new \chat\data\room\RoomAction(array($this->roomID), 'update', array('data' => array(
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'topic' => $this->topic
|
'topic' => $this->topic
|
||||||
)));
|
)));
|
||||||
@ -104,8 +104,8 @@ public function readData() {
|
|||||||
parent::readData();
|
parent::readData();
|
||||||
|
|
||||||
if (!count($_POST)) {
|
if (!count($_POST)) {
|
||||||
I18nHandler::getInstance()->setOptions('title', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->title, 'wcf.chat.room.title\d+');
|
I18nHandler::getInstance()->setOptions('title', \chat\util\ChatUtil::getPackageID(), $this->roomObj->title, 'chat.room.title\d+');
|
||||||
I18nHandler::getInstance()->setOptions('topic', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'wcf.chat.room.topic\d+');
|
I18nHandler::getInstance()->setOptions('topic', \chat\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'chat.room.topic\d+');
|
||||||
|
|
||||||
$this->title = $this->roomObj->title;
|
$this->title = $this->roomObj->title;
|
||||||
$this->topic = $this->roomObj->topic;
|
$this->topic = $this->roomObj->topic;
|
@ -1,33 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\acp\page;
|
namespace chat\acp\page;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists available chatrooms.
|
* Lists available chatrooms.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage acp.page
|
* @subpackage acp.page
|
||||||
*/
|
*/
|
||||||
class ChatRoomListPage extends \wcf\page\MultipleLinkPage {
|
class RoomListPage extends \wcf\page\MultipleLinkPage {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$activeMenuItem
|
* @see \wcf\page\AbstractPage::$activeMenuItem
|
||||||
*/
|
*/
|
||||||
public $activeMenuItem = 'wcf.acp.menu.link.chat.room.list';
|
public $activeMenuItem = 'chat.acp.menu.link.room.list';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||||
*/
|
*/
|
||||||
public $neededPermissions = array(
|
public $neededPermissions = array(
|
||||||
'admin.content.chat.canEditRoom',
|
'admin.chat.canEditRoom',
|
||||||
'admin.content.chat.canDeleteRoom'
|
'admin.chat.canDeleteRoom'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\MultipleLinkPage::$objectListClassName
|
* @see \wcf\page\MultipleLinkPage::$objectListClassName
|
||||||
*/
|
*/
|
||||||
public $objectListClassName = '\wcf\data\chat\room\ChatRoomList';
|
public $objectListClassName = '\chat\data\room\RoomList';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\MultipleLinkPage::$sortField
|
* @see \wcf\page\MultipleLinkPage::$sortField
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\action;
|
namespace chat\action;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\exception\IllegalLinkException;
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -8,12 +8,12 @@
|
|||||||
* Makes the user leave Tims Chat.
|
* Makes the user leave Tims Chat.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage action
|
* @subpackage action
|
||||||
*/
|
*/
|
||||||
class ChatLeaveAction extends AbstractAction {
|
class LeaveAction extends \wcf\action\AbstractAction {
|
||||||
/**
|
/**
|
||||||
* @see wcf\action\AbstractAction::$loginRequired
|
* @see wcf\action\AbstractAction::$loginRequired
|
||||||
*/
|
*/
|
||||||
@ -32,7 +32,7 @@ class ChatLeaveAction extends AbstractAction {
|
|||||||
/**
|
/**
|
||||||
* The current room.
|
* The current room.
|
||||||
*
|
*
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Room
|
||||||
*/
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
@ -43,47 +43,30 @@ class ChatLeaveAction extends AbstractAction {
|
|||||||
*/
|
*/
|
||||||
public $userData = array();
|
public $userData = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* shortcut for the active request
|
|
||||||
* @see wcf\system\request\Request::getRequestObject()
|
|
||||||
*/
|
|
||||||
public $request = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disallows direct access.
|
|
||||||
*
|
|
||||||
* @see wcf\page\IPage::__run()
|
|
||||||
*/
|
|
||||||
public function __run() {
|
|
||||||
if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException();
|
|
||||||
|
|
||||||
parent::__run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\action\IAction::execute()
|
* @see \wcf\action\IAction::execute()
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
parent::execute();
|
parent::execute();
|
||||||
|
|
||||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
$this->userData['roomID'] = \chat\util\ChatUtil::readUserData('roomID');
|
||||||
|
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$cache = data\room\Room::getCache();
|
||||||
if (!isset($cache[$this->userData['roomID']])) throw new IllegalLinkException();
|
if (!isset($cache[$this->userData['roomID']])) throw new IllegalLinkException();
|
||||||
$this->room = $cache[$this->userData['roomID']];
|
$this->room = $cache[$this->userData['roomID']];
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
$this->userData['color'] = \wcf\util\ChatUtil::readUserData('color');
|
$this->userData['color'] = \chat\util\ChatUtil::readUserData('color');
|
||||||
|
|
||||||
// leave message
|
// leave message
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $this->room->roomID,
|
'roomID' => $this->room->roomID,
|
||||||
'sender' => WCF::getUser()->userID,
|
'sender' => WCF::getUser()->userID,
|
||||||
'username' => WCF::getUser()->username,
|
'username' => WCF::getUser()->username,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => chat\message\ChatMessage::TYPE_LEAVE,
|
'type' => data\message\Message::TYPE_LEAVE,
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'color1' => $this->userData['color'][1],
|
'color1' => $this->userData['color'][1],
|
||||||
'color2' => $this->userData['color'][2]
|
'color2' => $this->userData['color'][2]
|
||||||
@ -93,7 +76,7 @@ public function execute() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set current room to null
|
// set current room to null
|
||||||
\wcf\util\ChatUtil::writeUserData(array('roomID' => null));
|
\chat\util\ChatUtil::writeUserData(array('roomID' => null));
|
||||||
|
|
||||||
$this->executed();
|
$this->executed();
|
||||||
header("HTTP/1.0 204 No Content");
|
header("HTTP/1.0 204 No Content");
|
20
file/lib/data/CHATDatabaseObject.class.php
Normal file
20
file/lib/data/CHATDatabaseObject.class.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace chat\data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic implementation that sets proper table name.
|
||||||
|
*
|
||||||
|
* @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 data
|
||||||
|
*/
|
||||||
|
abstract class CHATDatabaseObject extends \wcf\data\DatabaseObject {
|
||||||
|
/**
|
||||||
|
* @see \wcf\data\DatabaseObject::getDatabaseTableName()
|
||||||
|
*/
|
||||||
|
public static function getDatabaseTableName() {
|
||||||
|
return 'chat'.WCF_N.'_'.static::$databaseTableName;
|
||||||
|
}
|
||||||
|
}
|
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace wcf\data\chat\message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a list of chat messages.
|
|
||||||
*
|
|
||||||
* @author Tim Düsterhus
|
|
||||||
* @copyright 2010-2012 Tim Düsterhus
|
|
||||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
|
||||||
* @package be.bastelstu.wcf.chat
|
|
||||||
* @subpackage data.chat.room
|
|
||||||
*/
|
|
||||||
class ChatMessageList extends \wcf\data\DatabaseObjectList {
|
|
||||||
/**
|
|
||||||
* @see \wcf\data\DatabaseObjectList::$className
|
|
||||||
*/
|
|
||||||
public $className = 'wcf\data\chat\message\ChatMessage';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the newest messages for the given room.
|
|
||||||
*
|
|
||||||
* @param \wcf\data\chat\room\ChatRoom $room
|
|
||||||
* @param integer $number
|
|
||||||
* @return array<\wcf\data\chat\message\ChatMessage>
|
|
||||||
*/
|
|
||||||
public static function getNewestMessages(\wcf\data\chat\room\ChatRoom $room, $number = CHAT_LASTMESSAGES) {
|
|
||||||
$messageList = new static();
|
|
||||||
$messageList->sqlOrderBy = "chat_message.messageID DESC";
|
|
||||||
$messageList->sqlLimit = $number;
|
|
||||||
$messageList->getConditionBuilder()->add('
|
|
||||||
((
|
|
||||||
chat_message.receiver IS NULL
|
|
||||||
AND chat_message.roomID = ?
|
|
||||||
)
|
|
||||||
OR chat_message.receiver = ?
|
|
||||||
OR chat_message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID));
|
|
||||||
|
|
||||||
$messageList->readObjects();
|
|
||||||
return array_reverse($messageList->getObjects());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the messages since the given message-id for the given room.
|
|
||||||
*
|
|
||||||
* @param \wcf\data\chat\room\ChatRoom $room
|
|
||||||
* @param integer $since
|
|
||||||
* @return array<\wcf\data\chat\message\ChatMessage>
|
|
||||||
*/
|
|
||||||
public static function getMessagesSince(\wcf\data\chat\room\ChatRoom $room, $since) {
|
|
||||||
$messageList = new static();
|
|
||||||
$messageList->sqlOrderBy = "chat_message.messageID ASC";
|
|
||||||
$messageList->getConditionBuilder()->add('chat_message.messageID > ?', array($since));
|
|
||||||
$messageList->getConditionBuilder()->add('
|
|
||||||
((
|
|
||||||
chat_message.receiver IS NULL
|
|
||||||
AND chat_message.roomID = ?
|
|
||||||
)
|
|
||||||
OR chat_message.receiver = ?
|
|
||||||
OR chat_message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID));
|
|
||||||
|
|
||||||
$messageList->readObjects();
|
|
||||||
return $messageList->getObjects();
|
|
||||||
}
|
|
||||||
}
|
|
26
file/lib/data/chat/message/ChatMessage.class.php → file/lib/data/message/Message.class.php
Executable file → Normal file
26
file/lib/data/chat/message/ChatMessage.class.php → file/lib/data/message/Message.class.php
Executable file → Normal file
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\message;
|
namespace chat\data\message;
|
||||||
|
use \chat\util\ChatUtil;
|
||||||
use \wcf\system\Regex;
|
use \wcf\system\Regex;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\ChatUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a chat message.
|
* Represents a chat message.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.message
|
* @subpackage data.message
|
||||||
*/
|
*/
|
||||||
class ChatMessage extends \wcf\data\DatabaseObject {
|
class Message extends \chat\data\CHATDatabaseObject {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableName
|
* @see \wcf\data\DatabaseObject::$databaseTableName
|
||||||
*/
|
*/
|
||||||
protected static $databaseTableName = 'chat_message';
|
protected static $databaseTableName = 'message';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
||||||
@ -45,7 +45,7 @@ class ChatMessage extends \wcf\data\DatabaseObject {
|
|||||||
protected static $users = array();
|
protected static $users = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\chat\message\ChatMessage::getFormattedMessage()
|
* @see \chat\data\\message\Message::getFormattedMessage()
|
||||||
*/
|
*/
|
||||||
public function __toString() {
|
public function __toString() {
|
||||||
return $this->getFormattedMessage();
|
return $this->getFormattedMessage();
|
||||||
@ -65,11 +65,11 @@ public function getFormattedMessage($outputType = 'text/html') {
|
|||||||
case self::TYPE_LEAVE:
|
case self::TYPE_LEAVE:
|
||||||
case self::TYPE_BACK:
|
case self::TYPE_BACK:
|
||||||
case self::TYPE_AWAY:
|
case self::TYPE_AWAY:
|
||||||
$message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type, unserialize($message) ?: array());
|
$message = WCF::getLanguage()->getDynamicVariable('chat.message.'.$this->type, unserialize($message) ?: array());
|
||||||
break;
|
break;
|
||||||
case self::TYPE_MODERATE:
|
case self::TYPE_MODERATE:
|
||||||
$message = unserialize($message);
|
$message = unserialize($message);
|
||||||
$message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type.'.'.$message['type'], $message ?: array());
|
$message = WCF::getLanguage()->getDynamicVariable('chat.message.'.$this->type.'.'.$message['type'], $message ?: array());
|
||||||
$message = self::replaceUserLink($message, $outputType);
|
$message = self::replaceUserLink($message, $outputType);
|
||||||
break;
|
break;
|
||||||
case self::TYPE_WHISPER:
|
case self::TYPE_WHISPER:
|
||||||
@ -110,11 +110,11 @@ public function getFormattedMessage($outputType = 'text/html') {
|
|||||||
*/
|
*/
|
||||||
public function getUsername($colored = false) {
|
public function getUsername($colored = false) {
|
||||||
$username = $this->username;
|
$username = $this->username;
|
||||||
if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('wcf.chat.information');
|
if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.general.information');
|
||||||
if ($this->type == self::TYPE_ERROR) return WCF::getLanguage()->get('wcf.chat.error');
|
if ($this->type == self::TYPE_ERROR) return WCF::getLanguage()->get('chat.general.error');
|
||||||
|
|
||||||
if ($colored) {
|
if ($colored) {
|
||||||
$username = \wcf\util\ChatUtil::gradient($username, $this->color1, $this->color2);
|
$username = \chat\util\ChatUtil::gradient($username, $this->color1, $this->color2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->type == self::TYPE_WHISPER) {
|
if ($this->type == self::TYPE_WHISPER) {
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\message;
|
namespace chat\data\message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes message related actions.
|
* Executes message related actions.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.message
|
* @subpackage chat.message
|
||||||
*/
|
*/
|
||||||
class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction {
|
class MessageAction extends \wcf\data\AbstractDatabaseObjectAction {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
||||||
*/
|
*/
|
||||||
protected $className = '\wcf\data\chat\message\ChatMessageEditor';
|
protected $className = '\chat\data\message\MessageEditor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes old messages.
|
* Removes old messages.
|
@ -1,28 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\message;
|
namespace chat\data\message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides functions to edit chat messages.
|
* Provides functions to edit chat messages.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.message
|
* @subpackage chat.message
|
||||||
*/
|
*/
|
||||||
class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor {
|
class MessageEditor extends \wcf\data\DatabaseObjectEditor {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
||||||
*/
|
*/
|
||||||
protected static $baseClass = '\wcf\data\chat\message\ChatMessage';
|
protected static $baseClass = '\chat\data\message\Message';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the Push-Server.
|
* Notify the Push-Server.
|
||||||
*/
|
*/
|
||||||
public static function create(array $parameters = array()) {
|
public static function create(array $parameters = array()) {
|
||||||
try {
|
try {
|
||||||
if (\wcf\util\ChatUtil::nodePushRunning()) {
|
if (\chat\util\ChatUtil::nodePushRunning()) {
|
||||||
$sock = stream_socket_client('unix://'.WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock', $errno, $errstr, 1);
|
$sock = stream_socket_client('unix://'.CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock', $errno, $errstr, 1);
|
||||||
fclose($sock);
|
fclose($sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
64
file/lib/data/message/MessageList.class.php
Normal file
64
file/lib/data/message/MessageList.class.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
namespace chat\data\message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a list of chat messages.
|
||||||
|
*
|
||||||
|
* @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 chat.room
|
||||||
|
*/
|
||||||
|
class MessageList extends \wcf\data\DatabaseObjectList {
|
||||||
|
/**
|
||||||
|
* @see \wcf\data\DatabaseObjectList::$className
|
||||||
|
*/
|
||||||
|
public $className = 'chat\data\message\Message';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the newest messages for the given room.
|
||||||
|
*
|
||||||
|
* @param \chat\data\room\Room $room
|
||||||
|
* @param integer $number
|
||||||
|
* @return array<\chat\data\message\Message>
|
||||||
|
*/
|
||||||
|
public static function getNewestMessages(\chat\data\room\Room $room, $number = CHAT_LASTMESSAGES) {
|
||||||
|
$messageList = new static();
|
||||||
|
$messageList->sqlOrderBy = "message.messageID DESC";
|
||||||
|
$messageList->sqlLimit = $number;
|
||||||
|
$messageList->getConditionBuilder()->add('
|
||||||
|
((
|
||||||
|
message.receiver IS NULL
|
||||||
|
AND message.roomID = ?
|
||||||
|
)
|
||||||
|
OR message.receiver = ?
|
||||||
|
OR message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID));
|
||||||
|
|
||||||
|
$messageList->readObjects();
|
||||||
|
return array_reverse($messageList->getObjects());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads the messages since the given message-id for the given room.
|
||||||
|
*
|
||||||
|
* @param \chat\data\room\Room $room
|
||||||
|
* @param integer $since
|
||||||
|
* @return array<\chat\data\message\Message>
|
||||||
|
*/
|
||||||
|
public static function getMessagesSince(\chat\data\room\Room $room, $since) {
|
||||||
|
$messageList = new static();
|
||||||
|
$messageList->sqlOrderBy = "message.messageID ASC";
|
||||||
|
$messageList->getConditionBuilder()->add('message.messageID > ?', array($since));
|
||||||
|
$messageList->getConditionBuilder()->add('
|
||||||
|
((
|
||||||
|
message.receiver IS NULL
|
||||||
|
AND message.roomID = ?
|
||||||
|
)
|
||||||
|
OR message.receiver = ?
|
||||||
|
OR message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID));
|
||||||
|
|
||||||
|
$messageList->readObjects();
|
||||||
|
return $messageList->getObjects();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\room;
|
namespace chat\data\room;
|
||||||
use \wcf\data\chat\suspension\ChatSuspension;
|
use \chat\data\suspension\Suspension;
|
||||||
use \wcf\system\cache\CacheHandler;
|
use \wcf\system\cache\CacheHandler;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -8,16 +8,16 @@
|
|||||||
* Represents a chat room.
|
* Represents a chat room.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.room
|
* @subpackage data.room
|
||||||
*/
|
*/
|
||||||
class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController {
|
class Room extends \chat\data\CHATDatabaseObject implements \wcf\system\request\IRouteController {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableName
|
* @see \wcf\data\DatabaseObject::$databaseTableName
|
||||||
*/
|
*/
|
||||||
protected static $databaseTableName = 'chat_room';
|
protected static $databaseTableName = 'room';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
||||||
@ -47,20 +47,20 @@ public function __toString() {
|
|||||||
public function canEnter(\wcf\data\user\User $user = null) {
|
public function canEnter(\wcf\data\user\User $user = null) {
|
||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
|
|
||||||
$ph = new \wcf\system\chat\permission\ChatPermissionHandler($user);
|
$ph = new \chat\system\permission\PermissionHandler($user);
|
||||||
$suspensions = ChatSuspension::getSuspensionsForUser($user);
|
$suspensions = Suspension::getSuspensionsForUser($user);
|
||||||
|
|
||||||
$canEnter = $ph->getPermission($this, 'user.canEnter');
|
$canEnter = $ph->getPermission($this, 'user.canEnter');
|
||||||
// room suspension
|
// room suspension
|
||||||
if ($canEnter && isset($suspensions[$this->roomID][ChatSuspension::TYPE_BAN])) {
|
if ($canEnter && isset($suspensions[$this->roomID][Suspension::TYPE_BAN])) {
|
||||||
if ($suspensions[$this->roomID][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) {
|
if ($suspensions[$this->roomID][Suspension::TYPE_BAN]['time'] > TIME_NOW) {
|
||||||
$canEnter = false;
|
$canEnter = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// global suspension
|
// global suspension
|
||||||
if ($canEnter && isset($suspensions[null][ChatSuspension::TYPE_BAN])) {
|
if ($canEnter && isset($suspensions[null][Suspension::TYPE_BAN])) {
|
||||||
if ($suspensions[null][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) {
|
if ($suspensions[null][Suspension::TYPE_BAN]['time'] > TIME_NOW) {
|
||||||
$canEnter = false;
|
$canEnter = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,20 +77,20 @@ public function canEnter(\wcf\data\user\User $user = null) {
|
|||||||
public function canWrite(\wcf\data\user\User $user = null) {
|
public function canWrite(\wcf\data\user\User $user = null) {
|
||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
|
|
||||||
$ph = new \wcf\system\chat\permission\ChatPermissionHandler($user);
|
$ph = new \chat\system\permission\PermissionHandler($user);
|
||||||
$suspensions = ChatSuspension::getSuspensionsForUser($user);
|
$suspensions = Suspension::getSuspensionsForUser($user);
|
||||||
|
|
||||||
$canWrite = $ph->getPermission($this, 'user.canWrite');
|
$canWrite = $ph->getPermission($this, 'user.canWrite');
|
||||||
// room suspension
|
// room suspension
|
||||||
if ($canWrite && isset($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE])) {
|
if ($canWrite && isset($suspensions[$this->roomID][Suspension::TYPE_MUTE])) {
|
||||||
if ($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) {
|
if ($suspensions[$this->roomID][Suspension::TYPE_MUTE]['time'] > TIME_NOW) {
|
||||||
$canWrite = false;
|
$canWrite = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// global suspension
|
// global suspension
|
||||||
if ($canWrite && isset($suspensions[null][ChatSuspension::TYPE_MUTE])) {
|
if ($canWrite && isset($suspensions[null][Suspension::TYPE_MUTE])) {
|
||||||
if ($suspensions[null][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) {
|
if ($suspensions[null][Suspension::TYPE_MUTE]['time'] > TIME_NOW) {
|
||||||
$canWrite = false;
|
$canWrite = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,11 +123,11 @@ public function countUsers() {
|
|||||||
public static function getCache() {
|
public static function getCache() {
|
||||||
if (self::$cache === null) {
|
if (self::$cache === null) {
|
||||||
CacheHandler::getInstance()->addResource(
|
CacheHandler::getInstance()->addResource(
|
||||||
'chatrooms',
|
'chatRooms',
|
||||||
WCF_DIR.'cache/cache.chatrooms.php',
|
CHAT_DIR.'cache/cache.rooms.php',
|
||||||
'\wcf\system\cache\builder\ChatRoomCacheBuilder'
|
'\chat\system\cache\builder\RoomCacheBuilder'
|
||||||
);
|
);
|
||||||
self::$cache = CacheHandler::getInstance()->get('chatrooms');
|
self::$cache = CacheHandler::getInstance()->get('chatRooms');
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$cache;
|
return self::$cache;
|
@ -1,31 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\room;
|
namespace chat\data\room;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes chatroom-related actions.
|
* Executes chatroom-related actions.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.room
|
* @subpackage data.room
|
||||||
*/
|
*/
|
||||||
class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction implements \wcf\data\ISortableAction {
|
class RoomAction extends \wcf\data\AbstractDatabaseObjectAction implements \wcf\data\ISortableAction {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
||||||
*/
|
*/
|
||||||
protected $className = '\wcf\data\chat\room\ChatRoomEditor';
|
protected $className = '\chat\data\room\RoomEditor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
|
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
|
||||||
*/
|
*/
|
||||||
protected $permissionsDelete = array('admin.content.chat.canDeleteRoom');
|
protected $permissionsDelete = array('admin.chat.canDeleteRoom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
|
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
|
||||||
*/
|
*/
|
||||||
protected $permissionsUpdate = array('admin.content.chat.canEditRoom');
|
protected $permissionsUpdate = array('admin.chat.canEditRoom');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes create to append new rooms.
|
* Fixes create to append new rooms.
|
||||||
@ -40,7 +40,7 @@ public function create() {
|
|||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$editor = new ChatRoomEditor($room);
|
$editor = new RoomEditor($room);
|
||||||
$editor->update(array('position' => ($stmt->fetchColumn() + 1)));
|
$editor->update(array('position' => ($stmt->fetchColumn() + 1)));
|
||||||
WCF::getDB()->commitTransaction();
|
WCF::getDB()->commitTransaction();
|
||||||
|
|
||||||
@ -100,8 +100,8 @@ public function validateUpdatePosition() {
|
|||||||
* @see wcf\data\ISortableAction
|
* @see wcf\data\ISortableAction
|
||||||
*/
|
*/
|
||||||
public function updatePosition() {
|
public function updatePosition() {
|
||||||
$roomList = new \wcf\data\chat\room\ChatRoomList();
|
$roomList = new RoomList();
|
||||||
$roomList->sqlOrderBy = "chat_room.position";
|
$roomList->sqlOrderBy = "room.position";
|
||||||
$roomList->readObjects();
|
$roomList->readObjects();
|
||||||
|
|
||||||
$i = $this->parameters['data']['offset'];
|
$i = $this->parameters['data']['offset'];
|
||||||
@ -109,7 +109,7 @@ public function updatePosition() {
|
|||||||
foreach ($this->parameters['data']['structure'][0] as $roomID) {
|
foreach ($this->parameters['data']['structure'][0] as $roomID) {
|
||||||
$room = $roomList->search($roomID);
|
$room = $roomList->search($roomID);
|
||||||
if ($room === null) continue;
|
if ($room === null) continue;
|
||||||
$editor = new ChatRoomEditor($room);
|
$editor = new RoomEditor($room);
|
||||||
$editor->update(array('position' => $i++));
|
$editor->update(array('position' => $i++));
|
||||||
}
|
}
|
||||||
WCF::getDB()->commitTransaction();
|
WCF::getDB()->commitTransaction();
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\room;
|
namespace chat\data\room;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides functions to edit chat rooms.
|
* Provides functions to edit chat rooms.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.room
|
* @subpackage data.room
|
||||||
*/
|
*/
|
||||||
class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
|
class RoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
||||||
*/
|
*/
|
||||||
protected static $baseClass = '\wcf\data\chat\room\ChatRoom';
|
protected static $baseClass = '\chat\data\room\Room';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,21 +24,21 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
|
|||||||
public static function deleteAll(array $objectIDs = array()) {
|
public static function deleteAll(array $objectIDs = array()) {
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
foreach ($objectIDs as $objectID) {
|
foreach ($objectIDs as $objectID) {
|
||||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID);
|
\wcf\system\language\I18nHandler::getInstance()->remove('chat.room.title'.$objectID);
|
||||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID);
|
\wcf\system\language\I18nHandler::getInstance()->remove('chat.room.topic'.$objectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
position
|
position
|
||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_chat_room
|
chat".WCF_N."_room
|
||||||
WHERE
|
WHERE
|
||||||
roomID = ?
|
roomID = ?
|
||||||
FOR UPDATE";
|
FOR UPDATE";
|
||||||
$select = WCF::getDB()->prepareStatement($sql);
|
$select = WCF::getDB()->prepareStatement($sql);
|
||||||
|
|
||||||
$sql = "UPDATE
|
$sql = "UPDATE
|
||||||
wcf".WCF_N."_chat_room
|
chat".WCF_N."_room
|
||||||
SET
|
SET
|
||||||
position = position - 1
|
position = position - 1
|
||||||
WHERE
|
WHERE
|
||||||
@ -59,6 +59,6 @@ public static function deleteAll(array $objectIDs = array()) {
|
|||||||
* Clears the room cache.
|
* Clears the room cache.
|
||||||
*/
|
*/
|
||||||
public static function resetCache() {
|
public static function resetCache() {
|
||||||
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatrooms.php');
|
\wcf\system\cache\CacheHandler::getInstance()->clear(CHAT_DIR.'cache', 'cache.rooms.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\room;
|
namespace chat\data\room;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a list of chat rooms.
|
* Represents a list of chat rooms.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.room
|
* @subpackage data.room
|
||||||
*/
|
*/
|
||||||
class ChatRoomList extends \wcf\data\DatabaseObjectList {
|
class RoomList extends \wcf\data\DatabaseObjectList {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObjectList::$className
|
* @see \wcf\data\DatabaseObjectList::$className
|
||||||
*/
|
*/
|
||||||
public $className = 'wcf\data\chat\room\ChatRoom';
|
public $className = 'chat\data\room\Room';
|
||||||
}
|
}
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\suspension;
|
namespace chat\data\suspension;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a chat suspension.
|
* Represents a chat suspension.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.suspension
|
* @subpackage data.suspension
|
||||||
*/
|
*/
|
||||||
class ChatSuspension extends \wcf\data\DatabaseObject {
|
class Suspension extends \chat\data\CHATDatabaseObject {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableName
|
* @see \wcf\data\DatabaseObject::$databaseTableName
|
||||||
*/
|
*/
|
||||||
protected static $databaseTableName = 'chat_suspension';
|
protected static $databaseTableName = 'suspension';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
* @see \wcf\data\DatabaseObject::$databaseTableIndexName
|
||||||
@ -27,12 +27,12 @@ class ChatSuspension extends \wcf\data\DatabaseObject {
|
|||||||
|
|
||||||
public static function getSuspensionsForUser(\wcf\data\user\User $user = null) {
|
public static function getSuspensionsForUser(\wcf\data\user\User $user = null) {
|
||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
$suspensions = \wcf\util\ChatUtil::readUserData('suspensions', $user);
|
$suspensions = \chat\util\ChatUtil::readUserData('suspensions', $user);
|
||||||
if ($suspensions === null) {
|
if ($suspensions === null) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_chat_suspension
|
chat".WCF_N."_suspension
|
||||||
WHERE
|
WHERE
|
||||||
userID = ?
|
userID = ?
|
||||||
AND time > ?";
|
AND time > ?";
|
||||||
@ -44,7 +44,7 @@ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) {
|
|||||||
$suspensions[$row['roomID']][$row['type']] = $row;
|
$suspensions[$row['roomID']][$row['type']] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
\wcf\util\ChatUtil::writeUserData(array('suspensions' => $suspensions), $user);
|
\chat\util\ChatUtil::writeUserData(array('suspensions' => $suspensions), $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $suspensions;
|
return $suspensions;
|
||||||
@ -54,15 +54,15 @@ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) {
|
|||||||
* Returns the appropriate suspension for user, room and type.
|
* Returns the appropriate suspension for user, room and type.
|
||||||
*
|
*
|
||||||
* @param \wcf\data\user\User $user
|
* @param \wcf\data\user\User $user
|
||||||
* @param \wcf\data\chat\room\ChatRoom $room
|
* @param \chat\data\room\Room $room
|
||||||
* @param integer $type
|
* @param integer $type
|
||||||
* @return \wcf\data\chat\suspension\ChatSuspension
|
* @return \chat\data\suspension\Suspension
|
||||||
*/
|
*/
|
||||||
public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, \wcf\data\chat\room\ChatRoom $room, $type) {
|
public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, \chat\data\room\Room $room, $type) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_chat_suspension
|
chat".WCF_N."_suspension
|
||||||
WHERE
|
WHERE
|
||||||
userID = ?
|
userID = ?
|
||||||
AND roomID = ?
|
AND roomID = ?
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\suspension;
|
namespace chat\data\suspension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes chat-suspension-related actions.
|
* Executes chat-suspension-related actions.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.suspension
|
* @subpackage data.suspension
|
||||||
*/
|
*/
|
||||||
class ChatSuspensionAction extends \wcf\data\AbstractDatabaseObjectAction {
|
class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
* @see \wcf\data\AbstractDatabaseObjectAction::$className
|
||||||
*/
|
*/
|
||||||
protected $className = '\wcf\data\chat\suspension\ChatSuspensionEditor';
|
protected $className = '\chat\data\suspension\SuspensionEditor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes expired suspensions.
|
* Deletes expired suspensions.
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\data\chat\suspension;
|
namespace chat\data\suspension;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides functions to edit chat suspensions.
|
* Provides functions to edit chat suspensions.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage data.chat.suspension
|
* @subpackage data.chat.suspension
|
||||||
*/
|
*/
|
||||||
class ChatSuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
|
class SuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
* @see \wcf\data\DatabaseObjectDecorator::$baseClass
|
||||||
*/
|
*/
|
||||||
protected static $baseClass = '\wcf\data\chat\suspension\ChatSuspension';
|
protected static $baseClass = '\chat\data\suspension\Suspension';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the suspension cache.
|
* Clears the suspension cache.
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\form;
|
namespace chat\form;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\exception\UserInputException;
|
use \wcf\system\exception\UserInputException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
@ -9,12 +9,12 @@
|
|||||||
* Inserts a message
|
* Inserts a message
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage form
|
* @subpackage form
|
||||||
*/
|
*/
|
||||||
class ChatForm extends AbstractForm {
|
class ChatForm extends \wcf\form\AbstractForm {
|
||||||
/**
|
/**
|
||||||
* Should HTML be enabled for this message.
|
* Should HTML be enabled for this message.
|
||||||
*
|
*
|
||||||
@ -98,11 +98,11 @@ public function __run() {
|
|||||||
* @see \wcf\page\IPage::readData()
|
* @see \wcf\page\IPage::readData()
|
||||||
*/
|
*/
|
||||||
public function readData() {
|
public function readData() {
|
||||||
$this->userData['color'] = \wcf\util\ChatUtil::readUserData('color');
|
$this->userData['color'] = \chat\util\ChatUtil::readUserData('color');
|
||||||
$this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID');
|
$this->userData['roomID'] = \chat\util\ChatUtil::readUserData('roomID');
|
||||||
$this->userData['away'] = \wcf\util\ChatUtil::readUserData('away');
|
$this->userData['away'] = \chat\util\ChatUtil::readUserData('away');
|
||||||
|
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$cache = data\room\Room::getCache();
|
||||||
if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
|
if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException();
|
||||||
$this->room = $cache[$this->userData['roomID']];
|
$this->room = $cache[$this->userData['roomID']];
|
||||||
|
|
||||||
@ -142,56 +142,56 @@ public function validate() {
|
|||||||
public function save() {
|
public function save() {
|
||||||
parent::save();
|
parent::save();
|
||||||
|
|
||||||
\wcf\util\ChatUtil::writeUserData(array('away' => null));
|
\chat\util\ChatUtil::writeUserData(array('away' => null));
|
||||||
$commandHandler = new \wcf\system\chat\command\CommandHandler($this->message);
|
$commandHandler = new \chat\system\command\CommandHandler($this->message);
|
||||||
if ($commandHandler->isCommand()) {
|
if ($commandHandler->isCommand()) {
|
||||||
try {
|
try {
|
||||||
$command = $commandHandler->loadCommand();
|
$command = $commandHandler->loadCommand();
|
||||||
|
|
||||||
if ($command->enableSmilies != \wcf\system\chat\command\ICommand::SETTING_USER) $this->enableSmilies = $command->enableSmilies;
|
if ($command->enableSmilies != \chat\system\command\ICommand::SETTING_USER) $this->enableSmilies = $command->enableSmilies;
|
||||||
$this->enableHTML = $command->enableHTML;
|
$this->enableHTML = $command->enableHTML;
|
||||||
if ($command->enableBBCodes != \wcf\system\chat\command\ICommand::SETTING_USER) $this->enableBBCodes = $command->enableBBCodes;
|
if ($command->enableBBCodes != \chat\system\command\ICommand::SETTING_USER) $this->enableBBCodes = $command->enableBBCodes;
|
||||||
|
|
||||||
$type = $command->getType();
|
$type = $command->getType();
|
||||||
$this->message = $command->getMessage();
|
$this->message = $command->getMessage();
|
||||||
$receiver = $command->getReceiver();
|
$receiver = $command->getReceiver();
|
||||||
}
|
}
|
||||||
catch (\wcf\system\chat\command\NotFoundException $e) {
|
catch (\chat\system\command\NotFoundException $e) {
|
||||||
$this->message = WCF::getLanguage()->get('wcf.chat.error.notFound');
|
$this->message = WCF::getLanguage()->get('wcf.chat.error.notFound');
|
||||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
$type = data\message\Message::TYPE_ERROR;
|
||||||
$receiver = WCF::getUser()->userID;
|
$receiver = WCF::getUser()->userID;
|
||||||
}
|
}
|
||||||
catch (\wcf\system\chat\command\UserNotFoundException $e) {
|
catch (\chat\system\command\UserNotFoundException $e) {
|
||||||
$this->message = WCF::getLanguage()->getDynamicVariable('wcf.chat.error.userNotFound', array('username' => $e->getUsername()));
|
$this->message = WCF::getLanguage()->getDynamicVariable('wcf.chat.error.userNotFound', array('username' => $e->getUsername()));
|
||||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
$type = data\message\Message::TYPE_ERROR;
|
||||||
$receiver = WCF::getUser()->userID;
|
$receiver = WCF::getUser()->userID;
|
||||||
$this->enableHTML = 1;
|
$this->enableHTML = 1;
|
||||||
}
|
}
|
||||||
catch (\wcf\system\exception\PermissionDeniedException $e) {
|
catch (\wcf\system\exception\PermissionDeniedException $e) {
|
||||||
$this->message = WCF::getLanguage()->get('wcf.chat.error.permissionDenied');
|
$this->message = WCF::getLanguage()->get('wcf.chat.error.permissionDenied');
|
||||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
$type = data\message\Message::TYPE_ERROR;
|
||||||
$receiver = WCF::getUser()->userID;
|
$receiver = WCF::getUser()->userID;
|
||||||
}
|
}
|
||||||
catch (\Exception $e) {
|
catch (\Exception $e) {
|
||||||
$this->message = WCF::getLanguage()->get('wcf.chat.error.exception');
|
$this->message = WCF::getLanguage()->get('wcf.chat.error.exception');
|
||||||
$type = chat\message\ChatMessage::TYPE_ERROR;
|
$type = data\message\Message::TYPE_ERROR;
|
||||||
$receiver = WCF::getUser()->userID;
|
$receiver = WCF::getUser()->userID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$type = chat\message\ChatMessage::TYPE_NORMAL;
|
$type = data\message\Message::TYPE_NORMAL;
|
||||||
$receiver = null;
|
$receiver = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark user as back
|
// mark user as back
|
||||||
if ($this->userData['away'] !== null) {
|
if ($this->userData['away'] !== null) {
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $this->room->roomID,
|
'roomID' => $this->room->roomID,
|
||||||
'sender' => WCF::getUser()->userID,
|
'sender' => WCF::getUser()->userID,
|
||||||
'username' => WCF::getUser()->username,
|
'username' => WCF::getUser()->username,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => chat\message\ChatMessage::TYPE_BACK,
|
'type' => data\message\Message::TYPE_BACK,
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'color1' => $this->userData['color'][1],
|
'color1' => $this->userData['color'][1],
|
||||||
'color2' => $this->userData['color'][2]
|
'color2' => $this->userData['color'][2]
|
||||||
@ -200,7 +200,7 @@ public function save() {
|
|||||||
$messageAction->executeAction();
|
$messageAction->executeAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->objectAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$this->objectAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $this->room->roomID,
|
'roomID' => $this->room->roomID,
|
||||||
'sender' => WCF::getUser()->userID,
|
'sender' => WCF::getUser()->userID,
|
||||||
@ -219,7 +219,7 @@ public function save() {
|
|||||||
$this->objectAction->executeAction();
|
$this->objectAction->executeAction();
|
||||||
|
|
||||||
// add activity points
|
// add activity points
|
||||||
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.wcf.chat.activityPointEvent.message', TIME_NOW, WCF::getUser()->userID);
|
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.message', TIME_NOW, WCF::getUser()->userID);
|
||||||
|
|
||||||
$this->saved();
|
$this->saved();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace chat\page;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\cache\CacheHandler;
|
use \wcf\system\cache\CacheHandler;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -8,19 +8,12 @@
|
|||||||
* Shows the chat-interface
|
* Shows the chat-interface
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage page
|
* @subpackage page
|
||||||
*/
|
*/
|
||||||
class ChatPage extends AbstractPage {
|
class ChatPage extends \wcf\page\AbstractPage {
|
||||||
/**
|
|
||||||
* The version of this installation of Tims Chat 3.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $chatVersion = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see wcf\page\AbstractPage::$loginRequired
|
* @see wcf\page\AbstractPage::$loginRequired
|
||||||
*/
|
*/
|
||||||
@ -39,14 +32,14 @@ class ChatPage extends AbstractPage {
|
|||||||
/**
|
/**
|
||||||
* The last X messages for the current room.
|
* The last X messages for the current room.
|
||||||
*
|
*
|
||||||
* @var array<\wcf\data\chat\message\ChatMessage>
|
* @var array<\chat\data\message\Message>
|
||||||
*/
|
*/
|
||||||
public $newestMessages = array();
|
public $newestMessages = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current room.
|
* The current room.
|
||||||
*
|
*
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Room
|
||||||
*/
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
@ -60,7 +53,7 @@ class ChatPage extends AbstractPage {
|
|||||||
/**
|
/**
|
||||||
* List of accessible rooms.
|
* List of accessible rooms.
|
||||||
*
|
*
|
||||||
* @var \wcf\data\chat\room\ChatRoomList
|
* @var \chat\data\room\RoomList
|
||||||
*/
|
*/
|
||||||
public $rooms = array();
|
public $rooms = array();
|
||||||
|
|
||||||
@ -101,25 +94,17 @@ public function assignVariables() {
|
|||||||
parent::assignVariables();
|
parent::assignVariables();
|
||||||
|
|
||||||
WCF::getTPL()->assign(array(
|
WCF::getTPL()->assign(array(
|
||||||
'chatVersion' => $this->chatVersion,
|
|
||||||
'newestMessages' => $this->newestMessages,
|
'newestMessages' => $this->newestMessages,
|
||||||
'room' => $this->room,
|
'room' => $this->room,
|
||||||
'roomID' => $this->roomID,
|
'roomID' => $this->roomID,
|
||||||
'rooms' => $this->rooms,
|
'rooms' => $this->rooms,
|
||||||
'defaultSmilies' => $this->defaultSmilies,
|
'defaultSmilies' => $this->defaultSmilies,
|
||||||
'smileyCategories' => $this->smileyCategories,
|
'smileyCategories' => $this->smileyCategories,
|
||||||
'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.wcf.chat.ChatPage'),
|
'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.chat.ChatPage'),
|
||||||
'sidebarName' => 'be.bastelstu.wcf.chat.ChatPage'
|
'sidebarName' => 'be.bastelstu.chat.ChatPage'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads chat-version. Used to avoid caching of JS-File when Tims Chat is updated.
|
|
||||||
*/
|
|
||||||
public function readChatVersion() {
|
|
||||||
return $this->chatVersion = \wcf\data\package\PackageCache::getInstance()->getPackage(\wcf\util\ChatUtil::getPackageID())->packageVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\IPage::readData()
|
* @see \wcf\page\IPage::readData()
|
||||||
*/
|
*/
|
||||||
@ -127,21 +112,21 @@ public function readData() {
|
|||||||
parent::readData();
|
parent::readData();
|
||||||
|
|
||||||
$this->readRoom();
|
$this->readRoom();
|
||||||
$this->userData['color'] = \wcf\util\ChatUtil::readUserData('color');
|
$this->userData['color'] = \chat\util\ChatUtil::readUserData('color');
|
||||||
\wcf\util\ChatUtil::writeUserData(array(
|
\chat\util\ChatUtil::writeUserData(array(
|
||||||
'roomID' => $this->room->roomID,
|
'roomID' => $this->room->roomID,
|
||||||
'away' => null,
|
'away' => null,
|
||||||
'lastActivity' => TIME_NOW
|
'lastActivity' => TIME_NOW
|
||||||
));
|
));
|
||||||
|
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $this->room->roomID,
|
'roomID' => $this->room->roomID,
|
||||||
'sender' => WCF::getUser()->userID,
|
'sender' => WCF::getUser()->userID,
|
||||||
'username' => WCF::getUser()->username,
|
'username' => WCF::getUser()->username,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => chat\message\ChatMessage::TYPE_JOIN,
|
'type' => \chat\data\message\Message::TYPE_JOIN,
|
||||||
'message' => serialize(array('ipAddress' => \wcf\util\UserUtil::convertIPv6To4(\wcf\util\UserUtil::getIpAddress()))),
|
'message' => serialize(array('ipAddress' => \wcf\util\UserUtil::convertIPv6To4(\wcf\util\UserUtil::getIpAddress()))),
|
||||||
'color1' => $this->userData['color'][1],
|
'color1' => $this->userData['color'][1],
|
||||||
'color2' => $this->userData['color'][2]
|
'color2' => $this->userData['color'][2]
|
||||||
@ -151,12 +136,12 @@ public function readData() {
|
|||||||
$messageAction->getReturnValues();
|
$messageAction->getReturnValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES);
|
$this->newestMessages = data\message\MessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES);
|
||||||
try {
|
try {
|
||||||
\wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID));
|
\chat\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID));
|
||||||
}
|
}
|
||||||
catch (\wcf\system\exception\SystemException $e) {
|
catch (\wcf\system\exception\SystemException $e) {
|
||||||
\wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0));
|
\chat\util\ChatUtil::writeUserData(array('lastSeen' => 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
$smileyCategories = \wcf\data\smiley\SmileyCache::getInstance()->getCategories();
|
$smileyCategories = \wcf\data\smiley\SmileyCache::getInstance()->getCategories();
|
||||||
@ -166,7 +151,6 @@ public function readData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->defaultSmilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies();
|
$this->defaultSmilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies();
|
||||||
$this->readChatVersion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,28 +161,12 @@ public function readParameters() {
|
|||||||
|
|
||||||
$this->request = $this;
|
$this->request = $this;
|
||||||
switch ($this->action) {
|
switch ($this->action) {
|
||||||
case 'Message':
|
|
||||||
$this->request = new ChatMessagePage();
|
|
||||||
$this->request->__run();
|
|
||||||
exit;
|
|
||||||
case 'Log':
|
case 'Log':
|
||||||
$this->request = new ChatLogPage();
|
$this->request = new LogPage();
|
||||||
$this->request->__run();
|
|
||||||
exit;
|
|
||||||
case 'RefreshRoomList':
|
|
||||||
$this->request = new ChatRefreshRoomListPage();
|
|
||||||
$this->request->__run();
|
$this->request->__run();
|
||||||
exit;
|
exit;
|
||||||
case 'Send':
|
case 'Send':
|
||||||
$this->request = new \wcf\form\ChatForm();
|
$this->request = new \chat\form\ChatForm();
|
||||||
$this->request->__run();
|
|
||||||
exit;
|
|
||||||
case 'Leave':
|
|
||||||
$this->request = new \wcf\action\ChatLeaveAction();
|
|
||||||
$this->request->__run();
|
|
||||||
exit;
|
|
||||||
case 'Copyright':
|
|
||||||
$this->request = new ChatCopyrightPage();
|
|
||||||
$this->request->__run();
|
$this->request->__run();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -211,7 +179,7 @@ public function readParameters() {
|
|||||||
* Reads room data.
|
* Reads room data.
|
||||||
*/
|
*/
|
||||||
public function readRoom() {
|
public function readRoom() {
|
||||||
$this->rooms = chat\room\ChatRoom::getCache();
|
$this->rooms = data\room\Room::getCache();
|
||||||
|
|
||||||
if ($this->roomID === 0) {
|
if ($this->roomID === 0) {
|
||||||
// no room given
|
// no room given
|
||||||
@ -236,7 +204,7 @@ public function readRoom() {
|
|||||||
* @see \wcf\page\IPage::show()
|
* @see \wcf\page\IPage::show()
|
||||||
*/
|
*/
|
||||||
public function show() {
|
public function show() {
|
||||||
\wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat');
|
\wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('chat.header.menu.chat');
|
||||||
|
|
||||||
// remove index breadcrumb
|
// remove index breadcrumb
|
||||||
WCF::getBreadcrumbs()->remove(0);
|
WCF::getBreadcrumbs()->remove(0);
|
||||||
@ -244,7 +212,7 @@ public function show() {
|
|||||||
parent::show();
|
parent::show();
|
||||||
|
|
||||||
// add activity points
|
// add activity points
|
||||||
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.wcf.chat.activityPointEvent.join', TIME_NOW, WCF::getUser()->userID);
|
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', TIME_NOW, WCF::getUser()->userID);
|
||||||
|
|
||||||
// break if not using ajax
|
// break if not using ajax
|
||||||
if ($this->useTemplate) exit;
|
if ($this->useTemplate) exit;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace chat\page;
|
||||||
use \wcf\system\exception\IllegalLinkException;
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -7,12 +7,17 @@
|
|||||||
* Shows information about Tims chat.
|
* Shows information about Tims chat.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage page
|
* @subpackage page
|
||||||
*/
|
*/
|
||||||
class ChatCopyrightPage extends AbstractPage {
|
class CopyrightPage extends \wcf\page\AbstractPage {
|
||||||
|
/**
|
||||||
|
* @see wcf\page\AbstractPage::$loginRequired
|
||||||
|
*/
|
||||||
|
public $loginRequired = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\AbstractPage::$neededModules
|
* @see \wcf\page\AbstractPage::$neededModules
|
||||||
*/
|
*/
|
||||||
@ -25,59 +30,26 @@ class ChatCopyrightPage extends AbstractPage {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* shortcut for the active request
|
* shortcut for the active request
|
||||||
* @see wcf\system\request\Request::getRequestObject()
|
* @see \wcf\system\request\Request::getRequestObject()
|
||||||
*/
|
*/
|
||||||
public $request = null;
|
public $request = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disallows direct access.
|
* @see \wcf\page\AbstractPage::$templateName
|
||||||
*
|
|
||||||
* @see wcf\page\IPage::__run()
|
|
||||||
*/
|
*/
|
||||||
public function __run() {
|
public $templateName = '__copyright';
|
||||||
if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException();
|
|
||||||
|
|
||||||
parent::__run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\IPage::readParameters()
|
* @see \wcf\page\IPage::assignVariables()
|
||||||
*/
|
*/
|
||||||
public function readParameters() {
|
public function assignVariables() {
|
||||||
// ###
|
parent::assignVariables();
|
||||||
// ## ##
|
|
||||||
// # #
|
|
||||||
// # ##### #
|
|
||||||
// # # # #
|
|
||||||
// # # * * # #
|
|
||||||
// # # # #
|
|
||||||
// # # # #
|
|
||||||
// # ### #
|
|
||||||
// # #
|
|
||||||
// #######
|
|
||||||
// # # # #
|
|
||||||
// # # # #
|
|
||||||
// # # # #
|
|
||||||
|
|
||||||
if (isset($_GET['sheep'])) $this->useTemplate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \wcf\page\IPage::show()
|
|
||||||
*/
|
|
||||||
public function show() {
|
|
||||||
// guests are not supported
|
|
||||||
if (!WCF::getUser()->userID) {
|
|
||||||
throw new \wcf\system\exception\PermissionDeniedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::show();
|
|
||||||
if ($this->useTemplate) exit;
|
|
||||||
@header('Content-type: image/png');
|
|
||||||
\wcf\util\HeaderUtil::sendNoCacheHeaders();
|
|
||||||
$images = explode("\n\n", file_get_contents(__FILE__, null, null, __COMPILER_HALT_OFFSET__+2));
|
$images = explode("\n\n", file_get_contents(__FILE__, null, null, __COMPILER_HALT_OFFSET__+2));
|
||||||
echo base64_decode($images[array_rand($images)]);
|
|
||||||
exit;
|
WCF::getTPL()->assign(array(
|
||||||
|
'background' => str_replace("\n", '', $images[array_rand($images)])
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace chat\page;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\exception\IllegalLinkException;
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\exception\PermissionDeniedException;
|
use \wcf\system\exception\PermissionDeniedException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
@ -9,12 +9,12 @@
|
|||||||
* Shows the chat-log.
|
* Shows the chat-log.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage page
|
* @subpackage page
|
||||||
*/
|
*/
|
||||||
class ChatLogPage extends AbstractPage {
|
class LogPage extends \wcf\page\AbstractPage {
|
||||||
/**
|
/**
|
||||||
* @see wcf\page\AbstractPage::$loginRequired
|
* @see wcf\page\AbstractPage::$loginRequired
|
||||||
*/
|
*/
|
||||||
@ -45,13 +45,13 @@ class ChatLogPage extends AbstractPage {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* given room
|
* given room
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Chat
|
||||||
*/
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all rooms in the current installation
|
* all rooms in the current installation
|
||||||
* @var array<\wcf\data\chat\room\ChatRoom>
|
* @var array<\chat\data\room\Room>
|
||||||
*/
|
*/
|
||||||
public $rooms = array();
|
public $rooms = array();
|
||||||
|
|
||||||
@ -82,9 +82,7 @@ public function assignVariables() {
|
|||||||
'messages' => $this->messages,
|
'messages' => $this->messages,
|
||||||
'room' => $this->room,
|
'room' => $this->room,
|
||||||
'roomID' => $this->roomID,
|
'roomID' => $this->roomID,
|
||||||
'rooms' => $this->rooms,
|
'rooms' => $this->rooms
|
||||||
'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.wcf.chat.ChatLogPage'),
|
|
||||||
'sidebarName' => 'be.bastelstu.wcf.chat.ChatLogPage'
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,15 +101,15 @@ public function readParameters() {
|
|||||||
public function readData() {
|
public function readData() {
|
||||||
parent::readData();
|
parent::readData();
|
||||||
|
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$cache = data\room\Room::getCache();
|
||||||
if (!isset($cache[$this->roomID])) throw new IllegalLinkException();
|
if (!isset($cache[$this->roomID])) throw new IllegalLinkException();
|
||||||
|
|
||||||
$this->room = $cache[$this->roomID];
|
$this->room = $cache[$this->roomID];
|
||||||
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
$ph = new \wcf\system\chat\permission\ChatPermissionHandler();
|
$ph = new \chat\system\permission\PermissionHandler();
|
||||||
if (!$ph->getPermission($this->room, 'mod.canReadLog')) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$ph->getPermission($this->room, 'mod.canReadLog')) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
|
|
||||||
// TODO: actually read the correct messages
|
// TODO: actually read the correct messages
|
||||||
$this->messages = chat\message\ChatMessageList::getNewestMessages($this->room, 150);
|
$this->messages = data\message\MessageList::getNewestMessages($this->room, 150);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace chat\page;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\exception\IllegalLinkException;
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
@ -8,12 +8,12 @@
|
|||||||
* Loads new messages.
|
* Loads new messages.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage page
|
* @subpackage page
|
||||||
*/
|
*/
|
||||||
class ChatMessagePage extends AbstractPage {
|
class NewMessagesPage extends \wcf\page\AbstractPage {
|
||||||
/**
|
/**
|
||||||
* @see wcf\page\AbstractPage::$loginRequired
|
* @see wcf\page\AbstractPage::$loginRequired
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ class ChatMessagePage extends AbstractPage {
|
|||||||
/**
|
/**
|
||||||
* The room the user joined.
|
* The room the user joined.
|
||||||
*
|
*
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Room
|
||||||
*/
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
@ -55,23 +55,6 @@ class ChatMessagePage extends AbstractPage {
|
|||||||
*/
|
*/
|
||||||
public $useTemplate = false;
|
public $useTemplate = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* shortcut for the active request
|
|
||||||
* @see wcf\system\request\Request::getRequestObject()
|
|
||||||
*/
|
|
||||||
public $request = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disallows direct access.
|
|
||||||
*
|
|
||||||
* @see wcf\page\IPage::__run()
|
|
||||||
*/
|
|
||||||
public function __run() {
|
|
||||||
if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException();
|
|
||||||
|
|
||||||
parent::__run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\Page::readData()
|
* @see \wcf\page\Page::readData()
|
||||||
*/
|
*/
|
||||||
@ -82,21 +65,21 @@ public function readData() {
|
|||||||
$this->readMessages();
|
$this->readMessages();
|
||||||
$this->users = $this->room->getUsers();
|
$this->users = $this->room->getUsers();
|
||||||
|
|
||||||
$deadUsers = \wcf\util\ChatUtil::getDiedUsers();
|
$deadUsers = \chat\util\ChatUtil::getDiedUsers();
|
||||||
foreach ($deadUsers as $deadUser) {
|
foreach ($deadUsers as $deadUser) {
|
||||||
if (!$deadUser) continue;
|
if (!$deadUser) continue;
|
||||||
|
|
||||||
$user = new \wcf\data\user\User($deadUser['userID']);
|
$user = new \wcf\data\user\User($deadUser['userID']);
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
$userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user);
|
$userData['color'] = \chat\util\ChatUtil::readUserData('color', $user);
|
||||||
|
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $deadUser['roomID'],
|
'roomID' => $deadUser['roomID'],
|
||||||
'sender' => $user->userID,
|
'sender' => $user->userID,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => chat\message\ChatMessage::TYPE_LEAVE,
|
'type' => data\message\Message::TYPE_LEAVE,
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'color1' => $userData['color'][1],
|
'color1' => $userData['color'][1],
|
||||||
'color2' => $userData['color'][2]
|
'color2' => $userData['color'][2]
|
||||||
@ -104,7 +87,7 @@ public function readData() {
|
|||||||
));
|
));
|
||||||
$messageAction->executeAction();
|
$messageAction->executeAction();
|
||||||
}
|
}
|
||||||
\wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
\chat\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,17 +95,17 @@ public function readData() {
|
|||||||
* Fetches the new messages
|
* Fetches the new messages
|
||||||
*/
|
*/
|
||||||
public function readMessages() {
|
public function readMessages() {
|
||||||
$this->messages = chat\message\ChatMessageList::getMessagesSince($this->room, \wcf\util\ChatUtil::readUserData('lastSeen'));
|
$this->messages = data\message\MessageList::getMessagesSince($this->room, \chat\util\ChatUtil::readUserData('lastSeen'));
|
||||||
|
|
||||||
// update last seen message
|
// update last seen message
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
MAX(messageID)
|
MAX(messageID)
|
||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_chat_message";
|
chat".WCF_N."_message";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
\wcf\util\ChatUtil::writeUserData(array(
|
\chat\util\ChatUtil::writeUserData(array(
|
||||||
'lastSeen' => $stmt->fetchColumn(),
|
'lastSeen' => $stmt->fetchColumn(),
|
||||||
'lastActivity' => TIME_NOW
|
'lastActivity' => TIME_NOW
|
||||||
));
|
));
|
||||||
@ -132,8 +115,8 @@ public function readMessages() {
|
|||||||
* Initializes the room databaseobject.
|
* Initializes the room databaseobject.
|
||||||
*/
|
*/
|
||||||
public function readRoom() {
|
public function readRoom() {
|
||||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
$roomID = \chat\util\ChatUtil::readUserData('roomID');
|
||||||
$cache = chat\room\ChatRoom::getCache();
|
$cache = data\room\Room::getCache();
|
||||||
if (!isset($cache[$roomID])) throw new IllegalLinkException();
|
if (!isset($cache[$roomID])) throw new IllegalLinkException();
|
||||||
|
|
||||||
$this->room = $cache[$roomID];
|
$this->room = $cache[$roomID];
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\page;
|
namespace chat\page;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
use \wcf\system\cache\CacheHandler;
|
use \wcf\system\cache\CacheHandler;
|
||||||
use \wcf\ystem\exception\IllegalLinkException;
|
use \wcf\system\exception\IllegalLinkException;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the chat-interface
|
* Outputs roomlist.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage page
|
* @subpackage page
|
||||||
*/
|
*/
|
||||||
class ChatRefreshRoomListPage extends AbstractPage {
|
class RoomListPage extends \wcf\page\AbstractPage {
|
||||||
/**
|
/**
|
||||||
* @see wcf\page\AbstractPage::$loginRequired
|
* @see wcf\page\AbstractPage::$loginRequired
|
||||||
*/
|
*/
|
||||||
@ -32,13 +32,13 @@ class ChatRefreshRoomListPage extends AbstractPage {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* the room the user current is in
|
* the room the user current is in
|
||||||
* @var \wcf\data\chat\room\ChatRoom
|
* @var \chat\data\room\Room
|
||||||
*/
|
*/
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all rooms in the current installation
|
* all rooms in the current installation
|
||||||
* @var array<\wcf\data\chat\room\ChatRoom>
|
* @var array<\chat\data\room\Room>
|
||||||
*/
|
*/
|
||||||
public $rooms = array();
|
public $rooms = array();
|
||||||
|
|
||||||
@ -47,32 +47,15 @@ class ChatRefreshRoomListPage extends AbstractPage {
|
|||||||
*/
|
*/
|
||||||
public $useTemplate = false;
|
public $useTemplate = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* shortcut for the active request
|
|
||||||
* @see wcf\system\request\Request::getRequestObject()
|
|
||||||
*/
|
|
||||||
public $request = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disallows direct access.
|
|
||||||
*
|
|
||||||
* @see wcf\page\IPage::__run()
|
|
||||||
*/
|
|
||||||
public function __run() {
|
|
||||||
if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException();
|
|
||||||
|
|
||||||
parent::__run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\page\IPage::readData()
|
* @see \wcf\page\IPage::readData()
|
||||||
*/
|
*/
|
||||||
public function readData() {
|
public function readData() {
|
||||||
parent::readData();
|
parent::readData();
|
||||||
|
|
||||||
$this->rooms = chat\room\ChatRoom::getCache();
|
$this->rooms = data\room\Room::getCache();
|
||||||
|
|
||||||
$roomID = \wcf\util\ChatUtil::readUserData('roomID');
|
$roomID = \chat\util\ChatUtil::readUserData('roomID');
|
||||||
if (!isset($this->rooms[$roomID])) throw new IllegalLinkException();
|
if (!isset($this->rooms[$roomID])) throw new IllegalLinkException();
|
||||||
$this->room = $this->rooms[$roomID];
|
$this->room = $this->rooms[$roomID];
|
||||||
}
|
}
|
||||||
@ -91,6 +74,7 @@ public function show() {
|
|||||||
$json[] = array(
|
$json[] = array(
|
||||||
'title' => WCF::getLanguage()->get($room->title),
|
'title' => WCF::getLanguage()->get($room->title),
|
||||||
'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||||
|
'application' => 'chat',
|
||||||
'object' => $room
|
'object' => $room
|
||||||
)),
|
)),
|
||||||
'active' => $room->roomID == $this->room->roomID
|
'active' => $room->roomID == $this->room->roomID
|
23
file/lib/system/CHATCore.class.php
Normal file
23
file/lib/system/CHATCore.class.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace chat\system;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chat core
|
||||||
|
*
|
||||||
|
* @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 system
|
||||||
|
*/
|
||||||
|
class CHATCore extends \wcf\system\application\AbstractApplication {
|
||||||
|
/**
|
||||||
|
* @see wcf\system\application\AbstractApplication::$abbreviation
|
||||||
|
*/
|
||||||
|
protected $abbreviation = 'chat';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see wcf\system\application\IApplication::__run()
|
||||||
|
*/
|
||||||
|
public function __run() {}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\cache\builder;
|
namespace chat\system\cache\builder;
|
||||||
use wcf\system\WCF;
|
use wcf\system\WCF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches the chat permissions for a combination of user groups.
|
* Caches the chat permissions for a combination of user groups.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus, Marcel Werk
|
* @author Tim Düsterhus, Marcel Werk
|
||||||
* @copyright 2010-2012 WoltLab GmbH
|
* @copyright 2010-2013 WoltLab GmbH
|
||||||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
|
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.cache.builder
|
* @subpackage system.cache.builder
|
||||||
*/
|
*/
|
||||||
class ChatPermissionCacheBuilder implements ICacheBuilder {
|
class PermissionCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder {
|
||||||
/**
|
/**
|
||||||
* @see wcf\system\cache\ICacheBuilder::getData()
|
* @see wcf\system\cache\ICacheBuilder::getData()
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ public function getData(array $cacheResource) {
|
|||||||
|
|
||||||
if (count($groupIDs)) {
|
if (count($groupIDs)) {
|
||||||
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
|
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
|
||||||
$conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room')));
|
$conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room')));
|
||||||
$conditionBuilder->add('option_to_group.optionID = acl_option.optionID');
|
$conditionBuilder->add('option_to_group.optionID = acl_option.optionID');
|
||||||
$conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs));
|
$conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs));
|
||||||
$sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue,
|
$sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue,
|
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\cache\builder;
|
namespace chat\system\cache\builder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches all chat rooms.
|
* Caches all chat rooms.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.cache.builder
|
* @subpackage system.cache.builder
|
||||||
*/
|
*/
|
||||||
class ChatRoomCacheBuilder implements ICacheBuilder {
|
class RoomCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\cache\ICacheBuilder::getData()
|
* @see \wcf\system\cache\ICacheBuilder::getData()
|
||||||
*/
|
*/
|
||||||
public function getData(array $cacheResource) {
|
public function getData(array $cacheResource) {
|
||||||
// get all chat rooms
|
// get all chat rooms
|
||||||
$roomList = new \wcf\data\chat\room\ChatRoomList();
|
$roomList = new \chat\data\room\RoomList();
|
||||||
$roomList->sqlOrderBy = "chat_room.position";
|
$roomList->sqlOrderBy = "room.position";
|
||||||
$roomList->readObjects();
|
$roomList->readObjects();
|
||||||
|
|
||||||
return $roomList->getObjects();
|
return $roomList->getObjects();
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
use \wcf\system\event\EventHandler;
|
use \wcf\system\event\EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation for commands.
|
* Default implementation for commands.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
abstract class AbstractCommand implements ICommand {
|
abstract class AbstractCommand implements ICommand {
|
||||||
/**
|
/**
|
||||||
* Instance of the CommandHandler
|
* Instance of the CommandHandler
|
||||||
*
|
*
|
||||||
* @var \wcf\system\chat\command\CommandHandler
|
* @var \chat\system\command\CommandHandler
|
||||||
*/
|
*/
|
||||||
public $commandHandler = null;
|
public $commandHandler = null;
|
||||||
|
|
||||||
@ -23,8 +23,8 @@ abstract class AbstractCommand implements ICommand {
|
|||||||
* Should HTML be enabled?
|
* Should HTML be enabled?
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_OFF
|
* @see \chat\system\command\ICommand::SETTING_OFF
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_ON
|
* @see \chat\system\command\ICommand::SETTING_ON
|
||||||
*/
|
*/
|
||||||
public $enableHTML = ICommand::SETTING_OFF;
|
public $enableHTML = ICommand::SETTING_OFF;
|
||||||
|
|
||||||
@ -32,9 +32,9 @@ abstract class AbstractCommand implements ICommand {
|
|||||||
* Should BBCodes be enabled?
|
* Should BBCodes be enabled?
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_OFF
|
* @see \chat\system\command\ICommand::SETTING_OFF
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_ON
|
* @see \chat\system\command\ICommand::SETTING_ON
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_USER
|
* @see \chat\system\command\ICommand::SETTING_USER
|
||||||
*/
|
*/
|
||||||
public $enableBBCodes = ICommand::SETTING_OFF;
|
public $enableBBCodes = ICommand::SETTING_OFF;
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ abstract class AbstractCommand implements ICommand {
|
|||||||
* Should smilies be enabled?
|
* Should smilies be enabled?
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_OFF
|
* @see \chat\system\command\ICommand::SETTING_OFF
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_ON
|
* @see \chat\system\command\ICommand::SETTING_ON
|
||||||
* @see \wcf\system\chat\command\ICommand::SETTING_USER
|
* @see \chat\system\command\ICommand::SETTING_USER
|
||||||
*/
|
*/
|
||||||
public $enableSmilies = ICommand::SETTING_OFF;
|
public $enableSmilies = ICommand::SETTING_OFF;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public function didInit() {
|
|||||||
/**
|
/**
|
||||||
* Default-Receiver: Everyone
|
* Default-Receiver: Everyone
|
||||||
*
|
*
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return null;
|
return null;
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
use \wcf\system\event\EventHandler;
|
use \wcf\system\event\EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation for restricted commands
|
* Default implementation for restricted commands
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
abstract class AbstractRestrictedCommand extends AbstractCommand implements IRestrictedCommand {
|
abstract class AbstractRestrictedCommand extends AbstractCommand implements IRestrictedCommand {
|
||||||
@ -21,7 +21,7 @@ public function __construct(CommandHandler $commandHandler) {
|
|||||||
/**
|
/**
|
||||||
* Fires checkPermission event.
|
* Fires checkPermission event.
|
||||||
*
|
*
|
||||||
* @see \wcf\system\chat\command\IRestrictedCommand
|
* @see \chat\system\command\IRestrictedCommand
|
||||||
*/
|
*/
|
||||||
public function checkPermission() {
|
public function checkPermission() {
|
||||||
EventHandler::getInstance()->fireAction($this, 'checkPermission');
|
EventHandler::getInstance()->fireAction($this, 'checkPermission');
|
@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles commands
|
* Handles commands
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
final class CommandHandler {
|
final class CommandHandler {
|
||||||
@ -73,7 +73,7 @@ public function loadCommand() {
|
|||||||
return new commands\PlainCommand($this);
|
return new commands\PlainCommand($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = '\wcf\system\chat\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for chat-commands.
|
* Interface for chat-commands.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
interface ICommand {
|
interface ICommand {
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for Restricted commands.
|
* Interface for Restricted commands.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
interface IRestrictedCommand {
|
interface IRestrictedCommand {
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when a command is not found.
|
* Thrown when a command is not found.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
class NotFoundException extends \Exception { }
|
class NotFoundException extends \Exception { }
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command;
|
namespace chat\system\command;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when a user is not found.
|
* Thrown when a user is not found.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command
|
* @subpackage system.chat.command
|
||||||
*/
|
*/
|
||||||
class UserNotFoundException extends \Exception {
|
class UserNotFoundException extends \Exception {
|
@ -1,40 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the user as away.
|
* Marks the user as away.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class AwayCommand extends \wcf\system\chat\command\AbstractCommand {
|
class AwayCommand extends \chat\system\command\AbstractCommand {
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
\wcf\util\ChatUtil::writeUserData(array('away' => $commandHandler->getParameters()));
|
\chat\util\ChatUtil::writeUserData(array('away' => $commandHandler->getParameters()));
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_AWAY;
|
return \chat\data\message\Message::TYPE_AWAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return serialize(array('message' => $this->commandHandler->getParameters()));
|
return serialize(array('message' => $this->commandHandler->getParameters()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return \wcf\system\WCF::getUser()->userID;
|
return \wcf\system\WCF::getUser()->userID;
|
@ -1,36 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\data\chat\suspension;
|
use \chat\data\suspension;
|
||||||
|
use \chat\util\ChatUtil;
|
||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\ChatUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bans a user.
|
* Bans a user.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class BanCommand extends MuteCommand {
|
class BanCommand extends MuteCommand {
|
||||||
public function executeAction() {
|
public function executeAction() {
|
||||||
if ($suspension = suspension\ChatSuspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\ChatSuspension::TYPE_BAN)) {
|
if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_BAN)) {
|
||||||
if ($suspension->time > TIME_NOW + $this->time) {
|
if ($suspension->time > TIME_NOW + $this->time) {
|
||||||
$this->fail = true;
|
$this->fail = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$editor = new suspension\ChatSuspensionEditor($suspension);
|
$editor = new suspension\SuspensionEditor($suspension);
|
||||||
$editor->delete();
|
$editor->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array(
|
$this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'userID' => $this->user->userID,
|
'userID' => $this->user->userID,
|
||||||
'roomID' => ChatUtil::readUserData('roomID'),
|
'roomID' => ChatUtil::readUserData('roomID'),
|
||||||
'type' => suspension\ChatSuspension::TYPE_BAN,
|
'type' => suspension\Suspension::TYPE_BAN,
|
||||||
'time' => TIME_NOW + $this->time
|
'time' => TIME_NOW + $this->time
|
||||||
)
|
)
|
||||||
));
|
));
|
@ -1,17 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the color of the username
|
* Changes the color of the username
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class ColorCommand extends \wcf\system\chat\command\AbstractCommand {
|
class ColorCommand extends \chat\system\command\AbstractCommand {
|
||||||
public static $colors = array(
|
public static $colors = array(
|
||||||
'red' => 0xFF0000,
|
'red' => 0xFF0000,
|
||||||
'blue' => 0x0000FF,
|
'blue' => 0x0000FF,
|
||||||
@ -36,7 +36,7 @@ class ColorCommand extends \wcf\system\chat\command\AbstractCommand {
|
|||||||
'oxford' => 0xF02D // looks like green
|
'oxford' => 0xF02D // looks like green
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
try {
|
try {
|
||||||
list($color[1], $color[2]) = explode(' ', $commandHandler->getParameters());
|
list($color[1], $color[2]) = explode(' ', $commandHandler->getParameters());
|
||||||
@ -49,33 +49,33 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
foreach ($color as $key => $val) {
|
foreach ($color as $key => $val) {
|
||||||
if (isset(self::$colors[$val])) $color[$key] = self::$colors[$val];
|
if (isset(self::$colors[$val])) $color[$key] = self::$colors[$val];
|
||||||
else {
|
else {
|
||||||
if (!$regex->match($val)) throw new \wcf\system\chat\command\NotFoundException();
|
if (!$regex->match($val)) throw new \chat\system\command\NotFoundException();
|
||||||
$matches = $regex->getMatches();
|
$matches = $regex->getMatches();
|
||||||
$val = $matches[1];
|
$val = $matches[1];
|
||||||
if (strlen($val) == 3) $val = $val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
|
if (strlen($val) == 3) $val = $val[0].$val[0].$val[1].$val[1].$val[2].$val[2];
|
||||||
$color[$key] = hexdec($val);
|
$color[$key] = hexdec($val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\wcf\util\ChatUtil::writeUserData(array('color' => $color));
|
\chat\util\ChatUtil::writeUserData(array('color' => $color));
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION;
|
return \chat\data\message\Message::TYPE_INFORMATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return 'color changed';
|
return 'color changed';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return \wcf\system\WCF::getUser()->userID;
|
return \wcf\system\WCF::getUser()->userID;
|
@ -1,28 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs everyone that the fish was freed. OH A NOEZ.
|
* Informs everyone that the fish was freed. OH A NOEZ.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class FreeCommand extends MeCommand {
|
class FreeCommand extends MeCommand {
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') {
|
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') {
|
||||||
throw new \wcf\system\chat\command\NotFoundException();
|
throw new \chat\system\command\NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return 'freed the fish. OH A NOEZ';
|
return 'freed the fish. OH A NOEZ';
|
@ -1,30 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
|
use \chat\util\ChatUtil;
|
||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\ChatUtil;
|
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows information about the specified user.
|
* Shows information about the specified user.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class InfoCommand extends \wcf\system\chat\command\AbstractCommand {
|
class InfoCommand extends \chat\system\command\AbstractCommand {
|
||||||
public $enableBBCodes = self::SETTING_ON;
|
public $enableBBCodes = self::SETTING_ON;
|
||||||
public $enableHTML = self::SETTING_ON;
|
public $enableHTML = self::SETTING_ON;
|
||||||
public $lines = array();
|
public $lines = array();
|
||||||
public $user = null;
|
public $user = null;
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
$this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ','));
|
$this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ','));
|
||||||
if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ','));
|
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ','));
|
||||||
|
|
||||||
// Username + link to profile
|
// Username + link to profile
|
||||||
$color = ChatUtil::readUserData('color', $this->user);
|
$color = ChatUtil::readUserData('color', $this->user);
|
||||||
@ -39,17 +39,18 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Room
|
// Room
|
||||||
$room = new \wcf\data\chat\room\ChatRoom(ChatUtil::readUserData('roomID', $this->user));
|
$room = new \chat\data\room\Room(ChatUtil::readUserData('roomID', $this->user));
|
||||||
if ($room->roomID && $room->canEnter()) {
|
if ($room->roomID && $room->canEnter()) {
|
||||||
$this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle();
|
$this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// IP-Address
|
// ip address
|
||||||
|
if (WCF::getSession()->getPermission('admin.user.canViewIpAddress')) {
|
||||||
$session = $this->fetchSession();
|
$session = $this->fetchSession();
|
||||||
if ($session) {
|
if ($session) {
|
||||||
// TODO: Check permission
|
|
||||||
$this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress;
|
$this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
@ -75,14 +76,14 @@ public function fetchSession() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION;
|
return \chat\data\message\Message::TYPE_INFORMATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
$lines = array();
|
$lines = array();
|
||||||
@ -93,7 +94,7 @@ public function getMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return \wcf\system\WCF::getUser()->userID;
|
return \wcf\system\WCF::getUser()->userID;
|
@ -1,34 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates an action. The message is shown without the colon.
|
* Indicates an action. The message is shown without the colon.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class MeCommand extends \wcf\system\chat\command\AbstractCommand {
|
class MeCommand extends \chat\system\command\AbstractCommand {
|
||||||
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_USER;
|
public $enableSmilies = \chat\system\command\ICommand::SMILEY_USER;
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_ME;
|
return \chat\data\message\Message::TYPE_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return $this->commandHandler->getParameters();
|
return $this->commandHandler->getParameters();
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\data\chat\suspension;
|
use \chat\data\suspension;
|
||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\ChatUtil;
|
use \chat\util\ChatUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mutes a user.
|
* Mutes a user.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class MuteCommand extends \wcf\system\chat\command\AbstractRestrictedCommand {
|
class MuteCommand extends \chat\system\command\AbstractRestrictedCommand {
|
||||||
public $user = null;
|
public $user = null;
|
||||||
public $time = 0;
|
public $time = 0;
|
||||||
public $suspensionAction = null;
|
public $suspensionAction = null;
|
||||||
@ -22,7 +22,7 @@ class MuteCommand extends \wcf\system\chat\command\AbstractRestrictedCommand {
|
|||||||
public $fail = false;
|
public $fail = false;
|
||||||
public $room = null;
|
public $room = null;
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
$parameters = $commandHandler->getParameters();
|
$parameters = $commandHandler->getParameters();
|
||||||
@ -31,11 +31,11 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
$this->time = ChatUtil::timeModifier(substr($parameters, $comma + 1));
|
$this->time = ChatUtil::timeModifier(substr($parameters, $comma + 1));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new \wcf\system\chat\command\NotFoundException();
|
throw new \chat\system\command\NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->user = User::getUserByUsername($username);
|
$this->user = User::getUserByUsername($username);
|
||||||
if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException($username);
|
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username);
|
||||||
|
|
||||||
$color = ChatUtil::readUserData('color', $this->user);
|
$color = ChatUtil::readUserData('color', $this->user);
|
||||||
$profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array(
|
$profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array(
|
||||||
@ -49,21 +49,21 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function executeAction() {
|
public function executeAction() {
|
||||||
if ($suspension = suspension\ChatSuspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\ChatSuspension::TYPE_MUTE)) {
|
if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_MUTE)) {
|
||||||
if ($suspension->time > TIME_NOW + $this->time) {
|
if ($suspension->time > TIME_NOW + $this->time) {
|
||||||
$this->fail = true;
|
$this->fail = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$editor = new suspension\ChatSuspensionEditor($suspension);
|
$editor = new suspension\SuspensionEditor($suspension);
|
||||||
$editor->delete();
|
$editor->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array(
|
$this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'userID' => $this->user->userID,
|
'userID' => $this->user->userID,
|
||||||
'roomID' => ChatUtil::readUserData('roomID'),
|
'roomID' => ChatUtil::readUserData('roomID'),
|
||||||
'type' => suspension\ChatSuspension::TYPE_MUTE,
|
'type' => suspension\Suspension::TYPE_MUTE,
|
||||||
'time' => TIME_NOW + $this->time
|
'time' => TIME_NOW + $this->time
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -71,18 +71,18 @@ public function executeAction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\IRestrictedChatCommand::checkPermission()
|
* @see \chat\system\command\IRestrictedChatCommand::checkPermission()
|
||||||
*/
|
*/
|
||||||
public function checkPermission() {
|
public function checkPermission() {
|
||||||
parent::checkPermission();
|
parent::checkPermission();
|
||||||
|
|
||||||
$this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room;
|
$this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room;
|
||||||
$ph = new \wcf\system\chat\permission\ChatPermissionHandler();
|
$ph = new \chat\system\permission\PermissionHandler();
|
||||||
if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('wcf\system\chat\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException();
|
if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('chat\system\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see wcf\system\chat\command\ICommand::getReceiver()
|
* @see chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
if ($this->fail) return WCF::getUser()->userID;
|
if ($this->fail) return WCF::getUser()->userID;
|
||||||
@ -91,15 +91,15 @@ public function getReceiver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
if ($this->fail) return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION;
|
if ($this->fail) return \chat\data\message\Message::TYPE_INFORMATION;
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE;
|
return \chat\data\message\Message::TYPE_MODERATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
if ($this->fail) return WCF::getLanguage()->get('wcf.chat.suspension.exists');
|
if ($this->fail) return WCF::getLanguage()->get('wcf.chat.suspension.exists');
|
||||||
@ -107,7 +107,7 @@ public function getMessage() {
|
|||||||
return serialize(array(
|
return serialize(array(
|
||||||
'link' => $this->link,
|
'link' => $this->link,
|
||||||
'until' => TIME_NOW + $this->time,
|
'until' => TIME_NOW + $this->time,
|
||||||
'type' => str_replace(array('wcf\system\chat\command\commands\\', 'command'), '', strtolower(get_class($this)))
|
'type' => str_replace(array('chat\system\command\commands\\', 'command'), '', strtolower(get_class($this)))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,34 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a message that starts with a slash.
|
* Sends a message that starts with a slash.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class PlainCommand extends \wcf\system\chat\command\AbstractCommand {
|
class PlainCommand extends \chat\system\command\AbstractCommand {
|
||||||
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_USER;
|
public $enableSmilies = \chat\system\command\ICommand::SMILEY_USER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_NORMAL;
|
return \chat\data\message\Message::TYPE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return \wcf\util\StringUtil::substring($this->commandHandler->getText(), 1);
|
return \wcf\util\StringUtil::substring($this->commandHandler->getText(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return null;
|
return null;
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\ChatUtil;
|
use \wcf\util\ChatUtil;
|
||||||
@ -8,21 +8,21 @@
|
|||||||
* Resets the color of a user
|
* Resets the color of a user
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class RestoreCommand extends \wcf\system\chat\command\AbstractRestrictedCommand {
|
class RestoreCommand extends \chat\system\command\AbstractRestrictedCommand {
|
||||||
public $enableHTML = 1;
|
public $enableHTML = 1;
|
||||||
public $user = null;
|
public $user = null;
|
||||||
public $link = '';
|
public $link = '';
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
$this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ','));
|
$this->user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ','));
|
||||||
if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ','));
|
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ','));
|
||||||
|
|
||||||
$this->link = '<span class="userLink" data-user-id="'.$this->user->userID.'" />';
|
$this->link = '<span class="userLink" data-user-id="'.$this->user->userID.'" />';
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\IRestrictedChatCommand::checkPermission()
|
* @see \chat\system\command\IRestrictedChatCommand::checkPermission()
|
||||||
*/
|
*/
|
||||||
public function checkPermission() {
|
public function checkPermission() {
|
||||||
parent::checkPermission();
|
parent::checkPermission();
|
||||||
@ -39,19 +39,19 @@ public function checkPermission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE;
|
return \chat\data\message\Message::TYPE_MODERATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return serialize(array(
|
return serialize(array(
|
||||||
'link' => $this->link,
|
'link' => $this->link,
|
||||||
'type' => str_replace(array('wcf\system\chat\command\commands\\', 'command'), '', strtolower(get_class($this)))
|
'type' => str_replace(array('chat\system\command\commands\\', 'command'), '', strtolower(get_class($this)))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
use \wcf\util\StringUtil;
|
use \wcf\util\StringUtil;
|
||||||
|
|
||||||
@ -7,19 +7,19 @@
|
|||||||
* Creates a temporary room
|
* Creates a temporary room
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class TemproomCommand extends \wcf\system\chat\command\AbstractRestrictedCommand {
|
class TemproomCommand extends \chat\system\command\AbstractRestrictedCommand {
|
||||||
public $roomName = '';
|
public $roomName = '';
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
// create room
|
// create room
|
||||||
$this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array(
|
$this->objectAction = new \chat\data\room\RoomAction(array(), 'create', array('data' => array(
|
||||||
'title' => 'Temproom',
|
'title' => 'Temproom',
|
||||||
'topic' => '',
|
'topic' => '',
|
||||||
'permanent' => 0,
|
'permanent' => 0,
|
||||||
@ -27,7 +27,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
)));
|
)));
|
||||||
$this->objectAction->executeAction();
|
$this->objectAction->executeAction();
|
||||||
$returnValues = $this->objectAction->getReturnValues();
|
$returnValues = $this->objectAction->getReturnValues();
|
||||||
$chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']);
|
$chatRoomEditor = new \chat\data\room\RoomEditor($returnValues['returnValues']);
|
||||||
$roomID = $returnValues['returnValues']->roomID;
|
$roomID = $returnValues['returnValues']->roomID;
|
||||||
$this->roomName = WCF::getLanguage()->getDynamicVariable('wcf.chat.room.titleTemp', array('roomID' => $roomID));
|
$this->roomName = WCF::getLanguage()->getDynamicVariable('wcf.chat.room.titleTemp', array('roomID' => $roomID));
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
));
|
));
|
||||||
|
|
||||||
// set permissions
|
// set permissions
|
||||||
$options = \wcf\data\acl\option\ACLOption::getOptions(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'))->getObjects();
|
$options = \wcf\data\acl\option\ACLOption::getOptions(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'))->getObjects();
|
||||||
$_POST['aclValues'] = array(
|
$_POST['aclValues'] = array(
|
||||||
'user' => array(
|
'user' => array(
|
||||||
// creators may do everything
|
// creators may do everything
|
||||||
@ -49,13 +49,13 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
\wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'));
|
\wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'));
|
||||||
\wcf\system\chat\permission\ChatPermissionHandler::clearCache();
|
\chat\system\permission\PermissionHandler::clearCache();
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\IRestrictedCommand::checkPermission()
|
* @see \chat\system\command\IRestrictedCommand::checkPermission()
|
||||||
*/
|
*/
|
||||||
public function checkPermission() {
|
public function checkPermission() {
|
||||||
parent::checkPermission();
|
parent::checkPermission();
|
||||||
@ -64,21 +64,21 @@ public function checkPermission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION;
|
return \chat\data\message\Message::TYPE_INFORMATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return $this->roomName;
|
return $this->roomName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return \wcf\system\WCF::getUser()->userID;
|
return \wcf\system\WCF::getUser()->userID;
|
@ -1,31 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the users that are online
|
* Shows the users that are online
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class WhereCommand extends \wcf\system\chat\command\AbstractCommand {
|
class WhereCommand extends \chat\system\command\AbstractCommand {
|
||||||
public $enableHTML = self::SETTING_ON;
|
public $enableHTML = self::SETTING_ON;
|
||||||
public $enableBBCodes = self::SETTING_ON;
|
public $enableBBCodes = self::SETTING_ON;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION;
|
return \chat\data\message\Message::TYPE_INFORMATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
$rooms = \wcf\data\chat\room\ChatRoom::getCache();
|
$rooms = \chat\data\room\Room::getCache();
|
||||||
|
|
||||||
foreach ($rooms as $room) {
|
foreach ($rooms as $room) {
|
||||||
$users = $room->getUsers();
|
$users = $room->getUsers();
|
||||||
@ -40,7 +40,7 @@ public function getMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return \wcf\system\WCF::getUser()->userID;
|
return \wcf\system\WCF::getUser()->userID;
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\command\commands;
|
namespace chat\system\command\commands;
|
||||||
use \wcf\data\user\User;
|
use \wcf\data\user\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whispers a message.
|
* Whispers a message.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.command.commands
|
* @subpackage system.chat.command.commands
|
||||||
*/
|
*/
|
||||||
class WhisperCommand extends \wcf\system\chat\command\AbstractCommand {
|
class WhisperCommand extends \chat\system\command\AbstractCommand {
|
||||||
public $enableSmilies = \wcf\system\chat\command\ICommand::SMILEY_USER;
|
public $enableSmilies = \chat\system\command\ICommand::SMILEY_USER;
|
||||||
public $user = null, $message = '';
|
public $user = null, $message = '';
|
||||||
|
|
||||||
public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) {
|
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
|
||||||
parent::__construct($commandHandler);
|
parent::__construct($commandHandler);
|
||||||
|
|
||||||
$parameters = $commandHandler->getParameters();
|
$parameters = $commandHandler->getParameters();
|
||||||
@ -24,30 +24,30 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand
|
|||||||
$username = substr($parameters, 0, $comma);
|
$username = substr($parameters, 0, $comma);
|
||||||
$this->message = substr($parameters, $comma + 1);
|
$this->message = substr($parameters, $comma + 1);
|
||||||
}
|
}
|
||||||
else throw new \wcf\system\chat\command\NotFoundException();
|
else throw new \chat\system\command\NotFoundException();
|
||||||
|
|
||||||
$this->user = User::getUserByUsername($username);
|
$this->user = User::getUserByUsername($username);
|
||||||
if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException($username);
|
if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username);
|
||||||
|
|
||||||
$this->didInit();
|
$this->didInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getType()
|
* @see \chat\system\command\ICommand::getType()
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
return \wcf\data\chat\message\ChatMessage::TYPE_WHISPER;
|
return \chat\data\message\Message::TYPE_WHISPER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getMessage()
|
* @see \chat\system\command\ICommand::getMessage()
|
||||||
*/
|
*/
|
||||||
public function getMessage() {
|
public function getMessage() {
|
||||||
return serialize(array('message' => $this->message, 'username' => $this->user->username));
|
return serialize(array('message' => $this->message, 'username' => $this->user->username));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\chat\command\ICommand::getReceiver()
|
* @see \chat\system\command\ICommand::getReceiver()
|
||||||
*/
|
*/
|
||||||
public function getReceiver() {
|
public function getReceiver() {
|
||||||
return $this->user->userID;
|
return $this->user->userID;
|
@ -1,44 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\cronjob;
|
namespace chat\system\cronjob;
|
||||||
use \wcf\data\chat;
|
use \chat\data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vaporizes unneeded data.
|
* Vaporizes unneeded data.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.cronjob
|
* @subpackage system.cronjob
|
||||||
*/
|
*/
|
||||||
class ChatCleanupCronjob implements ICronjob {
|
class CleanupCronjob implements \wcf\system\cronjob\ICronjob {
|
||||||
/**
|
/**
|
||||||
* @see wcf\system\ICronjob::execute()
|
* @see wcf\system\ICronjob::execute()
|
||||||
*/
|
*/
|
||||||
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'prune');
|
$messageAction = new data\message\MessageAction(array(), 'prune');
|
||||||
$messageAction->executeAction();
|
$messageAction->executeAction();
|
||||||
$roomAction = new chat\room\ChatRoomAction(array(), 'prune');
|
$roomAction = new data\room\RoomAction(array(), 'prune');
|
||||||
$roomAction->executeAction();
|
$roomAction->executeAction();
|
||||||
$suspensionAction = new chat\suspension\ChatSuspensionAction(array(), 'prune');
|
$suspensionAction = new data\suspension\SuspensionAction(array(), 'prune');
|
||||||
$suspensionAction->executeAction();
|
$suspensionAction->executeAction();
|
||||||
|
|
||||||
// kill dead users
|
// kill dead users
|
||||||
$deadUsers = \wcf\util\ChatUtil::getDiedUsers();
|
$deadUsers = \chat\util\ChatUtil::getDiedUsers();
|
||||||
foreach ($deadUsers as $deadUser) {
|
foreach ($deadUsers as $deadUser) {
|
||||||
if (!$deadUser) continue;
|
if (!$deadUser) continue;
|
||||||
|
|
||||||
$user = new \wcf\data\user\User($deadUser['userID']);
|
$user = new \wcf\data\user\User($deadUser['userID']);
|
||||||
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
if (CHAT_DISPLAY_JOIN_LEAVE) {
|
||||||
$userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user);
|
$userData['color'] = \chat\util\ChatUtil::readUserData('color', $user);
|
||||||
|
|
||||||
$messageAction = new chat\message\ChatMessageAction(array(), 'create', array(
|
$messageAction = new data\message\MessageAction(array(), 'create', array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'roomID' => $deadUser['roomID'],
|
'roomID' => $deadUser['roomID'],
|
||||||
'sender' => $user->userID,
|
'sender' => $user->userID,
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'time' => TIME_NOW,
|
'time' => TIME_NOW,
|
||||||
'type' => chat\message\ChatMessage::TYPE_LEAVE,
|
'type' => data\message\Message::TYPE_LEAVE,
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'color1' => $userData['color'][1],
|
'color1' => $userData['color'][1],
|
||||||
'color2' => $userData['color'][2]
|
'color2' => $userData['color'][2]
|
||||||
@ -46,7 +46,7 @@ public function execute(\wcf\data\cronjob\Cronjob $cronjob) {
|
|||||||
));
|
));
|
||||||
$messageAction->executeAction();
|
$messageAction->executeAction();
|
||||||
}
|
}
|
||||||
\wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
\chat\util\ChatUtil::writeUserData(array('roomID' => null), $user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\event\listener;
|
namespace chat\system\event\listener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new route to RouteHandler
|
* Adds a new route to RouteHandler
|
||||||
*
|
*
|
||||||
* @author Maximilian Mader
|
* @author Maximilian Mader
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.event.listener
|
* @subpackage system.event.listener
|
||||||
*/
|
*/
|
||||||
class ChatRouteListener implements \wcf\system\event\IEventListener {
|
class RouteHandlerListener implements \wcf\system\event\IEventListener {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\event\IEventListener::execute()
|
* @see \wcf\system\event\IEventListener::execute()
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ public function execute($eventObj, $className, $eventName) {
|
|||||||
$route = new \wcf\system\request\Route('chatAction');
|
$route = new \wcf\system\request\Route('chatAction');
|
||||||
$route->setSchema('/{controller}/{action}/{id}');
|
$route->setSchema('/{controller}/{action}/{id}');
|
||||||
$route->setParameterOption('controller', null, 'Chat');
|
$route->setParameterOption('controller', null, 'Chat');
|
||||||
$route->setParameterOption('action', null, '(Message|Log|Send|RefreshRoomList|Copyright|Leave)');
|
$route->setParameterOption('action', null, '(Log|Send)');
|
||||||
$route->setParameterOption('id', null, '\d+', true);
|
$route->setParameterOption('id', null, '\d+', true);
|
||||||
$eventObj->addRoute($route);
|
$eventObj->addRoute($route);
|
||||||
}
|
}
|
@ -1,17 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\menu\page;
|
namespace chat\system\menu\page;
|
||||||
use \wcf\data\chat\room\ChatRoom;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PageMenuItemProvider for chat.
|
* PageMenuItemProvider for chat.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.menu.page
|
* @subpackage system.menu.page
|
||||||
*/
|
*/
|
||||||
class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider {
|
class ChatPageMenuItemProvider extends \wcf\system\menu\page\DefaultPageMenuItemProvider {
|
||||||
protected $room = null;
|
protected $room = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +22,7 @@ public function isVisible() {
|
|||||||
// guests are not supported
|
// guests are not supported
|
||||||
if (!\wcf\system\WCF::getUser()->userID) return false;
|
if (!\wcf\system\WCF::getUser()->userID) return false;
|
||||||
|
|
||||||
$cache = ChatRoom::getCache();
|
$cache = \chat\data\room\Room::getCache();
|
||||||
|
|
||||||
foreach ($cache as $this->room) {
|
foreach ($cache as $this->room) {
|
||||||
if ($this->room->canEnter()) {
|
if ($this->room->canEnter()) {
|
||||||
@ -41,6 +40,7 @@ public function isVisible() {
|
|||||||
*/
|
*/
|
||||||
public function getLink() {
|
public function getLink() {
|
||||||
return \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
return \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
|
||||||
|
'application' => 'chat',
|
||||||
'object' => $this->room
|
'object' => $this->room
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\option;
|
namespace chat\system\option;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TimeIntervalOptionType is an implementation of IOptionType for time intervals.
|
* TimeIntervalOptionType is an implementation of IOptionType for time intervals.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.option
|
* @subpackage system.option
|
||||||
*/
|
*/
|
||||||
class TimeIntervalOptionType extends TextOptionType {
|
class TimeIntervalOptionType extends \wcf\system\option\TextOptionType {
|
||||||
/**
|
/**
|
||||||
* @see \wcf\system\option\IOptionType::getData()
|
* @see \wcf\system\option\IOptionType::getData()
|
||||||
*/
|
*/
|
||||||
public function getData(\wcf\data\option\Option $option, $newValue) {
|
public function getData(\wcf\data\option\Option $option, $newValue) {
|
||||||
return \wcf\util\ChatUtil::timeModifier($newValue);
|
return \chat\util\ChatUtil::timeModifier($newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\system\chat\permission;
|
namespace chat\system\permission;
|
||||||
use \wcf\system\acl\ACLHandler;
|
use \wcf\system\acl\ACLHandler;
|
||||||
use \wcf\system\cache\CacheHandler;
|
use \wcf\system\cache\CacheHandler;
|
||||||
use \wcf\system\package\PackageDependencyHandler;
|
use \wcf\system\package\PackageDependencyHandler;
|
||||||
@ -9,12 +9,12 @@
|
|||||||
* Handles chat-permissions.
|
* Handles chat-permissions.
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus, Marcel Werk
|
* @author Tim Düsterhus, Marcel Werk
|
||||||
* @copyright 2010-2012 WoltLab GmbH
|
* @copyright 2010-2013 WoltLab GmbH
|
||||||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
|
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage system.chat.permissions
|
* @subpackage system.permission
|
||||||
*/
|
*/
|
||||||
class ChatPermissionHandler {
|
class PermissionHandler {
|
||||||
/**
|
/**
|
||||||
* permissions set for the active user
|
* permissions set for the active user
|
||||||
* @var array<boolean>
|
* @var array<boolean>
|
||||||
@ -31,14 +31,14 @@ public function __construct(\wcf\data\user\User $user = null) {
|
|||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
$this->user = new \wcf\data\user\UserProfile($user);
|
$this->user = new \wcf\data\user\UserProfile($user);
|
||||||
|
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
$packageID = \chat\util\ChatUtil::getPackageID();
|
||||||
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
||||||
|
|
||||||
// get groups permissions
|
// get groups permissions
|
||||||
$groups = implode(',', $user->getGroupIDs());
|
$groups = implode(',', $user->getGroupIDs());
|
||||||
$groupsFileName = \wcf\util\StringUtil::getHash(implode('-', $user->getGroupIDs()));
|
$groupsFileName = \wcf\util\StringUtil::getHash(implode('-', $user->getGroupIDs()));
|
||||||
CacheHandler::getInstance()->addResource('chatPermission-'.$groups, WCF_DIR.'cache/cache.chatPermission-'.$groupsFileName.'.php', '\wcf\system\cache\builder\ChatPermissionCacheBuilder');
|
CacheHandler::getInstance()->addResource('permission-'.$groups, WCF_DIR.'cache/cache.permission-'.$groupsFileName.'.php', '\chat\system\cache\builder\PermissionCacheBuilder');
|
||||||
$this->chatPermissions = CacheHandler::getInstance()->get('chatPermission-'.$groups);
|
$this->chatPermissions = CacheHandler::getInstance()->get('permission-'.$groups);
|
||||||
|
|
||||||
// get user permissions
|
// get user permissions
|
||||||
if ($user->userID) {
|
if ($user->userID) {
|
||||||
@ -53,7 +53,7 @@ public function __construct(\wcf\data\user\User $user = null) {
|
|||||||
$userPermissions = array();
|
$userPermissions = array();
|
||||||
|
|
||||||
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
|
$conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder();
|
||||||
$conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room')));
|
$conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room')));
|
||||||
$conditionBuilder->add('option_to_user.optionID = acl_option.optionID');
|
$conditionBuilder->add('option_to_user.optionID = acl_option.optionID');
|
||||||
$conditionBuilder->add('option_to_user.userID = ?', array($user->userID));
|
$conditionBuilder->add('option_to_user.userID = ?', array($user->userID));
|
||||||
$sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue,
|
$sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue,
|
||||||
@ -85,11 +85,11 @@ public function __construct(\wcf\data\user\User $user = null) {
|
|||||||
/**
|
/**
|
||||||
* Fetches the given permission for the given room
|
* Fetches the given permission for the given room
|
||||||
*
|
*
|
||||||
* @param \wcf\data\chat\room\ChatRoom $room
|
* @param \chat\data\room\Room $room
|
||||||
* @param string $permission
|
* @param string $permission
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) {
|
public function getPermission(\chat\data\room\Room $room, $permission) {
|
||||||
if (!isset($this->chatPermissions[$room->roomID][$permission])) {
|
if (!isset($this->chatPermissions[$room->roomID][$permission])) {
|
||||||
$permission = str_replace(array('user.', 'mod.'), array('user.chat.', 'mod.chat.'), $permission);
|
$permission = str_replace(array('user.', 'mod.'), array('user.chat.', 'mod.chat.'), $permission);
|
||||||
|
|
||||||
@ -102,10 +102,10 @@ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) {
|
|||||||
* Clears the cache.
|
* Clears the cache.
|
||||||
*/
|
*/
|
||||||
public static function clearCache() {
|
public static function clearCache() {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
$packageID = \chat\util\ChatUtil::getPackageID();
|
||||||
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
||||||
|
|
||||||
$ush->resetAll('chatUserPermissions', $packageID);
|
$ush->resetAll('chatUserPermissions', $packageID);
|
||||||
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatPermission-[a-f0-9]{40}.php');
|
\wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.permission-[a-f0-9]{40}.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace wcf\util;
|
namespace chat\util;
|
||||||
use \wcf\data\package\PackageCache;
|
use \wcf\data\package\PackageCache;
|
||||||
use \wcf\system\user\storage\UserStorageHandler;
|
use \wcf\system\user\storage\UserStorageHandler;
|
||||||
use \wcf\system\WCF;
|
use \wcf\system\WCF;
|
||||||
@ -8,9 +8,9 @@
|
|||||||
* Chat utilities
|
* Chat utilities
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus
|
* @author Tim Düsterhus
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.chat
|
||||||
* @subpackage util
|
* @subpackage util
|
||||||
*/
|
*/
|
||||||
final class ChatUtil {
|
final class ChatUtil {
|
||||||
@ -18,7 +18,7 @@ final class ChatUtil {
|
|||||||
* Matches a time-interval with modifiers.
|
* Matches a time-interval with modifiers.
|
||||||
* Each part may be optionally separated by a comma
|
* Each part may be optionally separated by a comma
|
||||||
*
|
*
|
||||||
* @see \wcf\util\ChatUtil::timeModifier()
|
* @see \chat\util\ChatUtil::timeModifier()
|
||||||
*/
|
*/
|
||||||
const TIME_MODIFIER_REGEX = '((?:[0-9]+[s|h|d|w|m|y|S|H|D|W|M|Y]?,?)+)';
|
const TIME_MODIFIER_REGEX = '((?:[0-9]+[s|h|d|w|m|y|S|H|D|W|M|Y]?,?)+)';
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ final class ChatUtil {
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const PACKAGE_IDENTIFIER = 'be.bastelstu.wcf.chat';
|
const PACKAGE_IDENTIFIER = 'be.bastelstu.chat';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which user-storage-keys need serialization.
|
* Which user-storage-keys need serialization.
|
||||||
@ -120,7 +120,7 @@ public static function gradient($string, $start, $end) {
|
|||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
for ($i = 0, $max = count($string); $i < $max; $i++) {
|
for ($i = 0, $max = count($string); $i < $max; $i++) {
|
||||||
$result .= '<span style="color:rgb('.(($start >> 16 & 255) - $i * $r).','.(($start >> 8 & 255) - $i * $g).','.(($start & 255) - $i * $b).')">'.StringUtil::encodeHTML($string[$i]).'</span>';
|
$result .= '<span style="color:rgb('.(($start >> 16 & 255) - $i * $r).','.(($start >> 8 & 255) - $i * $g).','.(($start & 255) - $i * $b).')">'.\wcf\util\StringUtil::encodeHTML($string[$i]).'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -133,8 +133,8 @@ public static function gradient($string, $start, $end) {
|
|||||||
*/
|
*/
|
||||||
public static function nodePushRunning() {
|
public static function nodePushRunning() {
|
||||||
if (!CHAT_SOCKET_IO_PATH) return false;
|
if (!CHAT_SOCKET_IO_PATH) return false;
|
||||||
if (!file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock')) return false;
|
if (!file_exists(CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock')) return false;
|
||||||
if (!is_writable(WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock')) return false;
|
if (!is_writable(CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock')) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -179,8 +179,8 @@ public static function readUserData($field, \wcf\data\user\User $user = null) {
|
|||||||
*/
|
*/
|
||||||
public static function str_split($string, $length = 1) {
|
public static function str_split($string, $length = 1) {
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i = 0, $max = StringUtil::length($string); $i < $max; $i += $length) {
|
for ($i = 0, $max = \wcf\util\StringUtil::length($string); $i < $max; $i += $length) {
|
||||||
$result[] = StringUtil::substring($string, $i, $length);
|
$result[] = \wcf\util\StringUtil::substring($string, $i, $length);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
* Styles for Tims Chat
|
* Styles for Tims Chat
|
||||||
*
|
*
|
||||||
* @author Tim Düsterhus, Maximilian Mader
|
* @author Tim Düsterhus, Maximilian Mader
|
||||||
* @copyright 2010-2012 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>
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
* @package be.bastelstu.wcf.chat
|
* @package be.bastelstu.wcf.chat
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#tplChat {
|
#tplChat {
|
||||||
#content {
|
#content {
|
||||||
#timsChatRoomContent {
|
#timsChatRoomContent {
|
||||||
@ -24,16 +23,16 @@
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding-left: 7px !important;
|
padding-left: 7px !important;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
display: table;
|
||||||
|
|
||||||
.timsChatMessage {
|
.timsChatMessage {
|
||||||
padding-left: 16px;
|
|
||||||
min-height: 16px;
|
min-height: 16px;
|
||||||
clear: both;
|
display: table-row;
|
||||||
|
.transition(opacity, .2s);
|
||||||
|
|
||||||
|
|
||||||
time:first-child {
|
time:first-child {
|
||||||
font-size: .8em;
|
|
||||||
&::before, &::after {
|
|
||||||
font-size: .8em;
|
|
||||||
}
|
|
||||||
&::before {
|
&::before {
|
||||||
content: "[";
|
content: "[";
|
||||||
}
|
}
|
||||||
@ -46,8 +45,26 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> {
|
||||||
|
time, .usernameContainer, .text {
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
.usernameContainer {
|
||||||
|
text-align: right;
|
||||||
|
min-width: 100px;
|
||||||
|
padding: 0px 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.unloaded {
|
&.unloaded {
|
||||||
opacity: 0.4;
|
opacity: .5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
.icon;
|
||||||
|
.icon16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +97,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
background-color: rgba(0, 0, 0, 0.2);
|
|
||||||
height: 33px;
|
height: 33px;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
@ -94,7 +110,10 @@
|
|||||||
height: 22px;
|
height: 22px;
|
||||||
padding: 9px 0 0;
|
padding: 9px 0 0;
|
||||||
|
|
||||||
.transition(~"border-radius .2s linear 0s, background-color .2s linear 0s, font-size", .2s);
|
.transition(border-radius, .2s);
|
||||||
|
.transition(background-color, .2s);
|
||||||
|
.transition(font-size, .2s);
|
||||||
|
|
||||||
|
|
||||||
.collapsed & {
|
.collapsed & {
|
||||||
border: none !important;
|
border: none !important;
|
||||||
@ -239,14 +258,13 @@
|
|||||||
padding: 14px 21px 7px;
|
padding: 14px 21px 7px;
|
||||||
border-bottom-right-radius: 0px;
|
border-bottom-right-radius: 0px;
|
||||||
|
|
||||||
> div {
|
|
||||||
li {
|
li {
|
||||||
display: inline;
|
.transition(opacity, .2s);
|
||||||
margin: 5px 5px 0 0;
|
|
||||||
|
|
||||||
.icon24 {
|
|
||||||
//.square(16px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
li {
|
||||||
|
opacity: .5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,21 +308,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ajaxLoad {
|
#toggleRooms .ajaxLoad {
|
||||||
background-position: right center;
|
position: absolute;
|
||||||
background-repeat: no-repeat;
|
right: 5px;
|
||||||
background-size: auto 100%;
|
top: 3px;
|
||||||
background-image: url("../icon/spinner.svg");
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#timsChatCopyright {
|
#timsChatCopyright {
|
||||||
.textShadow(@wcfContentBackgroundColor);
|
.textShadow(@wcfContentBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#timsChatCopyrightDialog {
|
#timsChatCopyrightDialog > div {
|
||||||
background-position: right 45px;
|
background-position: right center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
min-height: 50%;
|
min-height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badgeBG(@backgroundColor) when (lightness(@backgroundColor) < 50%) {
|
.badgeBG(@backgroundColor) when (lightness(@backgroundColor) < 50%) {
|
||||||
|
36
install.sql
36
install.sql
@ -2,13 +2,13 @@
|
|||||||
-- Database Structure for Tims Chat
|
-- Database Structure for Tims Chat
|
||||||
--
|
--
|
||||||
-- @author Tim Düsterhus
|
-- @author Tim Düsterhus
|
||||||
-- @copyright 2010-2012 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>
|
-- @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||||
-- @package be.bastelstu.wcf.chat
|
-- @package be.bastelstu.chat
|
||||||
-- --
|
-- --
|
||||||
|
|
||||||
DROP TABLE IF EXISTS wcf1_chat_message;
|
DROP TABLE IF EXISTS chat1_message;
|
||||||
CREATE TABLE wcf1_chat_message (
|
CREATE TABLE chat1_message (
|
||||||
messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
roomID INT(10) NOT NULL,
|
roomID INT(10) NOT NULL,
|
||||||
sender INT(10) DEFAULT NULL,
|
sender INT(10) DEFAULT NULL,
|
||||||
@ -28,8 +28,8 @@ CREATE TABLE wcf1_chat_message (
|
|||||||
KEY receiver (receiver)
|
KEY receiver (receiver)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS wcf1_chat_room;
|
DROP TABLE IF EXISTS chat1_room;
|
||||||
CREATE TABLE wcf1_chat_room (
|
CREATE TABLE chat1_room (
|
||||||
roomID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
roomID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
title VARCHAR(255) NOT NULL,
|
title VARCHAR(255) NOT NULL,
|
||||||
topic VARCHAR(255) NOT NULL,
|
topic VARCHAR(255) NOT NULL,
|
||||||
@ -41,8 +41,8 @@ CREATE TABLE wcf1_chat_room (
|
|||||||
KEY owner (owner)
|
KEY owner (owner)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS wcf1_chat_suspension;
|
DROP TABLE IF EXISTS chat1_suspension;
|
||||||
CREATE TABLE wcf1_chat_suspension (
|
CREATE TABLE chat1_suspension (
|
||||||
suspensionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
suspensionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
userID INT(10) NOT NULL,
|
userID INT(10) NOT NULL,
|
||||||
roomID INT(10) DEFAULT NULL,
|
roomID INT(10) DEFAULT NULL,
|
||||||
@ -55,16 +55,16 @@ CREATE TABLE wcf1_chat_suspension (
|
|||||||
KEY time (time)
|
KEY time (time)
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
|
ALTER TABLE chat1_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
|
||||||
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE;
|
ALTER TABLE chat1_message ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE;
|
||||||
ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
|
ALTER TABLE chat1_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
|
||||||
|
|
||||||
ALTER TABLE wcf1_chat_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
|
ALTER TABLE chat1_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
|
||||||
|
|
||||||
ALTER TABLE wcf1_chat_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
|
ALTER TABLE chat1_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
|
||||||
ALTER TABLE wcf1_chat_suspension ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE;
|
ALTER TABLE chat1_suspension ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE;
|
||||||
|
|
||||||
INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('wcf.chat.room.title1', 'wcf.chat.room.topic1', 1);
|
INSERT INTO chat1_room (title, topic, position) VALUES ('chat.room.title1', 'chat.room.topic1', 1);
|
||||||
INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2);
|
INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2);
|
||||||
INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3);
|
INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3);
|
||||||
INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Room w/o topic', '', 4);
|
INSERT INTO chat1_room (title, topic, position) VALUES ('Room w/o topic', '', 4);
|
||||||
|
121
language/de.xml
121
language/de.xml
@ -1,20 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<language 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/language.xsd" languagecode="de">
|
<language 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/language.xsd" languagecode="de">
|
||||||
<category name="wcf.acp.chat">
|
<category name="chat.acp.room">
|
||||||
<item name="wcf.acp.chat.room.list"><![CDATA[Chaträume]]></item>
|
<item name="chat.acp.room.list"><![CDATA[Chaträume]]></item>
|
||||||
<item name="wcf.acp.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
<item name="chat.acp.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
||||||
<item name="wcf.acp.chat.room.edit"><![CDATA[Chatraum bearbeiten]]></item>
|
<item name="chat.acp.room.edit"><![CDATA[Chatraum bearbeiten]]></item>
|
||||||
<item name="wcf.acp.chat.room.data"><![CDATA[Daten des Raumes]]></item>
|
<item name="chat.acp.room.data"><![CDATA[Daten des Raumes]]></item>
|
||||||
<item name="wcf.acp.chat.room.title"><![CDATA[Titel]]></item>
|
<item name="chat.acp.room.title"><![CDATA[Titel]]></item>
|
||||||
<item name="wcf.acp.chat.room.topic"><![CDATA[Thema]]></item>
|
<item name="chat.acp.room.topic"><![CDATA[Thema]]></item>
|
||||||
|
|
||||||
<item name="wcf.acp.chat.delete.sure"><![CDATA[Möchten Sie den Raum „{$chatRoom->title|language}“ wirklich löschen?]]></item>
|
<item name="chat.acp.room.noneAvailable"><![CDATA[Es wurden noch keine Chaträume angelegt.]]></item>
|
||||||
|
<item name="chat.acp.room.delete.sure"><![CDATA[Möchten Sie den Raum „{$chatRoom->title|language}“ wirklich löschen?]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="wcf.acp.menu">
|
<category name="chat.acp.menu">
|
||||||
<item name="wcf.acp.menu.link.chat"><![CDATA[Chat]]></item>
|
<item name="chat.acp.menu.link"><![CDATA[Chat]]></item>
|
||||||
<item name="wcf.acp.menu.link.chat.room.list"><![CDATA[Chaträume auflisten]]></item>
|
<item name="chat.acp.menu.link.room.list"><![CDATA[Chaträume auflisten]]></item>
|
||||||
<item name="wcf.acp.menu.link.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
<item name="chat.acp.menu.link.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="wcf.acp.group">
|
<category name="wcf.acp.group">
|
||||||
@ -57,71 +58,73 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die
|
|||||||
<item name="wcf.acp.option.chat_log_archivetime.description"><![CDATA[Gibt die Zeit in Minuten an, die eine Nachricht im Protokoll gespeichert bleibt.]]></item>
|
<item name="wcf.acp.option.chat_log_archivetime.description"><![CDATA[Gibt die Zeit in Minuten an, die eine Nachricht im Protokoll gespeichert bleibt.]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="wcf.chat">
|
<category name="chat.general">
|
||||||
<item name="wcf.chat.title"><![CDATA[Chat]]></item>
|
<item name="chat.general.title"><![CDATA[Chat]]></item>
|
||||||
<item name="wcf.chat.protocol"><![CDATA[Protokoll]]></item>
|
<item name="chat.general.protocol"><![CDATA[Protokoll]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.room"><![CDATA[Raum]]></item>
|
<item name="chat.general.room"><![CDATA[Raum]]></item>
|
||||||
<item name="wcf.chat.rooms"><![CDATA[Räume]]></item>
|
<item name="chat.general.rooms"><![CDATA[Räume]]></item>
|
||||||
<item name="wcf.chat.users"><![CDATA[Nutzer]]></item>
|
<item name="chat.general.users"><![CDATA[Nutzer]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.copyright"><![CDATA[<a href="http://tims.bastelstu.be">Chat: <strong>Tims Chat</strong>{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt von <strong>TimWolla</strong></a>]]></item>
|
<item name="chat.general.copyright"><![CDATA[<a href="http://tims.bastelstu.be"><strong>Tims Chat</strong>{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}, entwickelt in <strong>Tims Bastelstube</strong></a>]]></item>
|
||||||
<item name="wcf.chat.copyright.leader"><![CDATA[Projektleiter]]></item>
|
<item name="chat.general.copyright.leader"><![CDATA[Projektleiter]]></item>
|
||||||
<item name="wcf.chat.copyright.developer"><![CDATA[Entwickler]]></item>
|
<item name="chat.general.copyright.developer"><![CDATA[Entwickler]]></item>
|
||||||
<item name="wcf.chat.copyright.graphics"><![CDATA[Grafisches]]></item>
|
<item name="chat.general.copyright.graphics"><![CDATA[Grafisches]]></item>
|
||||||
<item name="wcf.chat.copyright.translation"><![CDATA[Übersetzung]]></item>
|
<item name="chat.general.copyright.translation"><![CDATA[Übersetzung]]></item>
|
||||||
<item name="wcf.chat.copyright.thanks"><![CDATA[Weiteren Dank an]]></item>
|
<item name="chat.general.copyright.thanks"><![CDATA[Weiteren Dank an]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.submit.default"><![CDATA[Zum Senden Enter drücken]]></item>
|
<item name="chat.general.submit.default"><![CDATA[Zum Senden Enter drücken]]></item>
|
||||||
<item name="wcf.chat.scroll"><![CDATA[Scrollen]]></item>
|
<item name="chat.general.scroll"><![CDATA[Scrollen]]></item>
|
||||||
<item name="wcf.chat.notify"><![CDATA[Benachrichtigen]]></item>
|
<item name="chat.general.notify"><![CDATA[Benachrichtigen]]></item>
|
||||||
<item name="wcf.chat.notify.title"><![CDATA[Neue Nachrichten]]></item>
|
<item name="chat.general.notify.title"><![CDATA[Neue Nachrichten]]></item>
|
||||||
<item name="wcf.chat.smilies"><![CDATA[Smilies]]></item>
|
<item name="chat.general.smilies"><![CDATA[Smilies]]></item>
|
||||||
<item name="wcf.chat.clear"><![CDATA[Chat leeren]]></item>
|
<item name="chat.general.clear"><![CDATA[Chat leeren]]></item>
|
||||||
<item name="wcf.chat.mark"><![CDATA[Markieren]]></item>
|
<item name="chat.general.mark"><![CDATA[Markieren]]></item>
|
||||||
<item name="wcf.chat.forceRefresh"><![CDATA[Räume neu laden]]></item>
|
<item name="chat.general.forceRefresh"><![CDATA[Räume neu laden]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.query"><![CDATA[Privates Gespräch]]></item>
|
<item name="chat.general.query"><![CDATA[Privates Gespräch]]></item>
|
||||||
<item name="wcf.chat.kick"><![CDATA[Kicken]]></item>
|
<item name="chat.general.kick"><![CDATA[Kicken]]></item>
|
||||||
<item name="wcf.chat.ban"><![CDATA[Bannen]]></item>
|
<item name="chat.general.ban"><![CDATA[Bannen]]></item>
|
||||||
<item name="wcf.chat.profile"><![CDATA[Profil]]></item>
|
<item name="chat.general.profile"><![CDATA[Profil]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.information"><![CDATA[Information]]></item>
|
<item name="chat.general.information"><![CDATA[Information]]></item>
|
||||||
<item name="wcf.chat.information.chatUpdate"><![CDATA[Der Chat wurde aktualisiert. Bitte lade die Seite neu, da es sonst zu Fehlern kommen kann.]]></item>
|
<item name="chat.general.information.chatUpdate"><![CDATA[Der Chat wurde aktualisiert. Bitte lade die Seite neu, da es sonst zu Fehlern kommen kann.]]></item>
|
||||||
|
|
||||||
<item name="wcf.chat.error"><![CDATA[Fehler]]></item>
|
|
||||||
<item name="wcf.chat.error.notFound"><![CDATA[Der Befehl wurde nicht gefunden.]]></item>
|
|
||||||
<item name="wcf.chat.error.userNotFound"><![CDATA[Der Benutzer „{$username}“ wurde nicht gefunden.]]></item>
|
|
||||||
<item name="wcf.chat.error.permissionDenied"><![CDATA[Sie dürfen diesen Befehl nicht verwenden.]]></item>
|
|
||||||
<item name="wcf.chat.error.exception"><![CDATA[Es gab ein Problem bei der Ausführung dieses Befehls. Bitte wenden Sie sich an einen Administrator.]]></item>
|
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="wcf.chat.message">
|
<category name="chat.error">
|
||||||
|
<item name="chat.error"><![CDATA[Fehler]]></item>
|
||||||
|
<item name="chat.error.notFound"><![CDATA[Der Befehl wurde nicht gefunden.]]></item>
|
||||||
|
<item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$username}“ wurde nicht gefunden.]]></item>
|
||||||
|
<item name="chat.error.permissionDenied"><![CDATA[Sie dürfen diesen Befehl nicht verwenden.]]></item>
|
||||||
|
<item name="chat.error.exception"><![CDATA[Es gab ein Problem bei der Ausführung dieses Befehls. Bitte wenden Sie sich an einen Administrator.]]></item>
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category name="chat.message">
|
||||||
<!-- 1 = TYPE_JOIN -->
|
<!-- 1 = TYPE_JOIN -->
|
||||||
<item name="wcf.chat.message.1"><![CDATA[hat den Chat betreten.{if true} ({$ipAddress}){/if}]]></item><!-- todo: check rights -->
|
<item name="chat.message.1"><![CDATA[hat den Chat betreten.{if $__wcf->session->getPermission('admin.user.canViewIpAddress')} ({$ipAddress}){/if}]]></item>
|
||||||
<!-- 2 = TYPE_LEAVE -->
|
<!-- 2 = TYPE_LEAVE -->
|
||||||
<item name="wcf.chat.message.2"><![CDATA[hat den Chat verlassen.]]></item>
|
<item name="chat.message.2"><![CDATA[hat den Chat verlassen.]]></item>
|
||||||
<!-- 3 = TYPE_AWAY -->
|
<!-- 3 = TYPE_AWAY -->
|
||||||
<item name="wcf.chat.message.3"><![CDATA[ist jetzt abwesend{if $message}: {$message}{else}.{/if}]]></item>
|
<item name="chat.message.3"><![CDATA[ist jetzt abwesend{if $message}: {$message}{else}.{/if}]]></item>
|
||||||
<!-- 4 = TYPE_BACK -->
|
<!-- 4 = TYPE_BACK -->
|
||||||
<item name="wcf.chat.message.4"><![CDATA[ist jetzt wieder da.]]></item>
|
<item name="chat.message.4"><![CDATA[ist jetzt wieder da.]]></item>
|
||||||
<!-- 5 = TYPE_MODERATE -->
|
<!-- 5 = TYPE_MODERATE -->
|
||||||
<item name="wcf.chat.message.5.restore"><![CDATA[hat {@$link} zurückgesetzt.]]></item>
|
<item name="chat.message.5.restore"><![CDATA[hat {@$link} zurückgesetzt.]]></item>
|
||||||
<item name="wcf.chat.message.5.mute"><![CDATA[hat {@$link} bis {@$until|plainTime} geknebelt.]]></item>
|
<item name="chat.message.5.mute"><![CDATA[hat {@$link} bis {@$until|plainTime} geknebelt.]]></item>
|
||||||
<item name="wcf.chat.message.5.ban"><![CDATA[hat {@$link} bis {@$until|plainTime} gebannt.]]></item>
|
<item name="chat.message.5.ban"><![CDATA[hat {@$link} bis {@$until|plainTime} gebannt.]]></item>
|
||||||
|
|
||||||
<!-- 7 = TYPE_WHISPER -->
|
<!-- 7 = TYPE_WHISPER -->
|
||||||
<item name="wcf.chat.message.7"><![CDATA[flüstert{if $showReceiver} an {$username}{/if}:]]></item>
|
<item name="chat.message.7"><![CDATA[flüstert{if $showReceiver} an {$username}{/if}:]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<!-- I18N Values -->
|
<!-- I18N Values -->
|
||||||
<category name="wcf.chat.room">
|
<category name="chat.room">
|
||||||
<item name="wcf.chat.room.title1"><![CDATA[Hauptchat]]></item>
|
<item name="chat.room.title1"><![CDATA[Hauptchat]]></item>
|
||||||
<item name="wcf.chat.room.topic1"><![CDATA[Vielen Dank, dass Sie sich für Tims Chat entschieden haben. Bitte besuchen Sie das ACP um diesen Text anzupassen.]]></item>
|
<item name="chat.room.topic1"><![CDATA[Vielen Dank, dass Sie sich für Tims Chat entschieden haben. Bitte besuchen Sie das ACP um diesen Text anzupassen.]]></item>
|
||||||
<item name="wcf.chat.room.titleTemp"><![CDATA[Raum_{$roomID}]]></item>
|
<item name="chat.room.titleTemp"><![CDATA[Raum_{$roomID}]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category name="wcf.header">
|
<category name="chat.header">
|
||||||
<item name="wcf.header.menu.chat"><![CDATA[Chat]]></item>
|
<item name="chat.header.menu.chat"><![CDATA[Chat]]></item>
|
||||||
</category>
|
</category>
|
||||||
</language>
|
</language>
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
<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/object-type.xsd">
|
<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/object-type.xsd">
|
||||||
<import>
|
<import>
|
||||||
<type>
|
<type>
|
||||||
<name>be.bastelstu.wcf.chat.room</name>
|
<name>be.bastelstu.chat.room</name>
|
||||||
<definitionname>com.woltlab.wcf.acl</definitionname>
|
<definitionname>com.woltlab.wcf.acl</definitionname>
|
||||||
</type>
|
</type>
|
||||||
<type>
|
<type>
|
||||||
<name>be.bastelstu.wcf.chat.activityPointEvent.join</name>
|
<name>be.bastelstu.chat.activityPointEvent.join</name>
|
||||||
<definitionname>com.woltlab.wcf.user.activityPointEvent</definitionname>
|
<definitionname>com.woltlab.wcf.user.activityPointEvent</definitionname>
|
||||||
<points>0</points>
|
<points>0</points>
|
||||||
<classname>wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor</classname><!-- We are unable to recalc those points -->
|
<classname>wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor</classname><!-- We are unable to recalc those points -->
|
||||||
</type>
|
</type>
|
||||||
<type>
|
<type>
|
||||||
<name>be.bastelstu.wcf.chat.activityPointEvent.message</name>
|
<name>be.bastelstu.chat.activityPointEvent.message</name>
|
||||||
<definitionname>com.woltlab.wcf.user.activityPointEvent</definitionname>
|
<definitionname>com.woltlab.wcf.user.activityPointEvent</definitionname>
|
||||||
<points>0</points>
|
<points>0</points>
|
||||||
<classname>wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor</classname><!-- We are unable to recalc those points -->
|
<classname>wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor</classname><!-- We are unable to recalc those points -->
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<option name="chat_log_archivetime">
|
<option name="chat_log_archivetime">
|
||||||
<categoryname>chat.log</categoryname>
|
<categoryname>chat.log</categoryname>
|
||||||
<optiontype>timeInterval</optiontype>
|
<optiontype>integer</optiontype>
|
||||||
<defaultvalue>172800</defaultvalue>
|
<defaultvalue>172800</defaultvalue>
|
||||||
<showorder>2</showorder>
|
<showorder>2</showorder>
|
||||||
</option>
|
</option>
|
||||||
|
16
package.xml
16
package.xml
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<package name="be.bastelstu.wcf.chat" 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/package.xsd">
|
<package name="be.bastelstu.chat" 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/package.xsd">
|
||||||
<packageinformation>
|
<packageinformation>
|
||||||
<packagename><![CDATA[Tims Chat]]></packagename>
|
<packagename><![CDATA[Tims Chat]]></packagename>
|
||||||
<packagedescription><![CDATA[Chat for WoltLab Community Framework™.]]></packagedescription>
|
<packagedescription><![CDATA[Chat for WoltLab Community Framework™.]]></packagedescription>
|
||||||
<packagedescription language="de"><![CDATA[Chat für WoltLab Community Framework™.]]></packagedescription>
|
<packagedescription language="de"><![CDATA[Chat für WoltLab Community Framework™.]]></packagedescription>
|
||||||
<standalone>0</standalone>
|
<isapplication>1</isapplication>
|
||||||
<version>3.0.0 Alpha 19</version>
|
<version>3.0.0 Alpha 19</version>
|
||||||
<date>2011-11-26</date>
|
<date>2011-11-26</date>
|
||||||
</packageinformation>
|
</packageinformation>
|
||||||
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
<requiredpackages>
|
<requiredpackages>
|
||||||
<requiredpackage minversion="2.0.0 Alpha 1">com.woltlab.wcf</requiredpackage>
|
<requiredpackage minversion="2.0.0 Alpha 1">com.woltlab.wcf</requiredpackage>
|
||||||
<requiredpackage minversion="1.0.0 Alpha 1">com.woltlab.wcf.bbcode</requiredpackage>
|
<requiredpackage file="requirements/com.woltlab.wcf.bbcode.tar">com.woltlab.wcf.bbcode</requiredpackage>
|
||||||
<requiredpackage minversion="1.0.0 Alpha 1">com.woltlab.wcf.message</requiredpackage>
|
<requiredpackage file="requirements/com.woltlab.wcf.message.tar">com.woltlab.wcf.message</requiredpackage>
|
||||||
<requiredpackage minversion="1.0.0 Alpha 1">com.woltlab.wcf.user</requiredpackage>
|
<requiredpackage file="requirements/com.woltlab.wcf.user.tar">com.woltlab.wcf.user</requiredpackage>
|
||||||
</requiredpackages>
|
</requiredpackages>
|
||||||
|
|
||||||
<instructions type="install">
|
<instructions type="install">
|
||||||
@ -29,13 +29,14 @@
|
|||||||
<instruction type="sql">install.sql</instruction>
|
<instruction type="sql">install.sql</instruction>
|
||||||
<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="templateListener">templateListener.xml</instruction>
|
||||||
<instruction type="pageMenu">pagemenu.xml</instruction>
|
<instruction type="pageMenu">pagemenu.xml</instruction>
|
||||||
<instruction type="eventListener">eventListener.xml</instruction>
|
<instruction type="eventListener">eventListener.xml</instruction>
|
||||||
<instruction type="aclOption">acloptions.xml</instruction>
|
<instruction type="aclOption">acloptions.xml</instruction>
|
||||||
<instruction type="acpMenu">acpMenu.xml</instruction>
|
<instruction type="acpMenu">acpMenu.xml</instruction>
|
||||||
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
||||||
<instruction type="cronjob">cronjob.xml</instruction>
|
<instruction type="cronjob">cronjob.xml</instruction>
|
||||||
<instruction type="script">acp/be.bastelstu.wcf.chat.install.php</instruction>
|
<instruction type="script">acp/be.bastelstu.chat.install.php</instruction>
|
||||||
</instructions>
|
</instructions>
|
||||||
|
|
||||||
<instructions type="update" fromversion="3.0.0 Alpha *">
|
<instructions type="update" fromversion="3.0.0 Alpha *">
|
||||||
@ -45,12 +46,13 @@
|
|||||||
<instruction type="acpTemplate">acptemplate.tar</instruction>
|
<instruction type="acpTemplate">acptemplate.tar</instruction>
|
||||||
<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="templateListener">templateListener.xml</instruction>
|
||||||
<instruction type="pageMenu">pagemenu.xml</instruction>
|
<instruction type="pageMenu">pagemenu.xml</instruction>
|
||||||
<instruction type="eventListener">eventListener.xml</instruction>
|
<instruction type="eventListener">eventListener.xml</instruction>
|
||||||
<instruction type="aclOption">acloptions.xml</instruction>
|
<instruction type="aclOption">acloptions.xml</instruction>
|
||||||
<instruction type="acpMenu">acpMenu.xml</instruction>
|
<instruction type="acpMenu">acpMenu.xml</instruction>
|
||||||
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
||||||
<instruction type="cronjob">cronjob.xml</instruction>
|
<instruction type="cronjob">cronjob.xml</instruction>
|
||||||
<instruction type="script">acp/be.bastelstu.wcf.chat.update.php</instruction>
|
<instruction type="script">acp/be.bastelstu.chat.update.php</instruction>
|
||||||
</instructions>
|
</instructions>
|
||||||
</package>
|
</package>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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/pagemenu.xsd">
|
<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/pagemenu.xsd">
|
||||||
<import>
|
<import>
|
||||||
<pagemenuitem name="wcf.header.menu.chat">
|
<pagemenuitem name="chat.header.menu.chat">
|
||||||
<link>index.php/Chat</link>
|
<controller><![CDATA[chat\page\ChatPage]]></controller>
|
||||||
<position>header</position>
|
<position>header</position>
|
||||||
<classname>\wcf\system\menu\page\ChatPageMenuItemProvider</classname>
|
<classname>\chat\system\menu\page\ChatPageMenuItemProvider</classname>
|
||||||
</pagemenuitem>
|
</pagemenuitem>
|
||||||
</import>
|
</import>
|
||||||
</data>
|
</data>
|
49
template/__copyright.tpl
Normal file
49
template/__copyright.tpl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{if $__chat->isActiveApplication()}
|
||||||
|
{if $templateName != '__copyright'}<address id="timsChatCopyright" class="copyright marginTop">{lang}chat.general.copyright{/lang}</address>
|
||||||
|
{elseif $templateName == '__copyright'}
|
||||||
|
<div style="background-image: url('data:image/png;base64,{$background}');">
|
||||||
|
<dl>
|
||||||
|
<dt>{lang}chat.general.copyright.leader{/lang}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>{lang}chat.general.copyright.developer{/lang}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
||||||
|
<li><a href="https://github.com/max-m">Maximilian Mader</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>{lang}chat.general.copyright.graphics{/lang}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://www.cls-design.com/">Tom</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
{*<dl>
|
||||||
|
<dt>{lang}chat.general.copyright.translation{/lang}</dt>
|
||||||
|
<dd>
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</dl>*}
|
||||||
|
<dl>
|
||||||
|
<dt>{lang}chat.general.copyright.thanks{/lang}</dt>
|
||||||
|
<dd>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li>
|
||||||
|
<li>Gabi</li>
|
||||||
|
<li><a href="https://github.com/Leon-">Stefan Hahn</a></li>
|
||||||
|
<li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
@ -1,57 +1,105 @@
|
|||||||
{include file='documentHeader'}
|
{include file='documentHeader'}
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>{$room} - {lang}wcf.chat.title{/lang} - {PAGE_TITLE|language}</title>
|
<title>{$room} - {lang}chat.general.title{/lang} - {PAGE_TITLE|language}</title>
|
||||||
|
|
||||||
{include file='headInclude' sandbox=false}
|
{include file='headInclude' sandbox=false}
|
||||||
|
{include file='javascriptInclude'}
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
var chat;
|
||||||
|
(function ($, window) {
|
||||||
|
$(function(){
|
||||||
|
WCF.Language.addObject({
|
||||||
|
'chat.general.query': '{lang}chat.general.query{/lang}',
|
||||||
|
'chat.general.kick': '{lang}chat.general.kick{/lang}',
|
||||||
|
'chat.general.ban': '{lang}chat.general.ban{/lang}',
|
||||||
|
'chat.general.profile': '{lang}chat.general.profile{/lang}',
|
||||||
|
'chat.general.notify.title': '{lang}chat.general.notify.title{/lang}'
|
||||||
|
});
|
||||||
|
|
||||||
|
{event name='shouldInit'}
|
||||||
|
|
||||||
|
// Boot the chat
|
||||||
|
WCF.TabMenu.init();
|
||||||
|
new WCF.Message.Smilies();
|
||||||
|
{capture assign='messageTemplate'}{include application='chat' file='message'}{/capture}
|
||||||
|
|
||||||
|
chat = new be.bastelstu.Chat({
|
||||||
|
reloadTime: {@CHAT_RELOADTIME},
|
||||||
|
unloadURL: '{link application="chat" controller="Leave"}{/link}',
|
||||||
|
messageURL: '{link application="chat" controller="NewMessages"}{/link}',
|
||||||
|
socketIOPath: '{@CHAT_SOCKET_IO_PATH|encodeJS}'
|
||||||
|
}, (new WCF.Template('{ldelim}$title} - {'chat.general.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile(), (new WCF.Template('{@$messageTemplate|encodeJS}')).compile());
|
||||||
|
{event name='didInit'}
|
||||||
|
|
||||||
|
// show the last X messages
|
||||||
|
chat.handleMessages([
|
||||||
|
{implode from=$newestMessages item='message'}{@$message->jsonify()}{/implode}
|
||||||
|
]);
|
||||||
|
|
||||||
|
// enable user-interface
|
||||||
|
$('#timsChatInput').enable().jCounter().focus();
|
||||||
|
|
||||||
|
$('#timsChatCopyright').click(function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (!$.wcfIsset('timsChatCopyrightDialog')) $('<fieldset id="timsChatCopyrightDialog"></fieldset>').appendTo('body');
|
||||||
|
$('#timsChatCopyrightDialog').load('{link application='chat' controller='Copyright'}{/link}', function() {
|
||||||
|
WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}' });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#chatLogLink').click(function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
be.bastelstu.Chat.Log.loadOverlay();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})(jQuery, this)
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#timsChatCopyrightDialog {
|
.timsChatMessage::before {
|
||||||
background-image: url("{link controller='Chat' action='Copyright' sheep=1}{/link}");
|
content: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
{assign var='type' value='\wcf\data\chat\message\ChatMessage::TYPE_'}
|
{assign var='type' value='\chat\data\message\Message::TYPE_'}
|
||||||
.timsChatMessage{$type|concat:'JOIN'|constant}, .timsChatMessage{$type|concat:'LEAVE'|constant},
|
.timsChatMessage{$type|concat:'JOIN'|constant}::before {
|
||||||
.timsChatMessage{$type|concat:'INFORMATION'|constant}, .timsChatMessage{$type|concat:'ERROR'|constant} {
|
content: "\f090";
|
||||||
background-position: left top;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 16px 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessage{$type|concat:'JOIN'|constant} {
|
.timsChatMessage{$type|concat:'LEAVE'|constant}::before {
|
||||||
background-image: url({icon size='S'}circleArrowRight{/icon});
|
content: "\f08b";
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessage{$type|concat:'LEAVE'|constant} {
|
.timsChatMessage{$type|concat:'INFORMATION'|constant}::before {
|
||||||
background-image: url({icon size='S'}circleArrowLeft{/icon});
|
content: "\f05a";
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessage{$type|concat:'INFORMATION'|constant} {
|
.timsChatMessage{$type|concat:'ERROR'|constant}::before {
|
||||||
background-image: url({icon size='S'}systemInfo{/icon});
|
content: "\f05e";
|
||||||
}
|
|
||||||
|
|
||||||
.timsChatMessage{$type|concat:'ERROR'|constant} {
|
|
||||||
background-image: url({icon size='S'}systemError{/icon});
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="tpl{$templateName|ucfirst}">
|
<body id="tpl{$templateName|ucfirst}">
|
||||||
{capture assign='sidebar'}{include file='chatSidebar'}{/capture}
|
{capture assign='sidebar'}{include application='chat' file='sidebar'}{/capture}
|
||||||
{capture assign='headerNavigation'}{include file='chatNavigationInclude'}{/capture}
|
{capture assign='headerNavigation'}{include application='chat' file='navigationInclude'}{/capture}
|
||||||
{include file='header' sandbox=false sidebarOrientation='right'}
|
{include file='header' sandbox=false sidebarOrientation='right'}
|
||||||
|
|
||||||
<div id="timsChatRoomContent">
|
<div id="timsChatRoomContent">
|
||||||
<div id="timsChatTopic" class="container"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div>
|
<div id="timsChatTopic" class="container"{if $room->topic|language === ''} style="display: none;"{/if}>{$room->topic|language}</div>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div id="timsChatMessageContainer" class="timsChatMessageContainer container box shadow1">
|
<div id="timsChatMessageContainer" class="timsChatMessageContainer container box shadow1">
|
||||||
|
<noscript><p class="error">{lang}chat.general.noJs{/lang}</p></noscript>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="error">{lang}wcf.chat.noJs{/lang}</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<form id="timsChatForm" action="{link controller='Chat' action='Send'}{/link}" method="post">
|
<form id="timsChatForm" action="{link application='chat' controller='Chat' action='Send'}{/link}" method="post">
|
||||||
<input id="timsChatInput" accesskey="w" type="text" class="inputText long" name="text" autocomplete="off" maxlength="{@CHAT_MAX_LENGTH}" disabled="disabled" required="required" placeholder="{lang}wcf.chat.submit.default{/lang}" />
|
<input id="timsChatInput" accesskey="w" type="text" class="inputText long" name="text" autocomplete="off" maxlength="{@CHAT_MAX_LENGTH}" disabled="disabled" required="required" placeholder="{lang}chat.general.submit.default{/lang}" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="timsChatControls" class="marginTop">
|
<div id="timsChatControls" class="marginTop">
|
||||||
@ -87,99 +135,38 @@
|
|||||||
<ul class="smallButtons">
|
<ul class="smallButtons">
|
||||||
<li>
|
<li>
|
||||||
<a id="timsChatAutoscroll" accesskey="d" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.disable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="1">
|
<a id="timsChatAutoscroll" accesskey="d" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.disable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="1">
|
||||||
<img alt="" src="{icon size='S'}enabled{/icon}" /> <span>{lang}wcf.chat.scroll{/lang}</span>
|
<span class="icon icon16 icon-circle-blank"></span><span>{lang}chat.general.scroll{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="timsChatFullscreen" accesskey="f" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.disable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="0">
|
<a id="timsChatFullscreen" accesskey="f" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.disable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="0">
|
||||||
<img alt="" src="{icon size='S'}disabled{/icon}" /> <span>{lang}wcf.chat.fullscreen{/lang}</span>
|
<span class="icon icon16 icon-off"></span><span>{lang}chat.general.fullscreen{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="timsChatNotify" accesskey="n" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.enable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="0">
|
<a id="timsChatNotify" accesskey="n" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.enable{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="0">
|
||||||
<img alt="" src="{icon size='S'}disabled{/icon}" /> <span>{lang}wcf.chat.notify{/lang}</span>
|
<span class="icon icon16 icon-off"></span><span>{lang}chat.general.notify{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li{if !MODULE_SMILEY} style="display: none;"{/if}>
|
<li{if !MODULE_SMILEY} style="display: none;"{/if}>
|
||||||
<a id="timsChatSmilies" accesskey="e" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.{if ENABLE_SMILIES_DEFAULT_VALUE}dis{else}en{/if}able{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="{@ENABLE_SMILIES_DEFAULT_VALUE}">
|
<a id="timsChatSmilies" accesskey="e" class="timsChatToggle jsTooltip button" title="{lang}wcf.global.button.{if ENABLE_SMILIES_DEFAULT_VALUE}dis{else}en{/if}able{/lang}" data-disable-message="{lang}wcf.global.button.disable{/lang}" data-enable-message="{lang}wcf.global.button.enable{/lang}" data-status="{@ENABLE_SMILIES_DEFAULT_VALUE}">
|
||||||
<img alt="" src="{icon size='S'}{if ENABLE_SMILIES_DEFAULT_VALUE}en{else}dis{/if}abled{/icon}" /> <span>{lang}wcf.chat.smilies{/lang}</span>
|
<span class="icon icon16 icon-{if ENABLE_SMILIES_DEFAULT_VALUE}circle-blank{else}off{/if}"></span><span>{lang}chat.general.smilies{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="timsChatClear" class="jsTooltip button" title="{lang}wcf.chat.clear.description{/lang}">
|
<a id="timsChatClear" class="jsTooltip button" title="{lang}chat.general.clear.description{/lang}">
|
||||||
<img alt="" src="{icon size='S'}delete{/icon}" /> <span>{lang}wcf.chat.clear{/lang}</span>
|
<span class="icon icon16 icon-remove"></span><span>{lang}chat.general.clear{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a id="timsChatMark" class="jsTooltip button" title="{lang}wcf.chat.mark.description{/lang}">
|
<a id="timsChatMark" class="jsTooltip button" title="{lang}chat.general.mark.description{/lang}">
|
||||||
<img alt="" src="{icon size='S'}check{/icon}" /> <span>{lang}wcf.chat.mark{/lang}</span>
|
<span class="icon icon16 icon-check"></span><span>{lang}chat.general.mark{/lang}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{include file='chatCopyright'}
|
|
||||||
</div>
|
</div>
|
||||||
{include file='chatJavascriptInclude'}
|
|
||||||
<script type="text/javascript">
|
|
||||||
//<![CDATA[
|
|
||||||
var chat;
|
|
||||||
(function ($, window) {
|
|
||||||
// remove noscript message
|
|
||||||
$('.timsChatMessageContainer .error').remove();
|
|
||||||
|
|
||||||
WCF.Language.addObject({
|
|
||||||
'wcf.chat.query': '{lang}wcf.chat.query{/lang}',
|
|
||||||
'wcf.chat.kick': '{lang}wcf.chat.kick{/lang}',
|
|
||||||
'wcf.chat.ban': '{lang}wcf.chat.ban{/lang}',
|
|
||||||
'wcf.chat.profile': '{lang}wcf.chat.profile{/lang}',
|
|
||||||
'wcf.chat.notify.title': '{lang}wcf.chat.notify.title{/lang}'
|
|
||||||
});
|
|
||||||
WCF.Icon.addObject({
|
|
||||||
'be.bastelstu.wcf.chat.chat': '{icon}chat{/icon}'
|
|
||||||
});
|
|
||||||
{event name='shouldInit'}
|
|
||||||
// Boot the chat
|
|
||||||
WCF.TabMenu.init();
|
|
||||||
new WCF.Message.Smilies();{*
|
|
||||||
*}{capture assign='chatMessageTemplate'}{include file='chatMessage'}{/capture}
|
|
||||||
|
|
||||||
|
|
||||||
chat = new be.bastelstu.WCF.Chat({
|
|
||||||
reloadTime: {@CHAT_RELOADTIME},
|
|
||||||
unloadURL: '{link controller="Chat" action="Leave"}{/link}',
|
|
||||||
messageURL: '{link controller="Chat" action="Message"}{/link}',
|
|
||||||
socketIOPath: '{@CHAT_SOCKET_IO_PATH|encodeJS}'
|
|
||||||
}, (new WCF.Template('{ldelim}$title} - {'wcf.chat.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile(), (new WCF.Template('{@$chatMessageTemplate|encodeJS}')).compile());
|
|
||||||
{event name='didInit'}
|
|
||||||
|
|
||||||
// show the last X messages
|
|
||||||
chat.handleMessages([
|
|
||||||
{implode from=$newestMessages item='message'}{@$message->jsonify()}{/implode}
|
|
||||||
]);
|
|
||||||
|
|
||||||
// enable user-interface
|
|
||||||
$('#timsChatInput').enable().jCounter().focus();
|
|
||||||
|
|
||||||
$('#timsChatCopyright').click(function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
if ($.wcfIsset('timsChatCopyrightDialog')) return WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' });
|
|
||||||
var container = $('<fieldset id="timsChatCopyrightDialog"></fieldset>');
|
|
||||||
container.load('{link controller='Chat' action='Copyright'}{/link}', function() {
|
|
||||||
$('body').append(container);
|
|
||||||
WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#chatLogLink').click(function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
be.bastelstu.WCF.Chat.Log.loadOverlay();
|
|
||||||
});
|
|
||||||
})(jQuery, this)
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{include file='footer' sandbox=false}
|
{include file='footer' sandbox=false}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
{if $templateName == 'chat'}<address id="timsChatCopyright" class="copyright">{lang}wcf.chat.copyright{/lang}</address>
|
|
||||||
{elseif $templateName == 'chatCopyright'}
|
|
||||||
<dl>
|
|
||||||
<dt>{lang}wcf.chat.copyright.leader{/lang}</dt>
|
|
||||||
<dd>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt>{lang}wcf.chat.copyright.developer{/lang}</dt>
|
|
||||||
<dd>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://tims.bastelstu.be/">Tim Düsterhus</a></li>
|
|
||||||
<li><a href="https://github.com/max-m">Maximilian Mader</a></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt>{lang}wcf.chat.copyright.graphics{/lang}</dt>
|
|
||||||
<dd>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://www.cls-design.com/">Tom</a></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt>{lang}wcf.chat.copyright.translation{/lang}</dt>
|
|
||||||
<dd>
|
|
||||||
<ul>
|
|
||||||
<li>Riccardo Vianello (it)</li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
<dl>
|
|
||||||
<dt>{lang}wcf.chat.copyright.thanks{/lang}</dt>
|
|
||||||
<dd>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://www.wbbaddons.de/user/2020-noone/">-noone-</a></li>
|
|
||||||
<li><a href="https://github.com/dtdesign">Alexander Ebert</a></li>
|
|
||||||
<li>Gabi</li>
|
|
||||||
<li><a href="https://github.com/Leon-">Stefan Hahn</a></li>
|
|
||||||
<li><a href="http://packageforge.de">Oliver Kliebisch</a></li>
|
|
||||||
<li>Christian Kubandt</li>
|
|
||||||
<li><a href="http://www.wbbaddons.de">Martin Schwendowius</a></li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
{/if}
|
|
@ -1,5 +0,0 @@
|
|||||||
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/be.bastelstu.WCF.Chat.js{if $chatVersion|isset}?version={$chatVersion|urlencode}{/if}"></script>
|
|
||||||
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/jCounter.jQuery.js"></script>
|
|
||||||
{if CHAT_SOCKET_IO_PATH}<script type="text/javascript" src="{CHAT_SOCKET_IO_PATH}/socket.io/socket.io.js"></script>{/if}
|
|
||||||
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/be.bastelstu.WCF.Chat.Log.js"></script>
|
|
||||||
{event name='javascript'}
|
|
@ -1 +0,0 @@
|
|||||||
{literal}<time>{@$formattedTime}</time> <span class="username">{@$formattedUsername}</span><span class="separator">{$separator}</span> <span class="text">{@$formattedMessage}</span>{/literal}
|
|
@ -1,5 +0,0 @@
|
|||||||
<li>
|
|
||||||
<a id="chatLogLink" title="{lang}wcf.chat.protocol{/lang}" class="jsTooltip">
|
|
||||||
<img src="{icon size='S'}eye{/icon}" alt="" /> <span>{lang}wcf.chat.protocol{/lang}</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
@ -1,27 +0,0 @@
|
|||||||
<div id="sidebarContent" class="sidebarContent">
|
|
||||||
<nav class="timsChatSidebarTabs">
|
|
||||||
<ul>
|
|
||||||
<li id="toggleUsers" class="active"><a title="{lang}wcf.chat.users{/lang}">{lang}wcf.chat.users{/lang} <span class="badge">0</span></a></li>
|
|
||||||
<li id="toggleRooms"><a title="{lang}wcf.chat.rooms{/lang}" data-refresh-url="{link controller="Chat" action="RefreshRoomList"}{/link}">{lang}wcf.chat.rooms{/lang} <span class="badge">{#$rooms|count}</span></a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div id="sidebarContainer">
|
|
||||||
<ul id="timsChatUserList">
|
|
||||||
</ul>
|
|
||||||
<nav id="timsChatRoomList" class="sidebarMenu" style="display: none;">
|
|
||||||
<div>
|
|
||||||
<ul>
|
|
||||||
{foreach from=$rooms item='roomListRoom'}
|
|
||||||
{if $roomListRoom->canEnter()}
|
|
||||||
<li{if $roomListRoom->roomID == $room->roomID} class="activeMenuItem"{/if}>
|
|
||||||
<a href="{link controller='Chat' object=$roomListRoom}{/link}" class="timsChatRoom">{$roomListRoom}</a>
|
|
||||||
</li>
|
|
||||||
{/if}
|
|
||||||
{/foreach}
|
|
||||||
</ul>
|
|
||||||
<div><button type="button">{lang}wcf.chat.forceRefresh{/lang}</button></div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
5
template/javascriptInclude.tpl
Normal file
5
template/javascriptInclude.tpl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<script type="text/javascript" src="{@$__wcf->getPath('chat')}js/be.bastelstu.Chat.js?version={PACKAGE_VERSION|urlencode}"></script>
|
||||||
|
<script type="text/javascript" src="{@$__wcf->getPath('chat')}js/jCounter.jQuery.js"></script>
|
||||||
|
{if CHAT_SOCKET_IO_PATH}<script type="text/javascript" src="{CHAT_SOCKET_IO_PATH}/socket.io/socket.io.js"></script>{/if}
|
||||||
|
<script type="text/javascript" src="{@$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log.js?version={PACKAGE_VERSION|urlencode}"></script>
|
||||||
|
{event name='javascript'}
|
@ -6,7 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
var log = new be.bastelstu.WCF.Chat.Log(chat);
|
var log = new be.bastelstu.Chat.Log(chat);
|
||||||
log.handleMessages([
|
log.handleMessages([
|
||||||
{implode from=$messages item='message'}
|
{implode from=$messages item='message'}
|
||||||
{@$message->jsonify()}
|
{@$message->jsonify()}
|
1
template/message.tpl
Normal file
1
template/message.tpl
Normal file
@ -0,0 +1 @@
|
|||||||
|
{literal}<time>{@$formattedTime}</time> <span class="usernameContainer"><span class="username">{@$formattedUsername}</span><span class="separator">{$separator}</span></span> <span class="text">{@$formattedMessage}</span>{/literal}
|
5
template/navigationInclude.tpl
Normal file
5
template/navigationInclude.tpl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<li>
|
||||||
|
<a id="chatLogLink" title="{lang}chat.general.protocol{/lang}" class="jsTooltip">
|
||||||
|
<span class="icon icon16 icon-eye-open"></span> <span>{lang}chat.general.protocol{/lang}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
27
template/sidebar.tpl
Normal file
27
template/sidebar.tpl
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<div id="sidebarContent" class="sidebarContent">
|
||||||
|
<nav class="timsChatSidebarTabs">
|
||||||
|
<ul>
|
||||||
|
<li id="toggleUsers" class="active"><a title="{lang}chat.general.users{/lang}">{lang}chat.general.users{/lang} <span class="badge">0</span></a></li>
|
||||||
|
<li id="toggleRooms"><a title="{lang}chat.general.rooms{/lang}" data-refresh-url="{link application='chat' controller='RoomList'}{/link}">{lang}chat.general.rooms{/lang} <span class="badge">{#$rooms|count}</span><span class="ajaxLoad icon icon32 icon-spinner"></span></a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="sidebarContainer">
|
||||||
|
<ul id="timsChatUserList">
|
||||||
|
</ul>
|
||||||
|
<nav id="timsChatRoomList" class="sidebarMenu" style="display: none;">
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{foreach from=$rooms item='roomListRoom'}
|
||||||
|
{if $roomListRoom->canEnter()}
|
||||||
|
<li{if $roomListRoom->roomID == $room->roomID} class="activeMenuItem"{/if}>
|
||||||
|
<a href="{link application='chat' controller='Chat' object=$roomListRoom}{/link}" class="timsChatRoom">{$roomListRoom}</a>
|
||||||
|
</li>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
<div><button type="button">{lang}chat.general.forceRefresh{/lang}</button></div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
11
templateListener.xml
Normal file
11
templateListener.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?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/templateListener.xsd">
|
||||||
|
<import>
|
||||||
|
<templatelistener name="copyright">
|
||||||
|
<environment>user</environment>
|
||||||
|
<templatename>footer</templatename>
|
||||||
|
<eventname>copyright</eventname>
|
||||||
|
<templatecode><![CDATA[{include file='__copyright' application='chat'}]]></templatecode>
|
||||||
|
</templatelistener>
|
||||||
|
</import>
|
||||||
|
</data>
|
@ -8,8 +8,8 @@
|
|||||||
<category name="mod.chat">
|
<category name="mod.chat">
|
||||||
<parent>mod</parent>
|
<parent>mod</parent>
|
||||||
</category>
|
</category>
|
||||||
<category name="admin.content.chat">
|
<category name="admin.chat">
|
||||||
<parent>admin.content</parent>
|
<parent>admin</parent>
|
||||||
</category>
|
</category>
|
||||||
</categories>
|
</categories>
|
||||||
|
|
||||||
@ -80,20 +80,20 @@
|
|||||||
<defaultvalue>0</defaultvalue>
|
<defaultvalue>0</defaultvalue>
|
||||||
<admindefaultvalue>1</admindefaultvalue>
|
<admindefaultvalue>1</admindefaultvalue>
|
||||||
</option>
|
</option>
|
||||||
<option name="admin.content.chat.canAddRoom">
|
<option name="admin.chat.canAddRoom">
|
||||||
<categoryname>admin.content.chat</categoryname>
|
<categoryname>admin.chat</categoryname>
|
||||||
<optiontype>boolean</optiontype>
|
<optiontype>boolean</optiontype>
|
||||||
<defaultvalue>0</defaultvalue>
|
<defaultvalue>0</defaultvalue>
|
||||||
<admindefaultvalue>1</admindefaultvalue>
|
<admindefaultvalue>1</admindefaultvalue>
|
||||||
</option>
|
</option>
|
||||||
<option name="admin.content.chat.canEditRoom">
|
<option name="admin.chat.canEditRoom">
|
||||||
<categoryname>admin.content.chat</categoryname>
|
<categoryname>admin.chat</categoryname>
|
||||||
<optiontype>boolean</optiontype>
|
<optiontype>boolean</optiontype>
|
||||||
<defaultvalue>0</defaultvalue>
|
<defaultvalue>0</defaultvalue>
|
||||||
<admindefaultvalue>1</admindefaultvalue>
|
<admindefaultvalue>1</admindefaultvalue>
|
||||||
</option>
|
</option>
|
||||||
<option name="admin.content.chat.canDeleteRoom">
|
<option name="admin.chat.canDeleteRoom">
|
||||||
<categoryname>admin.content.chat</categoryname>
|
<categoryname>admin.chat</categoryname>
|
||||||
<optiontype>boolean</optiontype>
|
<optiontype>boolean</optiontype>
|
||||||
<defaultvalue>0</defaultvalue>
|
<defaultvalue>0</defaultvalue>
|
||||||
<admindefaultvalue>1</admindefaultvalue>
|
<admindefaultvalue>1</admindefaultvalue>
|
||||||
|
Loading…
Reference in New Issue
Block a user