86 lines
2.9 KiB
PHP
86 lines
2.9 KiB
PHP
<?php
|
|
# Date: 25.01.2021 (22:59)
|
|
|
|
namespace Battles;
|
|
|
|
use Battles\Database\DBPDO;
|
|
|
|
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");
|
|
}
|
|
|
|
public static function muteChat(int $target, int $time)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[2]);
|
|
User::addUserEffect($target, 2, UserEffects::$effectName[2], $time);
|
|
}
|
|
|
|
public static function unmuteChat(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[2] . self::STATUS_OFF);
|
|
User::removeUserEffect($target, 2);
|
|
}
|
|
|
|
public static function muteForum(int $target, int $time)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[3]);
|
|
User::addUserEffect($target, 3, UserEffects::$effectName[3], $time);
|
|
}
|
|
|
|
public static function unmuteForum(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[3] . self::STATUS_OFF);
|
|
User::removeUserEffect($target, 3);
|
|
}
|
|
|
|
public static function hideUserInfo(int $target, int $time)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[5]);
|
|
User::addUserEffect($target, 5, UserEffects::$effectName[5], $time);
|
|
}
|
|
|
|
public static function unHideUserInfo(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[5] . self::STATUS_OFF);
|
|
User::removeUserEffect($target, 5);
|
|
}
|
|
|
|
public static function blockUser(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, "Блокировка");
|
|
DBPDO::INIT()->execute('UPDATE battles.users SET block = 1 WHERE id = ?', $target);
|
|
}
|
|
|
|
public static function unBlockUser(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, "Блокировка" . self::STATUS_OFF);
|
|
DBPDO::INIT()->execute('UPDATE battles.users SET block = 0 WHERE block = 1 AND id = ?', $target);
|
|
}
|
|
|
|
public static function addToUserLog(int $target, string $message, int $senderId)
|
|
{
|
|
GameLogs::addUserLog($target, $message, "moderation", $senderId);
|
|
}
|
|
|
|
public static function setAlign(int $target, int $align)
|
|
{
|
|
DBPDO::INIT()->execute('UPDATE users SET align = ? WHERE id = ?', [$align, $target]);
|
|
}
|
|
|
|
public static function addChatSysMsg(string $message)
|
|
{
|
|
DBPDO::INIT()->execute('INSERT INTO chat (user_id,msg,type) VALUES (-1,?,?)', [$message, 'sys']);
|
|
}
|
|
|
|
public static function addUserCheck(int $target)
|
|
{
|
|
self::addEffectStatusToUserLog($target, UserEffects::$effectName[20]);
|
|
User::addUserEffect($target, 20, UserEffects::$effectName[20], strtotime('3days'));
|
|
}
|
|
} |