game/modules_data/moder/usesm.php

43 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if (!defined('GAME')) {
die();
}
if ($p['sm2'] != 1 && $p['citysm2'] != 1 && $p['citysm1'] != 1 && $p['sm1'] != 1) {
$uer = 'У Вас нет прав на использование данного заклятия';
return;
}
$tm = (int)$_POST['time'];
if ($tm != 1 && $tm != 2 && $tm != 3) { // 1 чат 2 форум 3 чат+форум
//todo избавиться от этого блядства.
$uer = 'Неверно указаны данные';
return;
}
$uu = \Core\Db::getRow('select id, login, molch1, molch2 from users where login = ? order by id limit 1', [$_POST['logingo']]);
if (!isset($uu['id'])) {
$uer = 'Персонаж не найден в этом городе';
return;
}
$cmsg = new ChatMessage();
$cmsg->setRoom($u->info['room']);
$cmsg->setType(6);
$cmsg->setTypeTime(1);
if ($tm != 2 && $uu['molch1'] >= time()) {
(new \Moderation\Moderation($uu['id']))->unsilence();
$uer = "С персонажа {$uu['login']} снят запрет на общение в чате.";
$cmsg->setText("[img[items/pal_button3.gif]] $uer");
(new Chat())->sendMsg($cmsg);
}
if ($tm != 1 && $uu['molch2'] >= time()) {
\Core\Db::sql('update users set molch2 = default where id = ?', [$uu['id']]);
$uer = "С персонажа {$uu['login']} снят запрет на общение на форуме.";
$cmsg->setText("[img[items/fsleep_off.gif]] $uer");
(new Chat())->sendMsg($cmsg);
}