mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Add global mute and global ban
This commit is contained in:
parent
5f29e5e8c1
commit
89f222258e
@ -13,6 +13,7 @@ window.console ?=
|
||||
error: () ->
|
||||
|
||||
(($, window, _console) ->
|
||||
"use strict";
|
||||
window.be ?= {}
|
||||
be.bastelstu ?= {}
|
||||
|
||||
@ -268,7 +269,7 @@ window.console ?=
|
||||
freeTheFish: () ->
|
||||
return if $.wcfIsset 'fish'
|
||||
console.warn 'Freeing the fish'
|
||||
fish = $ '<div id="fish">' + WCF.String.escapeHTML('><((((\u00B0>') + '</div>'
|
||||
fish = $ """<div id="fish">#{WCF.String.escapeHTML('><((((\u00B0>')}</div>"""
|
||||
fish.css
|
||||
position: 'absolute'
|
||||
top: '150px'
|
||||
@ -368,7 +369,7 @@ window.console ?=
|
||||
|
||||
# Move the user to the correct position
|
||||
if element[0]
|
||||
console.log 'Moving User: "' + user.username + '"'
|
||||
console.log "Moving User: '#{user.username}'"
|
||||
element = element.detach()
|
||||
if user.awayStatus?
|
||||
element.addClass 'away'
|
||||
@ -385,7 +386,7 @@ window.console ?=
|
||||
$('#timsChatUserList').append element
|
||||
# Insert the user
|
||||
else
|
||||
console.log 'Inserting User: "' + user.username + '"'
|
||||
console.log "Inserting User: '#{user.username}'"
|
||||
li = $ '<li></li>'
|
||||
li.attr 'id', id
|
||||
li.addClass 'timsChatUser'
|
||||
@ -424,7 +425,7 @@ window.console ?=
|
||||
# Remove users that were not found
|
||||
$('.timsChatUser').each () ->
|
||||
if typeof foundUsers[$(@).attr('id')] is 'undefined'
|
||||
console.log 'Removing User: "' + $(@).data('username') + '"'
|
||||
console.log "Removing User: '#{$(@).data('username')}'"
|
||||
$(@).remove();
|
||||
|
||||
|
||||
@ -510,7 +511,7 @@ window.console ?=
|
||||
for room in data
|
||||
li = $ '<li></li>'
|
||||
li.addClass 'activeMenuItem' if room.active
|
||||
$('<a href="' + room.link + '">' + room.title + '</a>').addClass('timsChatRoom').appendTo li
|
||||
$("""<a href="#{room.link}">#{room.title}</a>""").addClass('timsChatRoom').appendTo li
|
||||
$('#timsChatRoomList ul').append li
|
||||
|
||||
$('.timsChatRoom').click $.proxy (event) ->
|
||||
|
@ -65,10 +65,17 @@ public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user,
|
||||
chat".WCF_N."_suspension
|
||||
WHERE
|
||||
userID = ?
|
||||
AND roomID = ?
|
||||
AND type = ?";
|
||||
|
||||
$parameter = array($user->userID, $type);
|
||||
if ($room->roomID) {
|
||||
$sql .= " AND roomID = ?";
|
||||
$parameter[] = $room->roomID;
|
||||
}
|
||||
else $sql .= " AND roomID IS NULL";
|
||||
|
||||
$statement = WCF::getDB()->prepareStatement($sql);
|
||||
$statement->execute(array($user->userID, $room->roomID, $type));
|
||||
$statement->execute($parameter);
|
||||
$row = $statement->fetchArray();
|
||||
if(!$row) $row = array();
|
||||
|
||||
|
41
file/lib/system/command/commands/GbanCommand.class.php
Normal file
41
file/lib/system/command/commands/GbanCommand.class.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace chat\system\command\commands;
|
||||
use \chat\data\suspension;
|
||||
use \chat\util\ChatUtil;
|
||||
use \wcf\data\user\User;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Globally bans a user.
|
||||
*
|
||||
* @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.chat.command.commands
|
||||
*/
|
||||
class GbanCommand extends MuteCommand {
|
||||
public function executeAction() {
|
||||
$room = new \chat\data\room\Room(null, array('roomID' => null));
|
||||
|
||||
if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, suspension\Suspension::TYPE_BAN)) {
|
||||
if ($suspension->time > TIME_NOW + $this->time) {
|
||||
$this->fail = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$editor = new suspension\SuspensionEditor($suspension);
|
||||
$editor->delete();
|
||||
}
|
||||
|
||||
$this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array(
|
||||
'data' => array(
|
||||
'userID' => $this->user->userID,
|
||||
'roomID' => null,
|
||||
'type' => suspension\Suspension::TYPE_BAN,
|
||||
'time' => TIME_NOW + $this->time
|
||||
)
|
||||
));
|
||||
$this->suspensionAction->executeAction();
|
||||
}
|
||||
}
|
41
file/lib/system/command/commands/GmuteCommand.class.php
Normal file
41
file/lib/system/command/commands/GmuteCommand.class.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace chat\system\command\commands;
|
||||
use \chat\data\suspension;
|
||||
use \chat\util\ChatUtil;
|
||||
use \wcf\data\user\User;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Globally bans a user.
|
||||
*
|
||||
* @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.chat.command.commands
|
||||
*/
|
||||
class GmuteCommand extends MuteCommand {
|
||||
public function executeAction() {
|
||||
$room = new \chat\data\room\Room(null, array('roomID' => null));
|
||||
|
||||
if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, suspension\Suspension::TYPE_MUTE)) {
|
||||
if ($suspension->time > TIME_NOW + $this->time) {
|
||||
$this->fail = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$editor = new suspension\SuspensionEditor($suspension);
|
||||
$editor->delete();
|
||||
}
|
||||
|
||||
$this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array(
|
||||
'data' => array(
|
||||
'userID' => $this->user->userID,
|
||||
'roomID' => null,
|
||||
'type' => suspension\Suspension::TYPE_MUTE,
|
||||
'time' => TIME_NOW + $this->time
|
||||
)
|
||||
));
|
||||
$this->suspensionAction->executeAction();
|
||||
}
|
||||
}
|
@ -319,10 +319,10 @@
|
||||
}
|
||||
|
||||
#toggleRooms .ajaxLoad {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 3px;
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 3px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#timsChatCopyright {
|
||||
|
@ -112,6 +112,8 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die
|
||||
<item name="chat.message.5.restore"><![CDATA[hat {@$link} zurückgesetzt.]]></item>
|
||||
<item name="chat.message.5.mute"><![CDATA[hat {@$link} bis {@$until|plainTime} geknebelt.]]></item>
|
||||
<item name="chat.message.5.ban"><![CDATA[hat {@$link} bis {@$until|plainTime} gebannt.]]></item>
|
||||
<item name="chat.message.5.gmute"><![CDATA[hat {@$link} bis {@$until|plainTime} global geknebelt.]]></item>
|
||||
<item name="chat.message.5.gban"><![CDATA[hat {@$link} bis {@$until|plainTime} global gebannt.]]></item>
|
||||
|
||||
<!-- 7 = TYPE_WHISPER -->
|
||||
<item name="chat.message.7"><![CDATA[flüstert{if $showReceiver} an {$username}{/if}:]]></item>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?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/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/objecttype.xsd">
|
||||
<import>
|
||||
<type>
|
||||
<name>be.bastelstu.chat.room</name>
|
||||
|
@ -154,7 +154,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="timsChatClear" class="jsTooltip button" title="{lang}chat.general.clear.description{/lang}">
|
||||
<a id="timsChatClear" class="button">
|
||||
<span class="icon icon16 icon-remove"></span><span>{lang}chat.general.clear{/lang}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user