2021-02-01 01:42:24 +00:00
|
|
|
<?php
|
|
|
|
# Date: 25.01.2021 (22:59)
|
|
|
|
|
|
|
|
namespace Battles;
|
|
|
|
|
2022-01-26 23:15:33 +00:00
|
|
|
use Battles\Database\Db;
|
2021-02-01 01:42:24 +00:00
|
|
|
|
|
|
|
class Moderation
|
|
|
|
{
|
|
|
|
private const STATUS_OFF = " [снято]";
|
|
|
|
|
|
|
|
private static function addEffectStatusToUserLog(int $userId, string $message)
|
|
|
|
{
|
|
|
|
$message = "Получен эффект «" . $message . "» до " . date("d.m.Y H:i");
|
|
|
|
GameLogs::addUserLog($userId, $message, "moderation");
|
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function muteChat(int $target, int $time)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[2]);
|
|
|
|
UserEffect::add($target, 2, UserEffect::$effectName[2], $time);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function unmuteChat(int $target)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[2] . self::STATUS_OFF);
|
|
|
|
UserEffect::remove($target, 2);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function muteForum(int $target, int $time)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[3]);
|
|
|
|
UserEffect::add($target, 3, UserEffect::$effectName[3], $time);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function unmuteForum(int $target)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[3] . self::STATUS_OFF);
|
|
|
|
UserEffect::remove($target, 3);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function hideUserInfo(int $target, int $time)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[5]);
|
|
|
|
UserEffect::add($target, 5, UserEffect::$effectName[5], $time);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function unHideUserInfo(int $target)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[5] . self::STATUS_OFF);
|
|
|
|
UserEffect::remove($target, 5);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function blockUser(int $target)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
|
|
|
self::addEffectStatusToUserLog($target, "Блокировка");
|
2022-08-09 19:57:43 +00:00
|
|
|
Db::getInstance()->execute('UPDATE users SET block = 1 WHERE id = ?', $target);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2022-08-09 19:57:43 +00:00
|
|
|
public static function unblockUser(int $target)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
|
|
|
self::addEffectStatusToUserLog($target, "Блокировка" . self::STATUS_OFF);
|
2022-08-09 19:57:43 +00:00
|
|
|
Db::getInstance()->execute('UPDATE users SET block = 0 WHERE block = 1 AND id = ?', $target);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function addToUserLog(int $target, string $message, int $senderId)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
|
|
|
GameLogs::addUserLog($target, $message, "moderation", $senderId);
|
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function setAlign(int $target, int $align)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-01-26 23:15:33 +00:00
|
|
|
Db::getInstance()->execute('UPDATE users SET align = ? WHERE id = ?', [$align, $target]);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function addChatSysMsg(string $message)
|
2021-02-01 01:42:24 +00:00
|
|
|
{
|
2022-01-26 23:15:33 +00:00
|
|
|
Db::getInstance()->execute('INSERT INTO chat (user_id,msg,type) VALUES (-1,?,?)', [$message, 'sys']);
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|
2021-02-01 20:53:28 +00:00
|
|
|
|
2021-08-25 01:44:36 +00:00
|
|
|
public static function addUserCheck(int $target)
|
2021-02-01 20:53:28 +00:00
|
|
|
{
|
2022-08-09 19:57:43 +00:00
|
|
|
self::addEffectStatusToUserLog($target, UserEffect::$effectName[20]);
|
|
|
|
UserEffect::add($target, 20, UserEffect::$effectName[20], strtotime('3days'));
|
2021-02-01 20:53:28 +00:00
|
|
|
}
|
2021-02-01 01:42:24 +00:00
|
|
|
}
|