99 lines
2.6 KiB
PHP
99 lines
2.6 KiB
PHP
|
<?php
|
|||
|
|
|||
|
namespace Moderation;
|
|||
|
|
|||
|
use Core\Db;
|
|||
|
use Delo;
|
|||
|
use User;
|
|||
|
|
|||
|
class AdmFactory
|
|||
|
{
|
|||
|
public readonly string $status;
|
|||
|
private array $targetUser;
|
|||
|
|
|||
|
public function __construct(
|
|||
|
private readonly string $targetLogin,
|
|||
|
)
|
|||
|
{
|
|||
|
$this->targetUser = User::getInfo($this->targetLogin);
|
|||
|
}
|
|||
|
|
|||
|
public function addmoderator(): void
|
|||
|
{
|
|||
|
Moderator::add($this->targetUser['id']);
|
|||
|
Delo::add(
|
|||
|
10,
|
|||
|
'moderation.addmoderator',
|
|||
|
$this->targetUser['id'],
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.'
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
public function removemoderator(): void
|
|||
|
{
|
|||
|
Moderator::remove($this->targetUser['id']);
|
|||
|
Delo::add(
|
|||
|
10,
|
|||
|
'moderation.removemoderator',
|
|||
|
$this->targetUser['id'],
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.'
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
public function changegender(): void
|
|||
|
{
|
|||
|
$changeto = $this->targetUser['sex'] == 0 ? 1 : 0;
|
|||
|
Db::sql('update users set sex = ? where id = ?', [$changeto, $this->targetUser['id']]);
|
|||
|
Delo::add(
|
|||
|
10,
|
|||
|
'moderation.changegender',
|
|||
|
$this->targetUser['id'],
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.'
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
public function changelogin(string $login): void
|
|||
|
{
|
|||
|
$newlogin = strip_tags($login);
|
|||
|
if (empty($newlogin)) {
|
|||
|
return;
|
|||
|
}
|
|||
|
Db::sql('update users set login = ? where login = ?', [strip_tags($login), $this->targetLogin]);
|
|||
|
Delo::add(
|
|||
|
10,
|
|||
|
'moderation.changelogin',
|
|||
|
$this->targetUser['id'],
|
|||
|
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. $this->targetLogin => " . strip_tags($login)
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
public function toggleinvisibility(): void
|
|||
|
{
|
|||
|
$changeto = $this->targetUser['invis'] == 0 ? 1 : 0;
|
|||
|
Db::sql('update users set invis = ? where id = ?', [$changeto, $this->targetUser['id']]);
|
|||
|
}
|
|||
|
|
|||
|
public function additem(int $itemId): void
|
|||
|
{
|
|||
|
if ($itemId < 1) {
|
|||
|
return;
|
|||
|
}
|
|||
|
User\ItemsModel::addItem($itemId, $this->targetUser['id']);
|
|||
|
}
|
|||
|
|
|||
|
public function kickfrombattle(): void
|
|||
|
{
|
|||
|
if (empty($this->targetUser['battle'])) {
|
|||
|
$this->status = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.';
|
|||
|
return;
|
|||
|
}
|
|||
|
Db::sql('update users left join stats on users.id = stats.id
|
|||
|
set
|
|||
|
battle = default,
|
|||
|
team = default,
|
|||
|
battle_yron = default,
|
|||
|
battle_exp = default
|
|||
|
where id = ?', [$this->targetUser['id']]);
|
|||
|
// <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>?
|
|||
|
}
|
|||
|
}
|