1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Add GunbanCommand and GunmuteCommand

This commit is contained in:
Tim Düsterhus 2013-05-30 19:16:43 +02:00
parent be1479940f
commit 5fc79821c8
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace chat\system\command\commands;
use \chat\data\suspension;
use \chat\util\ChatUtil;
use \wcf\data\user\User;
use \wcf\system\WCF;
/**
* Unbans a user globally.
*
* @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 GunbanCommand extends UnmuteCommand {
/**
* @see \chat\system\command\commands\UnmuteCommand::executeAction()
*/
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)) {
$action = new suspension\SuspensionAction(array($suspension), 'delete');
$action->executeAction();
}
else {
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.notExists'));
}
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace chat\system\command\commands;
use \chat\data\suspension;
use \chat\util\ChatUtil;
use \wcf\data\user\User;
use \wcf\system\WCF;
/**
* Unmutes a user globally.
*
* @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 GunbanCommand extends UnmuteCommand {
/**
* @see \chat\system\command\commands\UnmuteCommand::executeAction()
*/
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)) {
$action = new suspension\SuspensionAction(array($suspension), 'delete');
$action->executeAction();
}
else {
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.notExists'));
}
}
}

View File

@ -123,6 +123,8 @@
<item name="chat.message.5.gban"><![CDATA[hat {@$link} bis {@$expires|plainTime} global gebannt.]]></item> <item name="chat.message.5.gban"><![CDATA[hat {@$link} bis {@$expires|plainTime} global gebannt.]]></item>
<item name="chat.message.5.unmute"><![CDATA[hat {@$link} entknebelt.]]></item> <item name="chat.message.5.unmute"><![CDATA[hat {@$link} entknebelt.]]></item>
<item name="chat.message.5.unban"><![CDATA[hat {@$link} entbannt.]]></item> <item name="chat.message.5.unban"><![CDATA[hat {@$link} entbannt.]]></item>
<item name="chat.message.5.gunmute"><![CDATA[hat {@$link} global entknebelt.]]></item>
<item name="chat.message.5.gunban"><![CDATA[hat {@$link} global entbannt.]]></item>
<item name="chat.message.color.success"><![CDATA[Die Farbe wurde erfolgreich geändert.]]></item> <item name="chat.message.color.success"><![CDATA[Die Farbe wurde erfolgreich geändert.]]></item>
</category> </category>