Зимние правки. MVC/

Signed-off-by: lopar <lopar.4ever@gmail.com>
This commit is contained in:
lopar
2022-08-09 22:57:43 +03:00
parent 0f62ee20e7
commit b9b4c01cf0
104 changed files with 2254 additions and 2086 deletions
+39 -53
View File
@@ -17,12 +17,13 @@ if (!empty($_GET['teleport']) && User::getInstance()->getAdmin() == 1) {
# ORDEN PHP
$_POST['use'] ??= null;
if (User::getInstance()->getAdmin()) {
$abil = Db::getInstance()->execute('SELECT 1 FROM users WHERE id = ?i', User::getInstance()->getId())->fetchColumn();
$abil = Db::getInstance()->execute('SELECT 1 FROM users WHERE id = ?', User::getInstance()->getId())->fetchColumn();
//$abil = unserialize($abil['abil']);
switch ($_POST['use']) {
case "healing":
include("./magic/Healing.php");
include_once("./magic/Healing.php");
break;
case "ct1":
if ($abil[0] > 0 && User::getInstance()->getAlign() == 6) {
@@ -30,7 +31,7 @@ if (User::getInstance()->getAdmin()) {
//include("./magic/ct1.php");
if ($outok == 1) {
$abil[0] -= 1;
db::c()->query('UPDATE users SET abil = "?s" WHERE id = ?i', serialize($abil), User::getInstance()->getId());
Db::getInstance()->execute('update users set abil = ? where id = ?', [serialize($abil), User::getInstance()->getId()]);
}
} elseif (User::getInstance()->getAlign() != 6) {
//Заменён на CureInjury.php class. Придумать вызов.
@@ -43,7 +44,7 @@ if (User::getInstance()->getAdmin()) {
//include("./magic/ct2.php");
if ($outok == 1) {
$abil[1] -= 1;
db::c()->query('UPDATE users SET abil = "?s" WHERE id = ?i', serialize($abil), User::getInstance()->getId());
Db::getInstance()->execute('update users set abil = ? where id = ?', [serialize($abil), User::getInstance()->getId()]);
}
} elseif (User::getInstance()->getAlign() != 6) {
//Заменён на CureInjury.php class. Придумать вызов.
@@ -56,7 +57,7 @@ if (User::getInstance()->getAdmin()) {
//include("./magic/ct3.php");
if ($outok == 1) {
$abil[2] -= 1;
db::c()->query('UPDATE users SET abil = "?s" WHERE id = ?i', serialize($abil), User::getInstance()->getId());
Db::getInstance()->execute('update users set abil = ? where id = ?', [serialize($abil), User::getInstance()->getId()]);
}
} elseif (User::getInstance()->getAlign() != 6) {
//Заменён на CureInjury.php class. Придумать вызов.
@@ -68,30 +69,30 @@ if (User::getInstance()->getAdmin()) {
//include("./magic/ct_all.php");
break;
case "attack":
include("./magic/eattack.php");
include_once("./magic/eattack.php");
break;
case "attack_t":
include("./magic/attack_t.php");
include_once("./magic/attack_t.php");
if ($skipper == 1) {
header("Location:fbattle.php");
exit();
}
break;
case "battack":
include("./magic/ebattack.php");
include_once("./magic/ebattack.php");
break;
case "attackk_close":
if ($abil[1] > 0 && User::getInstance()->getAlign() == 2) {
include("./magic/attackk_close.php");
include_once("./magic/attackk_close.php");
if ($outok == 1) {
$abil[1] -= 1;
db::c()->query('UPDATE users SET abil = "?s" WHERE id = ?i', serialize($abil), User::getInstance()->getId());
Db::getInstance()->execute('update users set abil = ? where id = ?', [serialize($abil), User::getInstance()->getId()]);
header("Location:fbattle.php");
exit();
}
} else {
include("./magic/attackk_close.php");
include_once("./magic/attackk_close.php");
header("Location:fbattle.php");
exit();
}
@@ -99,22 +100,22 @@ if (User::getInstance()->getAdmin()) {
case "attackk_open":
if ($abil[1] > 0 && User::getInstance()->getAlign() == 2) {
include("./magic/attackk_open.php");
include_once("./magic/attackk_open.php");
if ($outok == 1) {
$abil[2] -= 1;
db::c()->query('UPDATE users SET abil = "?s" WHERE id = ?i', serialize($abil), User::getInstance()->getId());
Db::getInstance()->execute('update users set abil = ? where id = ?', [serialize($abil), User::getInstance()->getId()]);
header("Location:fbattle.php");
exit();
}
} else {
include("./magic/attackk_open.php");
include_once("./magic/attackk_open.php");
header("Location:fbattle.php");
exit();
}
break;
case "brat":
include("./magic/brat.php");
include_once("./magic/brat.php");
if ($skipper == 1) {
header("Location:fbattle.php");
exit();
@@ -122,24 +123,23 @@ if (User::getInstance()->getAdmin()) {
break;
case "vampir":
include("./magic/vampir.php");
include_once("./magic/vampir.php");
break;
case "crush":
include("./magic/devastate.php");
include_once("./magic/devastate.php");
break;
case "def":
include("./magic/defence.php");
include_once("./magic/defence.php");
break;
case "bexit":
include("./magic/bexit.php");
include_once("./magic/bexit.php");
break;
}
}
function show_byu($type)
function show_byu($type): string
{
global $user;
$type = $type + 20;
$typeName = [
21 => '15 минут тишины',
@@ -176,23 +176,19 @@ function show_byu($type)
35 => 'antimirror',
];
if (User::getInstance()->getClan()) {
$clan = db::c()->query('SELECT owner_id FROM clans WHERE short_name = "?s"', User::getInstance()->getClan())->fetch_assoc();
if ($clan['owner_id'] == User::getInstance()->getId()) {
$r = '<div style="text-align: center;"><a href="javascript:void(0);" class="byu_klan" id="' . $type . '">купить 1 шт.</a></div>';
$clan_owner = Db::getInstance()->fetchColumn('select owner_id from clans where short_name = ?', User::getInstance()->getClan());
if ($clan_owner === User::getInstance()->getId()) {
$r = '<span><a href="javascript:void(0);" class="byu_klan" id="' . $type . '">купить 1 шт.</a></span>';
} else {
$r = '<div style="text-align: center;"><a href="javascript:void(0);">Вы не глава</a></div>';
$r = '<span><a href="javascript:void(0);">Вы не глава</a></span>';
}
} else {
$r = '<div style="text-align: center;"><a href="javascript:void(0);">Вы не состоите в клане</a></div>';
$r = '<span><a href="javascript:void(0);">Вы не состоите в клане</a></span>';
}
return <<<FFFF
<div class="items">
<div class="title">$typeName[$type]</div>
<div class="img"><img class="slot valign halign" src="/i/sh/$typeImage[$type].gif" alt="$typeName[$type]"></div>
<div class="control">
$r
</div>
</div>
<div class="items" style="padding: 2px;">
<img style="vertical-align: middle;" class="slot valign halign" src="/i/sh/$typeImage[$type].gif" alt="$typeName[$type]"> <span>$typeName[$type]</span> [$r]
</div>
FFFF;
}
@@ -231,8 +227,8 @@ A;
<?php
if (User::getInstance()->getAlign() == 2 || User::getInstance()->getAdmin()) // Нейтралы
{
$abil = db::c()->query('SELECT 1 FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
$abil = [null, null, null];
//$abil = db::c()->query('SELECT 1 FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
//$abil = unserialize($abil['abil']);
for ($i = 0; $i < 3; $i++) {
if (!$abil[$i]) {
@@ -247,8 +243,8 @@ A;
if (User::getInstance()->getAlign() == 6 || User::getInstance()->getAdmin()) // Свет
{
$abil = db::c()->query('SELECT 1 FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
$abil = [null, null, null];
//$abil = db::c()->query('SELECT 1 FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
//$abil = unserialize($abil['abil']);
for ($i = 0; $i < 3; $i++) {
if (!$abil[$i]) {
@@ -283,7 +279,7 @@ A;
<div style="padding-top: 13px; padding-bottom: 13px;">
<fieldset style="width: 400px;">
<legend>Счёт</legend>
На счету <b><?= $bank['ekr'] ?></b> еврокредитов.
На счету <b><?= User::getInstance()->money()->getBank() ?></b>
</fieldset>
</div>
</div>
@@ -418,21 +414,11 @@ A;
</div>
<div id="inlines">
<?= show_byu(1); ?>
<?= show_byu(2); ?>
<?= show_byu(3); ?>
<?= show_byu(4); ?>
<?= show_byu(5); ?>
<?= show_byu(6); ?>
<?= show_byu(7); ?>
<?= show_byu(8); ?>
<?= show_byu(9); ?>
<?= show_byu(10); ?>
<?= show_byu(11); ?>
<?= show_byu(12); ?>
<?= show_byu(13); ?>
<?= show_byu(14); ?>
<?= show_byu(15); ?>
<?php
foreach (range(1, 15) as $item) {
echo show_byu($item);
}
?>
</div>
<script>