Рефакторинг, очистка, работа над ошибками, связанными с базой, отказ от глобальной переменной $user во многих файлах.

Singleton в некоторых местах вместо решения #42.
Новые шаги для решения #16 и #52.
Closes #42.
Closes #32.
Closes #31.
This commit is contained in:
Igor Barkov (iwork)
2022-01-27 01:15:33 +02:00
parent b1ba212c8c
commit 3502904656
82 changed files with 1575 additions and 2015 deletions
+4 -4
View File
@@ -1,15 +1,15 @@
<?php
use Battles\Database\DBPDO;
use Battles\Database\Db;
use Battles\Template;
use Battles\User;
require_once "config.php";
if (!empty($_GET['id']) && User::$current->getAdmin()) {
if (!empty($_GET['id']) && User::getInstance()->getAdmin()) {
echo "Пробуем перейти на выбранную замковую улицу...";
$_SESSION["klan"] = $_GET['klan'];
$a = $_GET['klan'];
DBPDO::$db->execute('update users, online set users.room = 651, online.room = 651 where user_id = id and user_id = ?', User::$current->getId());
Db::getInstance()->execute('update users, online set users.room = 651, online.room = 651 where user_id = id and user_id = ?', User::getInstance()->getId());
header("location: city.php");
exit;
}
@@ -19,7 +19,7 @@ Template::header('Клановый перекрёсток');
<h1>Переход к клановым улицам</h1>
На данный момент свои замки имеют такие кланы:
<?php
$rows = DBPDO::$db->fetchAll('select short_name, full_name, owner_id from clans where zamok = 2');
$rows = Db::getInstance()->fetchAll('select short_name, full_name, owner_id from clans where zamok = 2');
foreach ($rows as $row) {
$frm = "<img src='i/clan/%s.png'> %s<br><form><input name='klan' type='hidden' value='%s'><input type='submit' value='Вход'></form>";
echo sprintf($frm, $row['short_name'], $row['full_name'], $row['owner_id']);