Процесс работы над #49. Все заранее оговоренные модераторские функции в одном флаконе.
This commit is contained in:
parent
490b9bc901
commit
a2775be423
119
_incl_data/class/Moderation/Moderation.php
Normal file
119
_incl_data/class/Moderation/Moderation.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace Moderation;
|
||||
|
||||
use Core\Db;
|
||||
use DateTime;
|
||||
|
||||
// todo Çàïèñü â ëè÷íîå äåëî èëè äîáàâèòü èëè óáðàòü îñòàòêè.
|
||||
// todo Çàìåíèòü óðîäñêèé êîñòûëü ñ òþðåìíûì ñóíäóêîì. Âîçìîæåí êîíôëèêò ñ àâòîóäàëåíèåì ïðåäìåòîâ!
|
||||
// todo Ïîíÿòü êàê ìîíèòîðèòü ïåðåâîäû.
|
||||
|
||||
class Moderation
|
||||
{
|
||||
private const JAIL_ROOM = 274;
|
||||
private const CENTRAL_SQUARE_ROOM = 9;
|
||||
private const JAIL_STORAGE = 1357908642; /* Óõ, êîñòûëü! */
|
||||
|
||||
private int $target;
|
||||
|
||||
public function __construct(int $userid)
|
||||
{
|
||||
$this->target = $userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ìîë÷àíèå
|
||||
* @param DateTime $expiration ñðîê èñòå÷åíèÿ.
|
||||
* @param string|null $reason ïðè÷èíà ïðèìåíåíèÿ.
|
||||
*/public function silence(DateTime $expiration, ?string $reason = null)
|
||||
{
|
||||
Db::sql('update users set molch1 = ? where id = ?', [$expiration->getTimestamp(), $this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñíÿòèå ìîë÷àíèÿ
|
||||
*/
|
||||
public function unsilence()
|
||||
{
|
||||
Db::sql('update users set molch1 = default where id = ?', [$this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Îáåçëè÷èâàíèå
|
||||
* @param DateTime $expiration ñðîê èñòå÷åíèÿ.
|
||||
* @param string|null $reason ïðè÷èíà ïðèìåíåíèÿ.
|
||||
*/
|
||||
public function depersonalize(DateTime $expiration, ?string $reason = null)
|
||||
{
|
||||
Db::sql('update users set info_delete = ? where id = ?', [$expiration->getTimestamp(), $this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñíÿòèå îáåçëè÷èâàíèÿ
|
||||
*/
|
||||
public function undepersonalize()
|
||||
{
|
||||
Db::sql('update users set info_delete = default where id = ?', [$this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Òþðüìà
|
||||
* @param DateTime $expiration ñðîê èñòå÷åíèÿ.
|
||||
* @param string|null $reason ïðè÷èíà ïðèìåíåíèÿ.
|
||||
*/
|
||||
public function prison(DateTime $expiration, ?string $reason = null)
|
||||
{
|
||||
Db::sql('update users set jail = ?, room = ? where id = ?', [
|
||||
$expiration->getTimestamp(),
|
||||
self::JAIL_ROOM,
|
||||
$this->target,
|
||||
]);
|
||||
Db::sql('update items_users set `delete` = ? where `delete` = 0 and uid = ?', [
|
||||
self::JAIL_STORAGE,
|
||||
$this->target,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñíÿòèå òþðüìû
|
||||
*/
|
||||
public function unprison()
|
||||
{
|
||||
Db::sql('update users set jail = default, room = ? where id = ?', [
|
||||
self::CENTRAL_SQUARE_ROOM,
|
||||
$this->target,
|
||||
]);
|
||||
Db::sql('update items_users set `delete` = default where `delete` = ? and uid = ?', [
|
||||
1357908642,
|
||||
$this->target,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Áëîêèðîâêà
|
||||
* @param string|null $reason ïðè÷èíà ïðèìåíåíèÿ.
|
||||
*/
|
||||
public function ban(?string $reason = null)
|
||||
{
|
||||
Db::sql('update users set banned = unix_timestamp() where id = ?', [$this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ñíÿòèå áëîêèðîâêè
|
||||
*/
|
||||
public function unban()
|
||||
{
|
||||
Db::sql('update users set banned = default where id = ?', [$this->target]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ïðîâåðêà ïåðåâîäîâ
|
||||
* @param Target $uid êòî ïðîâåðÿåòñÿ.
|
||||
* @param DateTime|null $date äàòà ïåðåâîäîâ, åñëè íå óêàçàíî - ïîêàçàòü âñå ïåðåâîäû.
|
||||
*/
|
||||
public function showItemTransferLogs(Target $uid, ?DateTime $date)
|
||||
{
|
||||
// TODO: Implement showItemTransferLogs() method.
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user