diff --git a/file/js/be.bastelstu.Chat.coffee b/file/js/be.bastelstu.Chat.coffee index 4a94805..f067331 100644 --- a/file/js/be.bastelstu.Chat.coffee +++ b/file/js/be.bastelstu.Chat.coffee @@ -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 = $ '
' + WCF.String.escapeHTML('><((((\u00B0>') + '
' + fish = $ """
#{WCF.String.escapeHTML('><((((\u00B0>')}
""" 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.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.addClass 'activeMenuItem' if room.active - $('' + room.title + '').addClass('timsChatRoom').appendTo li + $("""#{room.title}""").addClass('timsChatRoom').appendTo li $('#timsChatRoomList ul').append li $('.timsChatRoom').click $.proxy (event) -> diff --git a/file/lib/data/suspension/Suspension.class.php b/file/lib/data/suspension/Suspension.class.php index 2f2d140..4fba51c 100644 --- a/file/lib/data/suspension/Suspension.class.php +++ b/file/lib/data/suspension/Suspension.class.php @@ -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(); diff --git a/file/lib/system/command/commands/GbanCommand.class.php b/file/lib/system/command/commands/GbanCommand.class.php new file mode 100644 index 0000000..0754a7f --- /dev/null +++ b/file/lib/system/command/commands/GbanCommand.class.php @@ -0,0 +1,41 @@ + + * @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(); + } +} diff --git a/file/lib/system/command/commands/GmuteCommand.class.php b/file/lib/system/command/commands/GmuteCommand.class.php new file mode 100644 index 0000000..d8fe988 --- /dev/null +++ b/file/lib/system/command/commands/GmuteCommand.class.php @@ -0,0 +1,41 @@ + + * @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(); + } +} diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 40a257c..5690b34 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -319,10 +319,10 @@ } #toggleRooms .ajaxLoad { - position: absolute; - right: 5px; - top: 3px; - display: none; + position: absolute; + right: 5px; + top: 3px; + display: none; } #timsChatCopyright { diff --git a/language/de.xml b/language/de.xml index 5ac9154..ba88b3c 100644 --- a/language/de.xml +++ b/language/de.xml @@ -112,6 +112,8 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die + + diff --git a/objectType.xml b/objectType.xml index 422ecda..455e677 100644 --- a/objectType.xml +++ b/objectType.xml @@ -1,5 +1,5 @@ - + be.bastelstu.chat.room diff --git a/template/chat.tpl b/template/chat.tpl index 887a4e4..96d03a8 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -154,7 +154,7 @@
  • - + {lang}chat.general.clear{/lang}