Fix app instance + $logged and $account_logged globals+ $menus

This commit is contained in:
slawkens 2025-03-16 09:23:30 +01:00
parent 613b710d29
commit b047f73fe6
3 changed files with 8 additions and 10 deletions

View File

@ -27,5 +27,4 @@
require_once 'common.php';
require_once SYSTEM . 'functions.php';
$app = new \MyAAC\App\App();
$app->run();
app()->run();

View File

@ -35,6 +35,11 @@ class App
$loginService = new LoginService();
$checkLogin = $loginService->checkLogin();
$this->accountLogged = $checkLogin['account'];
$this->isLoggedIn = $checkLogin['logged'];
global $logged, $account_logged;
$logged = $this->isLoggedIn;
$account_logged = $this->accountLogged;
$statusService = new StatusService();
$status = $statusService->checkStatus();
@ -76,12 +81,9 @@ class App
]);
}
global $template_path, $template_index;
global $template_path, $template_index, $menus;
$title_full = (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName'];
global $logged, $account_logged;
$logged = $checkLogin['logged'];
$account_logged = $checkLogin['account'];
$menus = get_template_menus();
require $template_path . '/' . $template_index;

View File

@ -92,11 +92,8 @@ class RouterService
$ignore = false;
/** @var boolean $logged */
/** @var \OTS_Account $account_logged */
global $logged_access;
$logged_access = 0;
$account_logged = app()->getAccountLogged();
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}