dev-moderation #66

Merged
lopar merged 29 commits from dev-moderation into dev 2023-12-09 14:14:38 +00:00
Showing only changes of commit dac8ffef5d - Show all commits

View File

@ -15,16 +15,6 @@ if (!$m->isModerator) {
return;
}
$rang = 'Модератор';
if (isset($_GET['remod'])) {
if ($_GET['remod'] == 1) {
$_SESSION['remod'] = 3;
} else {
$_SESSION['remod'] = 1;
}
}
$merror = '';
$uer = '';
@ -50,23 +40,23 @@ if (!empty($_POST['logingo'])) {
$moderation->depersonalize($_POST['time']);
} elseif (!empty($_POST['undepersonalize'])) {
$moderation->undepersonalize();
} elseif (!empty($_POST['ban'])) {
} elseif (!empty($_POST['ban']) && $m->canBlockUsers) {
$moderation->ban();
} elseif (!empty($_POST['unban'])) {
} elseif (!empty($_POST['unban']) && $m->canBlockUsers) {
$moderation->unban();
} elseif (!empty($_POST['addmoderator'])) {
} elseif (!empty($_POST['addmoderator']) && $m->isAdmin) {
$administration->addmoderator();
} elseif (!empty($_POST['deletemoderator'])) {
} elseif (!empty($_POST['deletemoderator']) && $m->isAdmin) {
$administration->removemoderator();
} elseif (!empty($_POST['changegender'])) {
} elseif (!empty($_POST['changegender']) && $m->isAdmin) {
$administration->changegender();
} elseif (!empty($_POST['changelogin']) && !empty($_POST['newLogin'])) {
} elseif (!empty($_POST['changelogin']) && !empty($_POST['newLogin']) && $m->isAdmin) {
$administration->changelogin($_POST['newLogin']);
} elseif (!empty($_POST['giveitem']) && !empty($_POST['itemId'])) {
} elseif (!empty($_POST['giveitem']) && !empty($_POST['itemId']) && $m->isAdmin) {
$administration->additem((int)$_POST['itemId']);
} elseif (!empty($_POST['kickfrombattle'])) {
} elseif (!empty($_POST['kickfrombattle']) && $m->isAdmin) {
$administration->kickfrombattle();
} elseif (!empty($_POST['toggleinvisibility'])) {
} elseif (!empty($_POST['toggleinvisibility']) && $m->isAdmin) {
$administration->toggleinvisibility();
}
@ -93,7 +83,7 @@ if (isset($_GET['go'])) {
$go = round($_GET['go']);
}
if ($go == 3 && $u->info['admin'] > 0) {
if ($go == 3 && $m->isAdmin) {
?>
<table style="width: 100%">
<tr>
@ -227,11 +217,11 @@ if ($go == 3 && $u->info['admin'] > 0) {
</tr>
</table>
<?php
} elseif ($go == 2 && $u->info['admin'] > 0) {
} elseif ($go == 2 && $m->isAdmin) {
if (isset($_POST['q_name'])) {
$qd = [];
/* Array ([q_act_atr_1] => 0 [q_act_val_1] => [q_tr_atr_1] => 0 [q_tr_val_1] => [q_ng_atr_1] => 0 [q_ng_val_1] => [q_nk_atr_NaN] => 0
[q_nk_val_NaN] => [q_info] => test описание [q_line1] => 1 [q_line2] => 1 [q_fast] => 1 [q_fast_city] => capitalcity [q_align1] => 1 [q_align2] => 1 [q_align3] => 1 ) */
[q_nk_val_NaN] => [q_info] => test описание [q_line1] => 1 [q_line2] => 1 [q_fast] => 1 [q_align1] => 1 [q_align2] => 1 [q_align3] => 1 ) */
$qd['name'] = $_POST['q_name'];
$qd['lvl'] = explode('-', $_POST['q_lvl']);
$qd['info'] = $_POST['q_info'];
@ -239,7 +229,6 @@ if ($go == 3 && $u->info['admin'] > 0) {
$qd['line'] = $_POST['q_line2'];
}
if ($_POST['q_fast'] == 1) {
$qd['city'] = $_POST['q_fast_city'];
$gd['fast'] = 1;
}
if ($_POST['align1'] == 1) {
@ -257,7 +246,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
}
} else {
$i = -2;
$qd['act_date'] = trim($qd['act_date'], ':|:');
$qd['act_date'] = trim($qd['act_date'], ':|');
}
$i++;
}
@ -269,7 +258,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
}
} else {
$i = -2;
$qd['tr_date'] = trim($qd['tr_date'], ':|:');
$qd['tr_date'] = trim($qd['tr_date'], ':|');
}
$i++;
}
@ -281,7 +270,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
}
} else {
$i = -2;
$qd['win_date'] = trim($qd['win_date'], ':|:');
$qd['win_date'] = trim($qd['win_date'], ':|');
}
$i++;
}
@ -293,7 +282,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
}
} else {
$i = -2;
$qd['lose_date'] = trim($qd['lose_date'], ':|:');
$qd['lose_date'] = trim($qd['lose_date'], ':|');
}
$i++;
}
@ -397,18 +386,43 @@ if ($go == 3 && $u->info['admin'] > 0) {
</script>
<title>Текстовое поле</title>
<style>
.vtop {
vertical-align: top;
}
<table width="100%">
.center {
text-align: center;
}
table.cs0 {
border-spacing: 0;
}
table.cp5 {
border-collapse: collapse;
}
table.cp5 td {
padding: 5px;
}
table.newquest {
width: 100%;
border: 0;
background-color: #e1e1e1;
}
</style>
<table style="width: 100%;">
<tr>
<td align="center"><h3>Редактор заданий</h3></td>
<td width="150" align="right">
<td class="center"><h3>Редактор заданий</h3></td>
<td style="width: 150px; text-align: right;">
<input type="button" class="btn btn-success" value="Вернуться" onclick="location='/main.php?moderation';"/>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#E1E1E1">
<table class="cs0 cp5 newquest">
<!-- -->
<tr>
<td style="border-bottom:1px solid #CCCCCC;">
@ -422,58 +436,55 @@ if ($go == 3 && $u->info['admin'] > 0) {
<td style="border-bottom:1px solid #CCCCCC; background-color: #dadada;">
<b>Панель добавления новых заданий:</b><br>
<form method="post" action="/main.php?moderation&go=2">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<table class="cs0 cp5" style="width: 100%; border: 0;">
<tr>
<td width="200" valign="top"><label for="q_name">Название задания</label></td>
<td><input name="q_name" id="q_name" value="" size="60" maxlength="50"/>
<td class="vtop" style="width: 200px;"><label for="q_name">Название задания</label></td>
<td><input name="q_name" id="q_name" size="60" maxlength="50">
</td>
</tr>
<tr>
<td valign="top"><label for="q_lvl">Уровень задания</label></td>
<td class="vtop"><label for="q_lvl">Уровень задания</label></td>
<td><input name="q_lvl" id="q_lvl" value="0-21" size="10" maxlength="5"/></td>
</tr>
<tr>
<td valign="top">Действия</td>
<td valign="top" id="qact"><a href="javascript:void(0)" onclick="addqact()"><small>[+] добавить</small></a></td>
<td class="vtop">Действия</td>
<td class="vtop" id="qact"><a href="javascript:void(0)" onclick="addqact()"><small>[+] добавить</small></a></td>
</tr>
<tr>
<td valign="top">Условия</td>
<td valign="top" id="qtr"><a href="javascript:void(0)" onclick="addqtr()"><small>[+] добавить</small></a></td>
<td class="vtop">Условия</td>
<td class="vtop" id="qtr"><a href="javascript:void(0)" onclick="addqtr()"><small>[+] добавить</small></a></td>
</tr>
<tr>
<td valign="top">Награда</td>
<td valign="top" id="qng"><a href="javascript:void(0)" onclick="addqng()"><small>[+] добавить</small></a></td>
<td class="vtop">Награда</td>
<td class="vtop" id="qng"><a href="javascript:void(0)" onclick="addqng()"><small>[+] добавить</small></a></td>
</tr>
<tr>
<td valign="top">Неудача</td>
<td valign="top" id="qnk"><a href="javascript:void(0)" onclick="addqnk()"><small>[+] добавить</small></a></td>
<td class="vtop">Неудача</td>
<td class="vtop" id="qnk"><a href="javascript:void(0)" onclick="addqnk()"><small>[+] добавить</small></a></td>
</tr>
<tr>
<td valign="top"><label for="q_info">Описание задания</label></td>
<td class="vtop"><label for="q_info">Описание задания</label></td>
<td><textarea name="q_info" id="q_info" style="width:90%" rows="7"></textarea></td>
</tr>
<tr style="background-color: #cbcbcb">
<td align="center" valign="top">
<label><input name="q_line1" type="checkbox" id="checkbox3" value="1"/>
<td class="vtop center">
<label><input name="q_line1" type="checkbox" id="checkbox3" value="1">
Линейное задание</label>
</td>
<td bgcolor="#CBCBCB">
<label><input name="q_line2" id="q_line3" value="" size="5" maxlength="3"/>
<td>
<label><input name="q_line2" id="q_line3" size="5" maxlength="3">
, id линейного сюжета</label>
</td>
</tr>
<tr style="background-color: #cbcbcb">
<td align="center" valign="top">
<label><input name="q_fast" type="checkbox" id="q_fast" value="1"/>
<td class="vtop center">
<label><input name="q_fast" type="checkbox" id="q_fast" value="1">
Быстрое задание</label>
</td>
<td>
<label><input name="q_fast_city" id="q_fast_city" value="capitalcity" size="50" maxlength="50">
, город которым ограничен квест <small>(стереть, если не ограничен)</small><label>
</td>
</tr>
<tr style="background-color: #cbcbcb">
<td align="center" valign="top">
<td class="vtop center">
<small>
<label>
<input name="q_align1" type="checkbox" id="q_align1" value="1">Свет,
@ -497,7 +508,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
<!-- -->
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#E1E1E1">
<table class="cs0 cp5 newquest">
<!-- -->
<?php
if (isset($_GET['delq'])) {
@ -542,30 +553,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
padding: 10px;
}
</style>
<script>
function openMod(title, dat) {
const d = document.getElementById('useMagic');
if (d) {
document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">' + title + '</td><td width="30" valign="top"><div align="right"><a title="Закрыть окно" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
top.chat.inObj = top.frames['main'].document.getElementById('logingo');
top.frames['main'].document.getElementById('logingo').focus();
}
}
function closeMod() {
const d = document.getElementById('useMagic');
if (d) {
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
}
}
</script>
<div id="useMagic"
style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;"
class="modpow">
<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;" class="modpow">
<div class="mt" id="modtitle"></div>
<div class="md" id="moddata"></div>
</div>
@ -583,9 +571,8 @@ if ($go == 3 && $u->info['admin'] > 0) {
<form action="/main.php?moderation&rnd=<?= PassGen::intCode() ?>" method="post" name="F1" id="F1">
<?php
$uer = '';
//используем заклятия
//используем заклятия (старая реализация, замещается)
if (isset($_GET['usemod'])) {
if (isset($_POST['usevampir'])) {
require_once('moder/usevampir.php');
} elseif (isset($_POST['teleport'])) {
@ -604,73 +591,70 @@ if ($go == 3 && $u->info['admin'] > 0) {
}
echo '<span style="color: red; ">' . $uer . '</span>';
//Темная склонка, кусается сука!)
?>
<br/>
<br>
<div style="padding:10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Наложить/Снять наказание</h4>
<form method="post" id="moderation">
<label for="logingo">Логин персонажа:</label>
<input type="text" id="logingo" name="logingo">
<label for="modReason">Причина действия (где применимо):</label>
<input type="text" id="modReason" name="modReason">
</form>
<?php if ($m->isModerator): ?>
<div style="padding:10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Наложить/Снять наказание</h4>
<form method="post" id="moderation">
<label for="logingo">Логин персонажа:</label>
<input type="text" id="logingo" name="logingo">
<label for="modReason">Причина действия (где применимо):</label>
<input type="text" id="modReason" name="modReason">
<div>
<label>Время в минутах: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="silence" value="Молчанка в чате" form="moderation">
<input type="submit" name="unsilence" value="❌ Снять молчанку" form="moderation"><br>
<label>Количество дней: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="prison" value="Посадить в тюрьму" form="moderation">
<input type="submit" name="unprison" value="❌ Выпустить из тюрьмы" form="moderation"><br>
<label>Количество дней: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="depersonalize" value="Скрыть профиль" form="moderation">
<input type="submit" name="undepersonalize" value="❌ Раскрыть профиль" form="moderation"><br>
<form method="post">
<label for="marrypartner1">Партнёр 1</label>
<input type="text" id="marrypartner1" name="logingo">
<label for="marrypartner2">Партнёр 2</label>
<input type="text" id="marrypartner2" name="logingo2">
<input type="submit" name="marry" value="💘 Свадьба!">
<input type="submit" name="unmarry" value="💔 Развод!">
</form>
<div>
<label>Время в минутах: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="silence" value="Молчанка в чате" form="moderation">
<input type="submit" name="unsilence" value="❌ Снять молчанку" form="moderation"><br>
<label>Количество дней: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="prison" value="Посадить в тюрьму" form="moderation">
<input type="submit" name="unprison" value="❌ Выпустить из тюрьмы" form="moderation"><br>
<label>Количество дней: <input type="number" min="1" name="time" form="moderation"></label>
<input type="submit" name="depersonalize" value="Скрыть профиль" form="moderation">
<input type="submit" name="undepersonalize" value="❌ Раскрыть профиль" form="moderation"><br>
<form method="post">
<label for="marrypartner1">Партнёр 1</label>
<input type="text" id="marrypartner1" name="logingo">
<label for="marrypartner2">Партнёр 2</label>
<input type="text" id="marrypartner2" name="logingo2">
<input type="submit" name="marry" value="💘 Свадьба!">
<input type="submit" name="unmarry" value="💔 Развод!">
</form>
<?php if ($m->canBlockUsers): ?>
<div style="background-color: lightcoral; margin: 5px 1px; border: 1px dashed crimson;">
<input type="submit" name="ban" value="🔒 ️Заблокировать>" form="moderation">
<input type="submit" name="unban" value="🔓 Разблокировать" form="moderation">
</div>
<?php endif; ?>
</div>
<?php if ($m->isAdmin): ?>
<div>
<a href="/main.php?moderation&go=2">Редактировать квесты, задания и обучающие программы</a><br>
<a href="/main.php?moderation&go=3">Редактировать квесты для Нубозавров</a><br>
<a href="/main.php?moderation&go=1">Редактировать возможности подчиненных</a><br>
<?php if ($m->canBlockUsers): ?>
<div style="background-color: lightcoral; margin: 5px 1px; border: 1px dashed crimson;">
<input type="submit" name="ban" value="🔒 ️Заблокировать>" form="moderation">
<input type="submit" name="unban" value="🔓 Разблокировать" form="moderation">
</div>
<input type="submit" name="addmoderator" value="Назначить модератором>" form="moderation">
<input type="submit" name="deletemoderator" value="❌ Убрать из модераторов" form="moderation">
<input type="submit" name="kickfrombattle" value="⚔️ Вытащить из боя>" form="moderation">
<input type="submit" name="changegender" value="👨🏻‍🤝‍👩🏻 Сменить пол" form="moderation"><br>
<label for="newLogin">Новый логин:</label> <input type="text" id="newLogin" name="newLogin">
<input type="submit" name="changelogin" value="📝 Сменить логин"><br>
<label for="itemId">ID предмета:</label> <input type="number" id="itemId" name="itemId" min="1">
<input type="submit" name="giveitem" value="🎁 Подарить предмет"><br>
<button disabled>Добавить опыта</button> <i style="color: grey">- очень сломанная херня.</i>
<?php endif; ?>
</div>
<?php endif;
<?php if ($m->isAdmin): ?>
<div>
<a href="/main.php?moderation&go=2">Редактировать квесты, задания и обучающие программы</a><br>
<a href="/main.php?moderation&go=3">Редактировать квесты для Нубозавров</a><br>
<a href="/main.php?moderation&go=1">Редактировать возможности подчиненных</a><br>
</div>
<input type="submit" name="addmoderator" value="Назначить модератором>" form="moderation">
<input type="submit" name="deletemoderator" value="❌ Убрать из модераторов" form="moderation">
<input type="submit" name="kickfrombattle" value="⚔️ Вытащить из боя>" form="moderation">
<input type="submit" name="changegender" value="👨🏻‍🤝‍👩🏻 Сменить пол" form="moderation"><br>
<label for="newLogin">Новый логин:</label> <input type="text" id="newLogin" name="newLogin">
<input type="submit" name="changelogin" value="📝 Сменить логин"><br>
<label for="itemId">ID предмета:</label> <input type="number" id="itemId" name="itemId" min="1">
<input type="submit" name="giveitem" value="🎁 Подарить предмет"><br>
<button disabled>Добавить опыта</button> <i style="color: grey">- очень сломанная херня.</i>
<?php endif; ?>
</div>
<?php
if ($m->isAdmin) {
/** Мегафон только для администраторов. */
Announcement::init();
@ -714,7 +698,6 @@ if ($go == 3 && $u->info['admin'] > 0) {
HTML;
}
}
} ?>
</form>
<?php