mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-23 21:50:09 +00:00
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?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();
|
|
}
|
|
}
|