From e77fbaca4fceffc701fbb13d3d91b4f8933ce80a Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Mon, 12 Jun 2023 02:30:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=BD=D0=B0=D0=B4=20#49?= =?UTF-8?q?.=20=D0=92=D1=81=D0=B5=20=D0=B7=D0=B0=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=B5=20=D0=BE=D0=B3=D0=BE=D0=B2=D0=BE=D1=80=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=81=D0=BA=D0=B8=D0=B5=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B2=20=D0=BE=D0=B4=D0=BD=D0=BE=D0=BC=20=D1=84?= =?UTF-8?q?=D0=BB=D0=B0=D0=BA=D0=BE=D0=BD=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/Moderation/Moderation.php | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 _incl_data/class/Moderation/Moderation.php 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