2013-02-01 19:41:59 +00:00
|
|
|
<?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)) {
|
2013-05-23 23:21:46 +00:00
|
|
|
if ($suspension->expires > $this->expires) {
|
2013-04-23 13:53:21 +00:00
|
|
|
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists'));
|
2013-02-01 19:41:59 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 23:21:46 +00:00
|
|
|
$action = new suspension\SuspensionAction(array($suspension), 'delete');
|
|
|
|
$action->executeAction();
|
2013-02-01 19:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array(
|
|
|
|
'data' => array(
|
|
|
|
'userID' => $this->user->userID,
|
|
|
|
'roomID' => null,
|
|
|
|
'type' => suspension\Suspension::TYPE_BAN,
|
2013-05-23 23:21:46 +00:00
|
|
|
'expires' => $this->expires
|
2013-02-01 19:41:59 +00:00
|
|
|
)
|
|
|
|
));
|
|
|
|
$this->suspensionAction->executeAction();
|
|
|
|
}
|
|
|
|
}
|