Много рефактора

This commit is contained in:
2023-12-19 03:58:37 +02:00
parent 253eafca3b
commit 07f905ef64
24 changed files with 2748 additions and 3199 deletions
+6 -6
View File
@@ -25,7 +25,7 @@ class AdmFactory
10,
'moderation.addmoderator',
$this->targetUser['id'],
'Íàçíà÷åí íà ïîñò ìîäåðàòîðà.'
'Назначен на пост модератора.'
);
}
@@ -36,7 +36,7 @@ class AdmFactory
10,
'moderation.removemoderator',
$this->targetUser['id'],
'Óâîëåí ñ ïîñòà ìîäåðàòîðà.'
'Уволен с поста модератора.'
);
}
@@ -48,7 +48,7 @@ class AdmFactory
10,
'moderation.changegender',
$this->targetUser['id'],
'Èçìåíåí ïîë ïåðñîíàæà.'
'Изменен пол персонажа.'
);
}
@@ -63,7 +63,7 @@ class AdmFactory
10,
'moderation.changelogin',
$this->targetUser['id'],
"Èçìåíåí ëîãèí ïåðñîíàæà. $this->targetLogin => " . strip_tags($login)
"Изменен логин персонажа. $this->targetLogin => " . strip_tags($login)
);
}
@@ -84,7 +84,7 @@ class AdmFactory
public function kickfrombattle(): void
{
if (empty($this->targetUser['battle'])) {
$this->status = 'Ïåðñîíàæ íå â ïîåäèíêå.';
$this->status = 'Персонаж не в поединке.';
return;
}
Db::sql('update users left join stats on users.id = stats.id
@@ -94,6 +94,6 @@ class AdmFactory
battle_yron = default,
battle_exp = default
where id = ?', [$this->targetUser['id']]);
// Â îðèãèíàëå òóò åù¸ ïèñàëàñü çàïèñü â ëîã áîÿ, íî íóæíà ëè îíà?
// В оригинале тут ещё писалась запись в лог боя, но нужна ли она?
}
}
+6 -6
View File
@@ -17,13 +17,13 @@ class Announcement
{
echo <<<HTML
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Ìåãàôîí</h4>
<h4>Мегафон</h4>
<form method="post"></form>
<label for="announcementText">Ñîîáùåíèå</label>
<label for="announcementText">Сообщение</label>
<input name="announcementText" type="text" id="announcementText" size="70" maxlength="1000">
<input type="submit" name="announcementModeration" id="announcementModeration" class="btn" value="Íàïèñàòü"><br>
<input type="submit" name="announcementModeration" id="announcementModeration" class="btn" value="Написать"><br>
<input name="announcementIsSigned" type="checkbox" id="announcementIsSigned" value="1">
<label for="announcementIsSigned">îò ñâîåãî èìåíè</label>
<label for="announcementIsSigned">от своего имени</label>
</form>
</div>
HTML;
@@ -41,9 +41,9 @@ HTML;
return;
}
$sender = empty($_POST['announcementIsSigned']) ? '<b>Àäìèíèñòðàöèÿ</b>' : User::getLogin(User::start()->info['id']);
$sender = empty($_POST['announcementIsSigned']) ? '<b>Администрация</b>' : User::getLogin(User::start()->info['id']);
(new Chat())->sendsys("$sender: $strippedMessage");
echo '<span style="color: red; "><b>Ñîîáùåíèå óñïåøíî îòïðàâëåíî</b></span>';
echo '<span style="color: red; "><b>Сообщение успешно отправлено</b></span>';
}
}
+18 -18
View File
@@ -10,7 +10,7 @@ use User;
class ModFactory
{
private const ERROR_WRONG_DURATION = 'Íåâåðíî óêàçàí ñðîê íàêàçàíèÿ';
private const ERROR_WRONG_DURATION = 'Неверно указан срок наказания';
public readonly string $status;
private DateTime $time;
private ChatMessage $msg;
@@ -21,12 +21,12 @@ class ModFactory
public function __construct(
private readonly string $targetLogin,
private readonly string $reason,
int $moderatorsRoom // Êîìíàòà ãäå ñèäèò ìîäåðàòîð.
int $moderatorsRoom // Комната где сидит модератор.
)
{
$this->targetUser = User::getInfo($this->targetLogin);
if (empty($this->targetUser)) {
$this->status = 'Ïåðñîíàæ íå íàéäåí!';
$this->status = 'Персонаж не найден!';
return;
}
$this->chat = new Chat();
@@ -46,7 +46,7 @@ class ModFactory
}
$this->time->modify("+ $minutes minute");
$this->moderation->silence($this->time, $this->reason);
$this->status = "Ïåðñîíàæó $this->targetLogin çàïðåùåíî îáùàòüñÿ â ÷àòå äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->status = "Персонажу $this->targetLogin запрещено общаться в чате до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->msg->setText("[img[items/silence.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -54,11 +54,11 @@ class ModFactory
public function unsilence(): void
{
if ($this->targetUser['molch1'] < $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ íå ìîë÷èò!';
$this->status = 'Персонаж не молчит!';
return;
}
$this->moderation->unsilence();
$this->status = "Ñ ïåðñîíàæà $this->targetLogin ñíÿò çàïðåò íà îáùåíèå â ÷àòå.";
$this->status = "С персонажа $this->targetLogin снят запрет на общение в чате.";
$this->msg->setText("[img[items/pal_button3.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -71,8 +71,8 @@ class ModFactory
}
$this->time->modify("+ $days day");
$this->moderation->prison($this->time, $this->reason);
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
$this->status = "Ïåðñîíàæ $this->targetLogin áûë îòïðàâëåí â òþðüìó äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
$this->status = "Персонаж $this->targetLogin был отправлен в тюрьму до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->msg->setText("[img[items/jail.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -80,7 +80,7 @@ class ModFactory
public function unprison(): void
{
$this->moderation->unprison();
$this->status = "Ïåðñîíàæ $this->targetLogin áûë âûïóùåí èç òþðüìû.";
$this->status = "Персонаж $this->targetLogin был выпущен из тюрьмы.";
$this->msg->setText("[img[items/jail_off.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -92,12 +92,12 @@ class ModFactory
return;
}
if ($this->targetUser['info_delete'] === 1 || $this->targetUser['info_delete'] >= $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ óæå ïîä ïîäîçðåíèåì.';
$this->status = 'Персонаж уже под подозрением.';
return;
}
$this->time->modify("+ $days day");
$this->moderation->depersonalize($this->time, $this->reason);
$this->status = "Ïåðñîíàæ $this->targetLogin ïîä ïîäîçðåíèåì äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
$this->status = "Персонаж $this->targetLogin под подозрением до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
$this->msg->setText("[img[items/cui.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -105,11 +105,11 @@ class ModFactory
public function undepersonalize(): void
{
if ($this->targetUser['info_delete'] <= $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ íå ïîä ïîäîçðåíèåì.';
$this->status = 'Персонаж не под подозрением.';
return;
}
$this->moderation->undepersonalize();
$this->status = "Ïåðñîíàæ $this->targetLogin áîëüøå íå ïîä ïîäîçðåíèåì";
$this->status = "Персонаж $this->targetLogin больше не под подозрением";
$this->msg->setText("[img[items/uncui.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -119,15 +119,15 @@ class ModFactory
$this->moderation->ban($this->reason);
Db::sql('delete from chat where login = ?', [$this->targetLogin]);
Db::sql('insert into ban_email (email, uid, nick_name) values (?,?,?)', [$this->targetUser['mail'], $this->targetUser['id'], $this->targetLogin]);
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè íà áîé.
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Удаляем заявки на бой.
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
if (!empty($this->targetUser['battle'])) {
Db::sql(
'update users left join stats on users.id = stats.id set battle = default, regHP = unix_timestamp(), team = 0, battle_yron = 0, battle_exp = 0 where users.id = ?',
[$this->targetUser['id']]
);
}
$this->status = "Ïåðñîíàæ $this->targetLogin çàáëîêèðîâàí";
$this->status = "Персонаж $this->targetLogin заблокирован";
$this->msg->setText("[img[items/pal_button6.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -135,12 +135,12 @@ class ModFactory
public function unban(): void
{
if (empty($this->targetUser['banned'])) {
$this->status = 'Ïåðñîíàæ íå â áëîêå.';
$this->status = 'Персонаж не в блоке.';
return;
}
$this->moderation->unban();
Db::sql('delete from ban_email where email = ?', [$this->targetUser['mail']]);
$this->status = "Ïåðñîíàæ $this->targetLogin ðàçáëîêèðîâàí";
$this->status = "Персонаж $this->targetLogin разблокирован";
$this->msg->setText("[img[items/pal_button7.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@@ -7,7 +7,7 @@ use User;
class UserRegistrationList
{
/** Ðåãèñòðàöèè ïåðñîíàæåé: òîëüêî äëÿ àäìèíèñòðàòîðîâ.
/** Регистрации персонажей: только для администраторов.
* @return void
*/
public static function get(): void
@@ -35,14 +35,14 @@ class UserRegistrationList
</script>
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Ðåãèñòðàöèè ïåðñîíàæåé</h4>
<label for="loginLD520">Äàòà ðåãèñòðàöèè</label>
<h4>Регистрации персонажей</h4>
<label for="loginLD520">Дата регистрации</label>
<input name="pometka520" class="btn btn-success" onclick="regprev()" type="submit" value="&laquo;"/>
<input value="<?= $pld520 ?>" name="loginLD520" type="text" id="loginLD520" size="20" maxlength="10"/>
<input name="pometka520" class="btn btn-success" onclick="regnext()" type="submit" value="&raquo;"/>
<input type="submit" name="pometka520" id="pometka520" class="btn" value="Ïîêàçàòü"/>
<input type="submit" name="pometka520" id="pometka520" class="btn" value="Показать"/>
<?php if (isset($_POST['pometka520'])): ?>
<br><b style="color: red;">Ïåðñîíàæè çàðåãèñòðèðîâàííûå <?= $pld520 ?></b>
<br><b style="color: red;">Персонажи зарегистрированные <?= $pld520 ?></b>
<ol>
<?php foreach (Db::getRows($query, [$pld520TS, $pld520TS + 86400]) as $pl):
$logincolor = match (true) {
@@ -55,13 +55,13 @@ class UserRegistrationList
<li>
<span style="color: <?= $logincolor ?>"> <?= User::getLogin($pl['id']) ?> </span>
<?php if ($pl['molch1'] > time()): ?>
<i>(ìîë÷èò)</i>
<i>(молчит)</i>
<?php endif; ?>
<?php if ($pl['battle'] > 0): ?>
<a href="/logs.php?log=<?= $pl['battle'] ?>" target="_blank">(â áîþ)</a>
<a href="/logs.php?log=<?= $pl['battle'] ?>" target="_blank">(в бою)</a>
<?php endif; ?>
<?php if ($pl['host_reg'] > 0): ?>
<small>(ðåôåðàë ïåðñîíàæà <?= User::getLogin($pl['host_reg']) ?>)</small>
<small>(реферал персонажа <?= User::getLogin($pl['host_reg']) ?>)</small>
<?php endif; ?>
</li>
<?php endforeach; ?>