315 lines
14 KiB
PHP
315 lines
14 KiB
PHP
<?php
|
||
/**
|
||
* Copyright (c) 2018.
|
||
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
||
* Project name: Battles-Game
|
||
*/
|
||
session_start();
|
||
require_once '../functions.php';
|
||
|
||
use Battles\Bank;
|
||
use Battles\Database\DBPDO;
|
||
use Battles\Moderation;
|
||
use Battles\Nick;
|
||
use Battles\Template;
|
||
use Battles\User;
|
||
|
||
$user = $user ?? new User($_SESSION['uid']);
|
||
if (!$user->getAdmin()) {
|
||
header("HTTP/1.0 404 Not Found");
|
||
exit;
|
||
}
|
||
|
||
if (isset($_GET['sleep'])) {
|
||
Moderation::muteChat($user->getId(), strtotime('15min'));
|
||
}
|
||
|
||
if (isset($_POST['ldnick']) && isset($_POST['ldtext'])) {
|
||
Moderation::addToUserLog($_POST['ldnick'], $_POST['ldtext'], $user->getId());
|
||
}
|
||
|
||
if (isset($_POST['syschatmsg'])) {
|
||
Moderation::addChatSysMsg($_POST['syschatmsg']);
|
||
}
|
||
|
||
//clans to reg
|
||
$unregisteredClans = new class {
|
||
public $db;
|
||
|
||
public function getList()
|
||
{
|
||
$row = $this->db->ofetchAll('SELECT * FROM clans WHERE status = 0');
|
||
$i = 0;
|
||
while ($i < count($row)) {
|
||
$id = $row[$i]->owner_id;
|
||
$login = Nick::id($row[$i]->owner_id)->short(1);
|
||
$fullName = $row[$i]->full_name;
|
||
$shortName = $row[$i]->short_name;
|
||
$info = nl2br($row[$i]->info);
|
||
$i++;
|
||
echo <<<UNREGCLAN
|
||
<div>
|
||
<fieldset style="display: inline;">
|
||
<legend>$fullName [$shortName]</legend>
|
||
Глава клана: <span class="abils">$login</span><br>
|
||
Описание:<div class="abils">$info</div>
|
||
<BR>
|
||
<button onclick="location.href='?regclan=$id'">Зарегистрировать</button>
|
||
<button onclick="location.href='?remclan=$id'">Отказать</button>
|
||
</fieldset>
|
||
</div>
|
||
UNREGCLAN;
|
||
}
|
||
unset($i);
|
||
}
|
||
|
||
public function allowRegister($id)
|
||
{
|
||
$this->db->execute('UPDATE clans SET status = 1 WHERE status = 0 AND owner_id = ?', $id);
|
||
}
|
||
|
||
public function disallowRegister($id)
|
||
{
|
||
$bank = new Bank($id);
|
||
$this->db->execute('DELETE FROM clans WHERE status = 0 AND owner_id = ?', $id);
|
||
$bank::setBankMoney($bank->getMoney() + Config::$clan_register_cost, $id);
|
||
}
|
||
};
|
||
$unregisteredClans->db = new DBPDO();
|
||
$unregisteredClans->getList();
|
||
|
||
if (isset($_GET['regclan'])) {
|
||
$unregisteredClans->allowRegister($_GET['regclan']);
|
||
header('Location:/admin/admin.php');
|
||
exit;
|
||
}
|
||
if (isset($_GET['remclan'])) {
|
||
$unregisteredClans->disallowRegister($_GET['remclan']);
|
||
header('Location:/admin/admin.php');
|
||
exit;
|
||
}
|
||
|
||
# Телеграф.
|
||
if (!empty($_POST['receiver']) && !empty($_POST['tgmsg'])) {
|
||
$receiver = DBPDO::INIT()->ofetch('SELECT id FROM users WHERE login= ?', $_POST['receiver']);
|
||
telegraph($receiver->id, $_POST['tgmsg']);
|
||
echo "Успешно.";
|
||
}
|
||
# Показывает невидимок.
|
||
echo '<legend>Невидимки:</legend>';
|
||
$row = DBPDO::INIT()->ofetchAll('SELECT id,login FROM users LEFT JOIN users_effects ue on users.id = ue.owner_id WHERE type = 1022 ORDER BY `id` DESC');
|
||
$i = 0;
|
||
while ($i < count($row)) {
|
||
echo '<b>[id] = ' . $row[$i]->id . ', ' . $row[$i]->login . ' </b><br>';
|
||
$i++;
|
||
}
|
||
unset($i);
|
||
|
||
|
||
Template::header('ᐰdminка');
|
||
?>
|
||
<link rel=stylesheet href="/css/admin.css">
|
||
<button onclick="location.href='?sleep'"><img src="../i/magic/sleep.gif" alt="sleep"> Молчать 15 мин</button>
|
||
<button disabled><img src="../i/magic/sleep.gif" alt="sleep"> Молчать 1 час</button>
|
||
<button disabled><img src="../i/magic/sleep.gif" alt="sleep"> Молчать 1 день</button>
|
||
<button disabled><img src="../i/magic/sleep.gif" alt="sleep"> Молчать очень долго</button>
|
||
<button disabled><img src="../i/magic/sleep_off.gif" alt="sleep_off"> Снять молчанку</button>
|
||
<br>
|
||
<button disabled><img src="../i/magic/sleepf.gif" alt="sleepf"> Молчать на фомуме 1 час</button>
|
||
<button disabled><img src="../i/magic/sleepf.gif" alt="sleepf"> Молчать на фомуме 1 день</button>
|
||
<button disabled><img src="../i/magic/sleepf.gif" alt="sleepf"> Молчать на фомуме очень долго</button>
|
||
<button disabled><img src="../i/magic/sleepf_off.gif" alt="sleepf_off"> Снять молчанку на фомуме</button>
|
||
<br>
|
||
<button disabled><img src="../i/magic/obezl.gif" alt="obezl"> Сокрыть инфу</button>
|
||
<button disabled><img src="../i/magic/obezl_off.gif" alt="obezl_off"> Снять сокрытие</button>
|
||
<button disabled><img src="../i/magic/death.gif" alt="death"> Заблокировать</button>
|
||
<button disabled><img src="../i/magic/death_off.gif" alt="death_off"> Разблокировать</button>
|
||
<br>
|
||
<button disabled>Снять все травмы</button>
|
||
<button disabled>Свадьба</button>
|
||
<button disabled>Развод</button>
|
||
<button disabled>Выйти из боя</button>
|
||
<?php
|
||
####################################################
|
||
## НЕ ТРОГАТЬ! ТУТ ОТКРЫВАЮТСЯ ВСПЛЫВАЮЩИЕ ОКНА!!!##
|
||
####################################################
|
||
echo "<div class=appblock id=hint3 onclick='closehint3();'></div>";
|
||
####################################################
|
||
|
||
$moj = ['sleep', 'sleepf'];
|
||
|
||
|
||
switch ($_POST['use']) { /* Подключаем строго тот свиток который используем. 36 Свитков править. Мама дорогая! */
|
||
|
||
case "check":
|
||
include("../magic/check.php");
|
||
break;
|
||
case "brat":
|
||
include("../magic/brat.php");
|
||
break;
|
||
case "vampir":
|
||
include("../magic/vampir.php");
|
||
break;
|
||
case "crush":
|
||
include("../magic/devastate.php");
|
||
break;
|
||
case "def":
|
||
include("../magic/defence.php");
|
||
break;
|
||
case "bexit":
|
||
include("../magic/bexit.php");
|
||
break;
|
||
case "vip":
|
||
include("../magic/vips.php");
|
||
break;
|
||
|
||
echo "<div class=abils><span class='legend'>Абилки:</span>Пока что привязаны к общей системе. Работают выборочно.<br>";
|
||
$script_name = $magic_name = '';
|
||
foreach ($moj as $k => $v) {
|
||
switch ($k) { /* 45 скриптов на 36 умелок? Неплохо… */
|
||
case "vip":
|
||
$script_name = "vipad";
|
||
$magic_name = "Вип";
|
||
break;
|
||
case "hidden":
|
||
$script_name = "runmagic1";
|
||
$magic_name = "Заклятие невидимости";
|
||
break;
|
||
case "teleport":
|
||
$script_name = "runmagic";
|
||
$magic_name = "Телепортация";
|
||
break;
|
||
case "check":
|
||
$script_name = "runmagic1";
|
||
$magic_name = "Поставить проверку";
|
||
break;
|
||
case "pal_buttons":
|
||
$script_name = "runmagic";
|
||
$magic_name = "Отметить о прохождении проверки";
|
||
break;
|
||
case "rep":
|
||
$script_name = "runmagic";
|
||
$magic_name = "Отчет о переводах";
|
||
break;
|
||
case "rost":
|
||
$script_name = "runmagic";
|
||
$magic_name = "Присвоить статус";
|
||
break;
|
||
case "bexit":
|
||
$script_name = "runmagic1";
|
||
$magic_name = "Выйти из боя";
|
||
break;
|
||
}
|
||
# Эта строка генерирует свитки с навыком. Но нам нужен просто перечень всего…
|
||
if ($script_name) {
|
||
print "<a onclick=\"$script_name('$magic_name','$k','target','target1') \" href='#'><img src='i/magic/" . $k . ".gif' title='" . $magic_name . "'></a> ";
|
||
}
|
||
}
|
||
}
|
||
echo "</div>";
|
||
?>
|
||
|
||
<form method='post'>
|
||
<legend>Добавить в «дело» игрока заметку о нарушении правил, прокрутке и пр.</legend>
|
||
<input name='ldnick' placeholder='Логин'> <input name='ldtext' size='50' placeholder='Сообщение'>
|
||
<input type='submit' value='Добавить'><br>
|
||
</form>
|
||
<form method='post'>
|
||
<legend>Отправить системное сообщение в чат</legend>
|
||
<input name='syschatmsg' size='74' placeholder='Введите сообщение'>
|
||
<input type='submit' value='Отправить'>
|
||
</form>
|
||
<form method='post'>
|
||
<legend>Телеграф</legend>
|
||
<input name='receiver' placeholder='Логин'>
|
||
<input name='tgmsg' size='50' placeholder='Сообщение'>
|
||
<input type='submit' value='Отправить'>
|
||
</form>
|
||
<form method='post'>
|
||
<legend>Поменять статус</legend>
|
||
<input name='login' placeholder='Логин'>
|
||
<input name='status' placeholder='Статус'>
|
||
<input type='submit' value='Изменить статус'>
|
||
</form>
|
||
|
||
<script>
|
||
const xmlHttpp = [];
|
||
|
||
function GetXmlHttpObject1() {
|
||
let xmlHttp1 = null;
|
||
try {
|
||
xmlHttp1 = new XMLHttpRequest();
|
||
} catch (e) {
|
||
try {
|
||
xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
|
||
} catch (e) {
|
||
xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
|
||
}
|
||
}
|
||
return xmlHttp1;
|
||
}
|
||
|
||
function show(ele) {
|
||
const srcElement = document.getElementById(ele);
|
||
if (srcElement != null) {
|
||
if (srcElement.style.display == "block") {
|
||
srcElement.style.display = 'none';
|
||
} else {
|
||
srcElement.style.display = 'block';
|
||
}
|
||
}
|
||
}
|
||
|
||
let Hint3Name = '';
|
||
let Hint3Closed = false;
|
||
|
||
function vipad(title, magic, name) {
|
||
document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</b></BIG></td></tr><tr><td colspan=2>' +
|
||
'<form action="admin.php" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><td colspan=2><INPUT TYPE=hidden name=sd4 value="<?php echo @$user['id']; ?>"><INPUT TYPE=hidden NAME="use" value="' + magic + '">' +
|
||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD align=left><INPUT NAME="' + name + '">' +
|
||
'<br /><select style="background-color:#eceddf; color:#000000;" name="vip_type"><option value=1>Silver</option><option value=2>Gold</option><option value=3>Platinum</option></select>' +
|
||
'<select style="background-color:#eceddf; color:#000000;" name="time"><option value="1">1 Месяц</option><option value="2">2 Месяца</option><option value="3">3 Месяца</option><option value="4">4 Месяца</option><option value="5">5 Месяцев</option><option value="6">6 Месяцев</option><option value="99999999">Бесконечно</option></select>' +
|
||
'</TD><TD width=30><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
|
||
document.all("hint3").style.visibility = "visible";
|
||
document.all("hint3").style.left = 100;
|
||
document.all("hint3").style.top = 100;
|
||
document.all(name).focus();
|
||
Hint3Name = name;
|
||
Hint3Closed = false;
|
||
}
|
||
|
||
function runmagic(title, magic, name) {
|
||
document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '<td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</b></BIG><tr><td colspan=2>' +
|
||
'<form action="admin.php" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><td colspan=2><INPUT TYPE=hidden name=sd4 value="<?php echo @$user['id']; ?>"><INPUT TYPE=hidden NAME="use" value="' + magic + '">' +
|
||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)<TR><TD align=left><INPUT NAME="' + name + '">' +
|
||
'<select style="background-color:#eceddf; color:#000000;" name="timer"><option value=15>15 мин</option><option value=30>30 мин</option>' +
|
||
'<option value=60>1 час</option><option value=180>3 часа</option><option value=360>6 часов</option><option value=720>12 часов</option><option value=1440>сутки</option> </select>' +
|
||
'<TD width=30><INPUT TYPE="submit" value=" »» "></TABLE></FORM></table>';
|
||
document.all("hint3").style.visibility = "visible";
|
||
document.all("hint3").style.left = 100;
|
||
document.all("hint3").style.top = 100;
|
||
document.all(name).focus();
|
||
Hint3Name = name;
|
||
Hint3Closed = false;
|
||
}
|
||
|
||
function runmagic1(title, magic, name) {
|
||
document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</b></BIG></td></tr><tr><td colspan=2>' +
|
||
'<form action="admin.php" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><td colspan=2><INPUT TYPE=hidden name=sd4 value="<?php echo @$user['id']; ?>"> <INPUT TYPE=hidden NAME="use" value="' + magic + '">' +
|
||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD align=left><INPUT NAME="' + name + '">' +
|
||
'</TD><TD width=30><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
|
||
document.all("hint3").style.visibility = "visible";
|
||
document.all("hint3").style.left = 100;
|
||
document.all("hint3").style.top = 100;
|
||
document.all(name).focus();
|
||
Hint3Name = name;
|
||
Hint3Closed = false;
|
||
}
|
||
|
||
function closehint3() {
|
||
document.all("hint3").style.visibility = "hidden";
|
||
Hint3Name = '';
|
||
Hint3Closed = false;
|
||
}
|
||
|
||
</script>
|