From 29b7949fb3540e282f5ff36bdb914ea96fcda3be Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:20:39 +0300 Subject: [PATCH] Small fixes --- cp/bootstrap/app.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cp/bootstrap/app.php b/cp/bootstrap/app.php index be8c74f..4d0d1dc 100644 --- a/cp/bootstrap/app.php +++ b/cp/bootstrap/app.php @@ -119,15 +119,19 @@ $container->set('view', function ($container) use ($translations, $uiLang, $lang JOIN registrar r ON ru.registrar_id = r.id WHERE ru.user_id = ?'; - $result = $db->select($query, [$_SESSION['auth_user_id']]); + if (isset($_SESSION['auth_user_id'])) { + $result = $db->select($query, [$_SESSION['auth_user_id']]); - $_SESSION['_currency'] = 'USD'; // default value + // Default value for currency + $_SESSION['_currency'] = 'USD'; - if ($result !== null && isset($result[0]['currency'])) { - $_SESSION['_currency'] = $result[0]['currency']; + if ($result !== null && isset($result[0]['currency'])) { + $_SESSION['_currency'] = $result[0]['currency']; + } } - $view->getEnvironment()->addGlobal('currency', $_SESSION['_currency']); + $currency = isset($_SESSION['_currency']) ? $_SESSION['_currency'] : 'USD'; + $view->getEnvironment()->addGlobal('currency', $currency); $translateFunction = new TwigFunction('__', function ($text) use ($translations) { // Find the translation