Рефакторинг, очистка, работа над ошибками, связанными с базой, отказ от глобальной переменной $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
+3 -3
View File
@@ -1,6 +1,6 @@
<?php
use Battles\Database\DBPDO;
use Battles\Database\Db;
use Battles\InventoryItem;
use Battles\Template;
use Battles\User;
@@ -17,8 +17,8 @@ $vips = [1 => 0.15, 2 => 0.30, 3 => 0.45];
function get_meshok(): object
{
$allweight = DBPDO::$db->ofetch('select sum(weight) as items_weight_sum from inventory where on_sale = 0 and owner_id = ?', User::$current->getId());
$stat = new UserInfo(User::$current->getId());
$allweight = Db::getInstance()->ofetch('select sum(weight) as items_weight_sum from inventory where on_sale = 0 and owner_id = ?', User::getInstance()->getId());
$stat = new UserInfo(User::getInstance()->getId());
return (object)[
'currentweight' => $allweight->items_weight_sum,
'maxweight' => $stat->getMaxWeight() + $allweight->items_weight_sum,