diff --git a/_incl_data/class/Moderation/Moderation.php b/_incl_data/class/Moderation/Moderation.php new file mode 100644 index 00000000..78f66114 --- /dev/null +++ b/_incl_data/class/Moderation/Moderation.php @@ -0,0 +1,119 @@ +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. + } +} \ No newline at end of file