Refactor code and move admin user registration into separate class.
The new class, named UserRegistrationList, aims to handle user registrations specifically for administrators. Some superfluous code has been removed for better readability and efficiency, and replaced with simplified CSS styles and SQL queries. The use of Core\Db and Moderation\UserRegistrationList has been introduced to improve the structure and organization of the code.
This commit is contained in:
parent
cda265c799
commit
9912955775
@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Moderation\AdmFactory;
|
||||
use Moderation\Announcement;
|
||||
use Moderation\Moderator;
|
||||
use Moderation\ModFactory;
|
||||
use User\ItemsModel;
|
||||
use Core\Db;
|
||||
use Moderation\{AdmFactory, Announcement, Moderator, ModFactory, UserRegistrationList};
|
||||
|
||||
/** @var User $u */
|
||||
|
||||
@ -27,13 +24,6 @@ if (isset($_GET['remod'])) {
|
||||
$zv = [1 => 'light', 2 => 'admin', 3 => 'dark'];
|
||||
|
||||
$merror = '';
|
||||
|
||||
$mod_login = $u->info['login'];
|
||||
|
||||
if ($u->info['invise'] > 0) {
|
||||
$mod_login = "<i>Невидимка</i>";
|
||||
}
|
||||
|
||||
$uer = '';
|
||||
|
||||
if (!empty($_POST['logingo'])) {
|
||||
@ -96,7 +86,7 @@ if (!empty($_POST['marrypartner1']) && !empty($_POST['marrypartner2'])) {
|
||||
|
||||
echo '<script src="/js/jquery.js"></script>';
|
||||
|
||||
$p = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1'));
|
||||
$p = mysql_fetch_array(mysql_query('SELECT align FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1'));
|
||||
|
||||
if (!$m->isModerator && $u->info['align'] != 1 && $u->info['align'] != 3) {
|
||||
return; #########################
|
||||
@ -117,39 +107,21 @@ if (isset($_GET['go'])) {
|
||||
|
||||
if ($go == 3 && $u->info['admin'] > 0) {
|
||||
?>
|
||||
<table width="100%">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<td align="center"><h3>Редактирование обучающих квестов</h3></td>
|
||||
<td width="150" align="right"><input type="button" value=">"
|
||||
onclick="location='main.php?<?= $zv; ?>';"/>
|
||||
<input type="button" value="Вернуться"
|
||||
onclick="location='main.php?go=3&<?= $zv; ?>';"/>
|
||||
<?php if ($u->info['admin'] > 0) { ?>
|
||||
<input type="button" class="btn btn-success" value="<?php if ($a == 1) {
|
||||
echo 'Панель паладина';
|
||||
} else {
|
||||
echo 'Панель тармана';
|
||||
} ?>"
|
||||
onclick="location='main.php?go=1&<?= $zv; ?>&remod=<?= $a; ?>';"/>
|
||||
<?php } ?>
|
||||
<td style="text-align: center;"><h3>Редактирование обучающих квестов</h3></td>
|
||||
<td style="text-align: right; width: 150px;">
|
||||
<input type="button" value=">" onclick="location='main.php?<?= $zv; ?>';"/>
|
||||
<input type="button" value="Вернуться" onclick="location='main.php?go=3&<?= $zv; ?>';"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php
|
||||
if ($merror != '') {
|
||||
echo '<font color="red">' . $merror . '</font>';
|
||||
}
|
||||
?>
|
||||
<td><?= empty($merror) ? '' : "<span style='color: red;'>$merror</span>" ?>
|
||||
|
||||
<?php
|
||||
$sx = ['Мужской', 'Женский', 'Общий'];
|
||||
if (isset($_GET['eq'])) {
|
||||
$pl = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT * FROM `an_quest` WHERE `id` = "' . mysql_real_escape_string(
|
||||
$_GET['eq']
|
||||
) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
$pl = Db::getRow('select * from an_quest where id = ?', [(int)$_GET['eq']]);
|
||||
if (isset($pl['id'])) {
|
||||
if (isset($_POST['pl_name'])) {
|
||||
$pl['name'] = $_POST['pl_name'];
|
||||
@ -163,79 +135,103 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
$pl['data'] = $_POST['pl_data'];
|
||||
$pl['room'] = $_POST['pl_room'];
|
||||
$pl['module'] = $_POST['pl_module'];
|
||||
mysql_query(
|
||||
'UPDATE `an_quest` SET
|
||||
`name` = "' . mysql_real_escape_string($pl['name']) . '",
|
||||
`sex` = "' . mysql_real_escape_string($pl['sex']) . '",
|
||||
`ico_bot` = "' . mysql_real_escape_string($pl['ico_bot']) . '",
|
||||
`name_bot` = "' . mysql_real_escape_string($pl['name_bot']) . '",
|
||||
`info` = "' . mysql_real_escape_string($pl['info']) . '",
|
||||
`act` = "' . mysql_real_escape_string($pl['act']) . '",
|
||||
`next` = "' . mysql_real_escape_string($pl['next']) . '",
|
||||
`win` = "' . mysql_real_escape_string($pl['win']) . '",
|
||||
`data` = "' . mysql_real_escape_string($pl['data']) . '",
|
||||
`room` = "' . mysql_real_escape_string($pl['room']) . '",
|
||||
`module` = "' . mysql_real_escape_string($pl['module']) . '"
|
||||
WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
|
||||
);
|
||||
$pl = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT * FROM `an_quest` WHERE `id` = "' . mysql_real_escape_string(
|
||||
$_GET['eq']
|
||||
) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
|
||||
Db::sql('update an_quest set
|
||||
name = ?,
|
||||
sex = ?,
|
||||
ico_bot = ?,
|
||||
name_bot = ?,
|
||||
info = ?,
|
||||
act = ?,
|
||||
next = ?,
|
||||
win = ?,
|
||||
data = ?,
|
||||
room = ?,
|
||||
module = ?
|
||||
where id = ?',
|
||||
[
|
||||
$pl['name'],
|
||||
$pl['sex'],
|
||||
$pl['ico_bot'],
|
||||
$pl['name_bot'],
|
||||
$pl['info'],
|
||||
$pl['act'],
|
||||
$pl['next'],
|
||||
$pl['win'],
|
||||
$pl['data'],
|
||||
$pl['room'],
|
||||
$pl['module'],
|
||||
$pl['id'],
|
||||
]);
|
||||
|
||||
$pl = Db::getRow('select * from an_quest where id = ?', [(int)$_GET['eq']]);
|
||||
}
|
||||
?>
|
||||
<form method="post" action="main.php?<?= $zv ?>&go=3&eq=<?= $pl['id'] ?>">
|
||||
<form method="post" action="/main.php?<?= $zv ?>&go=3&eq=<?= $pl['id'] ?>">
|
||||
#id: <?= $pl['id'] ?><br/>
|
||||
Название квеста: <input style="width:200px;" name="pl_name" type="text"
|
||||
value="<?= $pl['name'] ?>"/><br/>
|
||||
<label>
|
||||
Название квеста:
|
||||
<input style="width:200px;" name="pl_name" type="text" value="<?= $pl['name'] ?>">
|
||||
</label><br/>
|
||||
<hr/>
|
||||
Пол: <input style="width:20px;" name="pl_sex" type="text"
|
||||
value="<?= $pl['sex'] ?>"/><br/>
|
||||
Картинка бота: <input style="width:216px;" name="pl_ico_bot" type="text"
|
||||
value="<?= $pl['ico_bot'] ?>"/><br/>
|
||||
Имя бота: <input style="width:253px;" name="pl_name_bot" type="text"
|
||||
value="<?= $pl['name_bot'] ?>"/>
|
||||
<label>
|
||||
Пол: <input style="width:20px;" name="pl_sex" type="text" value="<?= $pl['sex'] ?>">
|
||||
</label><br/>
|
||||
<label>
|
||||
Картинка бота: <input style="width:216px;" name="pl_ico_bot" type="text" value="<?= $pl['ico_bot'] ?>">
|
||||
</label><br/>
|
||||
<label>
|
||||
Имя бота: <input style="width:253px;" name="pl_name_bot" type="text" value="<?= $pl['name_bot'] ?>">
|
||||
</label>
|
||||
<hr/>
|
||||
<br/>
|
||||
Информация:<br/><textarea style="width:330px;"
|
||||
name="pl_info"><?= $pl['info'] ?></textarea><br/>
|
||||
Действие: <input style="width:255px;" name="pl_act" type="text"
|
||||
value="<?= $pl['act'] ?>"/><br/>
|
||||
Следующий квест: <input style="width:200px;" name="pl_next" type="text"
|
||||
value="<?= $pl['next'] ?>"/><br/>
|
||||
Награда: <input style="width:200px;" name="pl_win" type="text"
|
||||
value="<?= $pl['win'] ?>"/> (опыт|кр|екр|предметы)<br/>
|
||||
Дата: <input style="width:200px;" name="pl_data" type="text"
|
||||
value="<?= $pl['data'] ?>"/><br/>
|
||||
<label>
|
||||
Информация:<br/><textarea style="width:330px;" name="pl_info"><?= $pl['info'] ?></textarea>
|
||||
</label><br/>
|
||||
<label>
|
||||
Действие: <input style="width:255px;" name="pl_act" type="text" value="<?= $pl['act'] ?>">
|
||||
</label><br/>
|
||||
<label>
|
||||
Следующий квест: <input style="width:200px;" name="pl_next" type="text" value="<?= $pl['next'] ?>">
|
||||
</label><br/>
|
||||
<label>
|
||||
Награда: <input style="width:200px;" name="pl_win" type="text" value="<?= $pl['win'] ?>"> (опыт|кр|екр|предметы)
|
||||
</label><br/>
|
||||
<label>
|
||||
Дата: <input style="width:200px;" name="pl_data" type="text" value="<?= $pl['data'] ?>">
|
||||
</label><br/>
|
||||
<hr/>
|
||||
Комната (требует): <input name="pl_room" type="text"
|
||||
value="<?= $pl['room'] ?>"/><br/>
|
||||
Модуль, действие (требует): <input name="pl_module" type="text"
|
||||
value="<?= $pl['module'] ?>"/>
|
||||
<label>
|
||||
Комната (требует): <input name="pl_room" type="text" value="<?= $pl['room'] ?>">
|
||||
</label><br/>
|
||||
<label>
|
||||
Модуль, действие (требует): <input name="pl_module" type="text" value="<?= $pl['module'] ?>">
|
||||
</label>
|
||||
<hr/>
|
||||
<input type="submit" value="Сохранить квест"/>
|
||||
<input type="submit" value="Сохранить квест">
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo '<center>Квест не найден.</center>';
|
||||
echo '<div style="text-align: center">Квест не найден.</div>>';
|
||||
}
|
||||
} else {
|
||||
echo '<a href="main.php?' . $zv . '&go=3&add=1">Добавить новый квест</a><hr>';
|
||||
echo '<a href="/main.php?' . $zv . '&go=3&add=1">Добавить новый квест</a><hr>';
|
||||
if (isset($_GET['del'])) {
|
||||
mysql_query(
|
||||
'DELETE FROM `an_quest` WHERE `id` = "' . mysql_real_escape_string(
|
||||
$_GET['del']
|
||||
) . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('delete from an_quest where id = ?', [(int)$_GET['del']]);
|
||||
} elseif (isset($_GET['add'])) {
|
||||
mysql_query('INSERT INTO `an_quest` (`sex`) VALUES ("0") ');
|
||||
Db::sql('insert into an_quest (id) values (default)');
|
||||
}
|
||||
$sp = mysql_query('SELECT * FROM `an_quest`');
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
echo '<div><span style="width:50px;display:inline-block;">#' . $pl['id'] . '</span><b><span style="width:250px;display:inline-block;">' . $pl['name'] . ' (' . $sx[$pl['sex']] . ')</span></b> <a href="main.php?' . $zv . '&go=3&eq=' . $pl['id'] . '">Изменить</a> <a href="main.php?' . $zv . '&go=3&del=' . $pl['id'] . '">Удалить</a></div><hr>';
|
||||
foreach (Db::getRows('select id, name, sex from an_quest') as ['id' => $qid, 'name' => $qname, 'sex' => $qsex]) {
|
||||
$qsex = $sx[$qsex];
|
||||
echo <<<HTML
|
||||
<div>
|
||||
<span style="width:50px;display:inline-block;">$qid</span>
|
||||
<span style="width:250px;display:inline-block; font-weight: bold;">$qname($qsex)</span>
|
||||
<a href="/main.php?$zv&go=3&eq=$qid">Изменить</a>
|
||||
<a href="/main.php?$zv&go=3&del=$qid">Удалить</a>
|
||||
</div>
|
||||
<hr>
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -264,9 +260,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
$qd['align'] = 3;
|
||||
} elseif ($_POST['align3'] == 1) {
|
||||
$qd['align'] = 7;
|
||||
} elseif ($_POST['align4'] == 1) {
|
||||
$qd['align'] = 2;
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
while ($i != -1) {
|
||||
if (isset($_POST['q_act_atr_' . $i])) {
|
||||
@ -315,36 +309,34 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
mysql_query(
|
||||
'INSERT INTO `quests` (`name`,`min_lvl`,`max_lvl`,`tr_date`,`act_date`,`win_date`,`lose_date`,`info`,`line`,`align`,`city`,`fast`) VALUES (
|
||||
"' . mysql_real_escape_string($qd['name']) . '","' . mysql_real_escape_string(
|
||||
$qd['lvl'][0]
|
||||
) . '","' . mysql_real_escape_string($qd['lvl'][1]) . '",
|
||||
"' . mysql_real_escape_string($qd['tr_date']) . '","' . mysql_real_escape_string(
|
||||
$qd['act_date']
|
||||
) . '","' . mysql_real_escape_string($qd['win_date']) . '",
|
||||
"' . mysql_real_escape_string($qd['lose_date']) . '","' . mysql_real_escape_string(
|
||||
$qd['info']
|
||||
) . '","' . mysql_real_escape_string($qd['line']) . '",
|
||||
"' . mysql_real_escape_string($qd['align']) . '","' . mysql_real_escape_string(
|
||||
$qd['city']
|
||||
) . '","' . mysql_real_escape_string($qd['fast']) . '")'
|
||||
Db::sql(
|
||||
'insert into quests (name, min_lvl, max_lvl, tr_date, act_date, win_date, lose_date, info, line, align, fast) values (?,?,?,?,?,?,?,?,?,?,?)',
|
||||
[
|
||||
$qd['name'],
|
||||
$qd['lvl'][0],
|
||||
$qd['lvl'][1],
|
||||
$qd['tr_date'],
|
||||
$qd['act_date'],
|
||||
$qd['win_date'],
|
||||
$qd['lose_date'],
|
||||
$qd['info'],
|
||||
$qd['line'],
|
||||
$qd['align'],
|
||||
$qd['fast'],
|
||||
]
|
||||
);
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function nqst() {
|
||||
if (document.getElementById('addNewquest').style.display == '') {
|
||||
document.getElementById('addNewquest').style.display = 'none';
|
||||
} else {
|
||||
document.getElementById('addNewquest').style.display = '';
|
||||
}
|
||||
const x = document.getElementById('addNewquest');
|
||||
x.style.display = x.style.display === 'none' ? '' : 'none';
|
||||
}
|
||||
|
||||
var adds = [0, 0, 0, 0];
|
||||
const adds = [0, 0, 0, 0];
|
||||
|
||||
function addqact() {
|
||||
var dd = document.getElementById('qact');
|
||||
const dd = document.getElementById('qact');
|
||||
adds[0]++;
|
||||
dd.innerHTML = 'Атрибут: <select name="q_act_atr_' + adds[0] + '" id="q_act_atr_' + adds[0] + '">' +
|
||||
'<option value="0"></option>' +
|
||||
@ -374,7 +366,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
}
|
||||
|
||||
function addqtr() {
|
||||
var dd = document.getElementById('qtr');
|
||||
const dd = document.getElementById('qtr');
|
||||
adds[1]++;
|
||||
dd.innerHTML = 'Атрибут: <select name="q_tr_atr_' + adds[1] + '" id="q_tr_atr_' + adds[1] + '">' +
|
||||
'<option value="0"></option>' +
|
||||
@ -393,7 +385,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
}
|
||||
|
||||
function addqng() {
|
||||
var dd = document.getElementById('qng');
|
||||
const dd = document.getElementById('qng');
|
||||
adds[2]++;
|
||||
dd.innerHTML = 'Атрибут: <select name="q_ng_atr_' + adds[2] + '" id="q_ng_atr_' + adds[2] + '">' +
|
||||
'<option value="0"></option>' +
|
||||
@ -407,7 +399,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
}
|
||||
|
||||
function addqnk() {
|
||||
var dd = document.getElementById('qnk');
|
||||
const dd = document.getElementById('qnk');
|
||||
adds[3]++;
|
||||
dd.innerHTML = 'Атрибут: <select name="q_nk_atr_' + adds[3] + '" id="q_nk_atr_' + adds[3] + '">' +
|
||||
'<option value="0"></option>' +
|
||||
@ -427,133 +419,119 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" action="main.php?go=2&<?= $zv; ?>&remod=<?= $a; ?>">
|
||||
|
||||
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#E1E1E1">
|
||||
<!-- -->
|
||||
<tr>
|
||||
<td style="border-bottom:1px solid #CCCCCC;">
|
||||
<div align="left" style="margin-left:11px;">
|
||||
<div style="margin-left:11px;">
|
||||
<a href="javascript:void(0)" onclick="nqst()">Добавить новое задание</a>
|
||||
</div>
|
||||
<div align="left"></div>
|
||||
<div></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="addNewquest" style="display:none;">
|
||||
<td bgcolor="#DADADA" style="border-bottom:1px solid #CCCCCC;"><b>Панель добавления
|
||||
новых заданий:</b><br/>
|
||||
<td style="border-bottom:1px solid #CCCCCC; background-color: #dadada;">
|
||||
<b>Панель добавления новых заданий:</b><br>
|
||||
<form method="post" action="/main.php?go=2&<?= $zv; ?>">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td width="200" valign="top">Название задания</td>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Уровень задания</td>
|
||||
<td><input name="q_lvl" id="q_lvl" value="0-21" size="10"
|
||||
maxlength="5"/></td>
|
||||
<td valign="top"><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 valign="top" 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 valign="top" 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 valign="top" 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 valign="top" id="qnk"><a href="javascript:void(0)" onclick="addqnk()"><small>[+] добавить</small></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Описание задания</td>
|
||||
<td><textarea name="q_info" id="q_info" style="width:90%"
|
||||
rows="7"></textarea></td>
|
||||
<td valign="top"><label for="q_info">Описание задания</label></td>
|
||||
<td><textarea name="q_info" id="q_info" style="width:90%" rows="7"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" bgcolor="#CBCBCB"><input name="q_line1"
|
||||
type="checkbox"
|
||||
id="checkbox3"
|
||||
value="1"/>
|
||||
Линейное задание
|
||||
<tr style="background-color: #cbcbcb">
|
||||
<td align="center" valign="top">
|
||||
<label><input name="q_line1" type="checkbox" id="checkbox3" value="1"/>
|
||||
Линейное задание</label>
|
||||
</td>
|
||||
<td bgcolor="#CBCBCB"><input name="q_line2" id="q_line3" value=""
|
||||
size="5" maxlength="3"/>
|
||||
, id линейного сюжета
|
||||
<td bgcolor="#CBCBCB">
|
||||
<label><input name="q_line2" id="q_line3" value="" size="5" maxlength="3"/>
|
||||
, id линейного сюжета</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" bgcolor="#CBCBCB"><input name="q_fast"
|
||||
type="checkbox"
|
||||
id="q_fast"
|
||||
value="1"/>
|
||||
Быстрое задание
|
||||
<tr style="background-color: #cbcbcb">
|
||||
<td align="center" valign="top">
|
||||
<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>
|
||||
<td bgcolor="#CBCBCB"><input name="q_fast_city" id="q_fast_city"
|
||||
value="capitalcity" size="50"
|
||||
maxlength="50"/>
|
||||
, город которым ограничен квест <small>(стереть, если не
|
||||
ограничен)</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" bgcolor="#CBCBCB">
|
||||
<tr style="background-color: #cbcbcb">
|
||||
<td align="center" valign="top">
|
||||
<small>
|
||||
<input name="q_align1" type="checkbox" id="q_align1" value="1"/>
|
||||
Свет,
|
||||
|
||||
<input name="q_align2" type="checkbox" id="q_align2" value="1"/>
|
||||
Тьма,<br/>
|
||||
<input name="q_align3" type="checkbox" id="q_align3" value="1"/>
|
||||
Нейтрал,
|
||||
<input name="q_align4" type="checkbox" id="q_align4" value="1"/>
|
||||
Хаос
|
||||
<label>
|
||||
<input name="q_align1" type="checkbox" id="q_align1" value="1">Свет,
|
||||
</label>
|
||||
<label>
|
||||
<input name="q_align2" type="checkbox" id="q_align2" value="1"/>Тьма,
|
||||
</label><br>
|
||||
<label>
|
||||
<input name="q_align3" type="checkbox" id="q_align3" value="1"/>Нейтрал,
|
||||
</label>
|
||||
</small>
|
||||
</td>
|
||||
<td bgcolor="#CBCBCB"><input type="submit" value="Добавить задание"/>
|
||||
<td>
|
||||
<input type="submit" value="Добавить задание"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- -->
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#E1E1E1">
|
||||
<!-- -->
|
||||
<?php
|
||||
if (isset($_GET['delq'])) {
|
||||
mysql_query(
|
||||
'UPDATE `quests` SET `delete` = "' . time() . '" WHERE `id` = "' . mysql_real_escape_string($_GET['delq']) . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('delete from quests where id = ?', [$_GET['delq']]);
|
||||
}
|
||||
$sp = mysql_query('SELECT * FROM `quests` WHERE `delete` = 0');
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
?>
|
||||
$ql = Db::getRows('select id, name, info from quests');
|
||||
foreach ($ql as $quest): ?>
|
||||
<tr>
|
||||
<td style="border-bottom:1px solid #CCCCCC;" width="300">
|
||||
<div align="left" style="margin-left:11px;"><?= $pl['name'] ?></div>
|
||||
<div align="left"></div>
|
||||
<td style="border-bottom:1px solid #CCCCCC; width: 300px;">
|
||||
<div style="margin-left:11px;"><?= $quest['name'] ?></div>
|
||||
<div></div>
|
||||
</td>
|
||||
<td width="75" bgcolor="#DADADA" style="border-bottom:1px solid #CCCCCC;">
|
||||
<div align="center"><a
|
||||
href="main.php?go=2&delq=<?= $pl['id'] . '&' . $zv; ?>">удалить</a>
|
||||
<td style="border-bottom:1px solid #CCCCCC; background-color: #dadada; width: 75px;">
|
||||
<div style="text-align: center;">
|
||||
<a href="/main.php?go=2&delq=<?= $quest['id'] . '&' . $zv; ?>">удалить</a>
|
||||
</div>
|
||||
</td>
|
||||
<td style="border-bottom:1px solid #CCCCCC;">
|
||||
<small><b>Описание:</b> <?= $pl['info'] ?></small></td>
|
||||
<small><b>Описание:</b> <?= $quest['info'] ?></small>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
<!-- -->
|
||||
</table>
|
||||
</td>
|
||||
@ -603,71 +581,22 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
<div class="mt" id="modtitle"></div>
|
||||
<div class="md" id="moddata"></div>
|
||||
</div>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<?php if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) { ?>
|
||||
<h3>Панель <?php if ($a == 1) {
|
||||
echo 'Паладина';
|
||||
} elseif ($a == 3) {
|
||||
echo 'Тармана';
|
||||
} else {
|
||||
echo 'Ангела';
|
||||
} ?></h3>
|
||||
<?php } else { ?><h3>Панель <?php if ($u->info['align'] == 1) {
|
||||
echo 'Света';
|
||||
} elseif ($u->info['align'] == 3) {
|
||||
echo 'Тьмы';
|
||||
} ?></h3><?php } ?>
|
||||
</td>
|
||||
<td width="150" align="right"><input type="button" class="btn btn-danger" value="Вернуться"
|
||||
onclick="location='main.php';"/>
|
||||
<?php if ($u->info['admin'] > 0) { ?>
|
||||
<input type="button" class="btn btn-success" value="<?php if ($a == 1) {
|
||||
echo 'Панель тармана';
|
||||
} else {
|
||||
echo 'Панель паладина';
|
||||
} ?>" onclick="location='main.php?<?= $zv; ?>&remod=<?= $a; ?>';"/>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div align="left"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form action="main.php?<?= $zv . '&rnd=' . $code; ?>" method="post" name="F1" id="F1">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="center"></td>
|
||||
<td align="right"></td>
|
||||
<td valign="top" align="right"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="display: grid; grid-template-columns: auto 150px;">
|
||||
<div style="text-align: center;">
|
||||
<?php if ($m->isModerator): ?>
|
||||
<h3>Модераторская</h3>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<input type="button" class="btn btn-danger" value="Вернуться" onclick="location='main.php';">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form action="/main.php?<?= $zv . '&rnd=' . PassGen::intCode() ?>" method="post" name="F1" id="F1">
|
||||
<?php
|
||||
$uer = '';
|
||||
//используем заклятия
|
||||
if (isset($_GET['usemod'])) {
|
||||
$srok = [5 => '5 минут',
|
||||
15 => '15 минут',
|
||||
30 => '30 минут',
|
||||
60 => 'один час',
|
||||
180 => 'три часа',
|
||||
360 => 'шесть часов',
|
||||
720 => 'двенадцать часов',
|
||||
1440 => 'одни сутки',
|
||||
4320 => 'трое суток'];
|
||||
$srokt = [1 => '1 день',
|
||||
3 => '3 дня',
|
||||
7 => 'неделю',
|
||||
14 => '2 недели',
|
||||
30 => 'месяц',
|
||||
60 => '2 месяца',
|
||||
365 => 'год',
|
||||
24 => 'бессрочно',
|
||||
6 => 'часик'];
|
||||
|
||||
|
||||
if (isset($_POST['usevampir'])) {
|
||||
require_once('moder/usevampir.php');
|
||||
@ -686,32 +615,7 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST['use_itm_']) && $u->info['admin'] > 0 && $u->info['id'] != 2332207) {
|
||||
$usr = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
|
||||
$_POST['log_itm_']
|
||||
) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
$giv_itm = mysql_fetch_array(
|
||||
mysql_query("SELECT * FROM `items_main` WHERE `id` = '$_POST[itm_id]'")
|
||||
);
|
||||
if ($giv_itm['id'] <= 0) {
|
||||
$uer = "Нету такой вещи";
|
||||
}
|
||||
if (!$usr['id']) {
|
||||
$uer = "Персонаж $_POST[log_itm] не найден.";
|
||||
}
|
||||
if ($giv_itm['id'] > 0 && $usr['id'] > 0) {
|
||||
ItemsModel::addItem($giv_itm['id'], $usr['id']);
|
||||
$uer = "Персонажу $_POST[log_itm] выдана вещь $giv_itm[name].";
|
||||
$rtxt = $rang . ' "' . $u->info['login'] . '" Выдал' . $sx . ' персонажу "' . $user_teleport['login'] . '" вещь "<b>' . $giv_itm['name'] . '</b>".';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '<font color="red">' . $uer . '</font>';
|
||||
echo '<span style="color: red; ">' . $uer . '</span>';
|
||||
//Темная склонка, кусается сука!)
|
||||
?>
|
||||
<br/>
|
||||
@ -779,48 +683,14 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if ($u->info['admin'] > 0) {
|
||||
if (isset($_POST['add_item_to_user2'])) {
|
||||
$uad = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT `id`,`login` FROM `users` WHERE `login` = "' . mysql_real_escape_string(
|
||||
$_POST['add_item_to_login']
|
||||
) . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
if (isset($uad['id'])) {
|
||||
ItemsModel::addItem(round((int)$_POST['add_item_to_user']), $uad['id']);
|
||||
mysql_query(
|
||||
'INSERT INTO `users_delo` (`onlyAdmin`,`hb`,`uid`,`time`,`city`,`text`,`login`,`ip`) VALUES ("1","0","' . $uad['id'] . '","' . time() . '","' . $uad['city'] . '","' . $rang . ' "' . $u->info['login'] . '" <font color=red>выдал предмет</font>: №' . round(
|
||||
(int)$_POST['add_item_to_user']
|
||||
) . ' персонажу <b>' . $uad['login'] . '</b>.","' . $u->info['login'] . '","' . $u->info['ip'] . '")'
|
||||
);
|
||||
echo '<b style="color: red">Предмет был доставлен к персонажу</b>';
|
||||
} else {
|
||||
echo '<b style="color: red">Персонаж не найден</b>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
|
||||
Выдать предмет <input name="add_item_to_user" value=""/> персонажу <input
|
||||
name="add_item_to_login" value="<?php if (isset($_POST['add_item_to_login'])) {
|
||||
echo $_POST['add_item_to_login'];
|
||||
} ?>"/>
|
||||
<input type="submit" name="add_item_to_user2" id="add_item_to_user2" class="btn"
|
||||
value="Выдать"/>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if ($isAdmin) {
|
||||
if ($m->isAdmin) {
|
||||
/** Мегафон только для администраторов. */
|
||||
Announcement::init();
|
||||
|
||||
/** Регистрации персонажей только для администраторов. */
|
||||
UserRegistrationList::get();
|
||||
|
||||
/** Kог действий модераторов только для администраторов. */
|
||||
/** Лог действий модераторов только для администраторов. */
|
||||
$dsee = [];
|
||||
if (!isset($_POST['smod1'])) {
|
||||
$_POST['smod1'] = date('d.m.Y');
|
||||
@ -833,34 +703,31 @@ if ($go == 3 && $u->info['admin'] > 0) {
|
||||
?>
|
||||
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
|
||||
<h4>Показать лог действий модераторов</h4>
|
||||
Показать действия за <input name="smod1" type="text" id="smod1" value="<?= $_POST['smod1'] ?>" size="11" maxlength="10">
|
||||
Логин модератора <input name="smod2" type="text" id="smod2" value="<?= $_POST['smod2'] ?>" size="30" maxlength="30">
|
||||
<label>
|
||||
Показать действия за
|
||||
<input name="smod1" type="text" id="smod1" value="<?= $_POST['smod1'] ?>" size="11" maxlength="10">
|
||||
</label>
|
||||
<label>
|
||||
Логин модератора
|
||||
<input name="smod2" type="text" id="smod2" value="<?= $_POST['smod2'] ?>" size="30" maxlength="30">
|
||||
</label>
|
||||
<input type="submit" name="delosee3" id="delosee3" class="btn" value="Поиск"/>
|
||||
</div>
|
||||
<?php
|
||||
if (isset($_POST['delosee3'])) {
|
||||
$sp = mysql_query(
|
||||
'SELECT * FROM `users_delo` WHERE `login` = "' . mysql_real_escape_string(
|
||||
$_POST['smod2']
|
||||
) . '" AND `time` >= ' . $dsee['t1'] . ' AND `time` <= ' . $dsee['t2'] . ''
|
||||
);
|
||||
$rdl = '';
|
||||
while ($pl = mysql_fetch_array($sp)) {
|
||||
$rdl .= '<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">';
|
||||
$rdl .= '<div style="display:inline-block;width:150px;color:green">' . date(
|
||||
'd.m.Y H:i:s', $pl['time']
|
||||
) . '</div>';
|
||||
$rdl .= $pl['text'] . ' персонажу ' . User::getLogin($pl['uid']);
|
||||
$rdl .= '</div>';
|
||||
foreach (Db::getRows('select uid, time, text from users_delo where login = ? and time between ? and ?', [$_POST['smod2'], $dsee['t1'], $dsee['t2']]) as $log) {
|
||||
$date = date('d.m.Y H:i:s', $log['time']);
|
||||
$login = User::getLogin($log['uid']);
|
||||
echo <<<HTML
|
||||
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
|
||||
<div style="display:inline-block;width:150px;color:green">$date</div>
|
||||
{$log['text']} персонажу $login
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
if ($rdl == '') {
|
||||
$rdl = 'Модератор не совершал действий за данное число';
|
||||
}
|
||||
echo $rdl;
|
||||
}
|
||||
} ?>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user