Small fixes

This commit is contained in:
Pinga 2023-09-05 17:20:39 +03:00
parent 80c87c32d4
commit 29b7949fb3

View file

@ -119,15 +119,19 @@ $container->set('view', function ($container) use ($translations, $uiLang, $lang
JOIN registrar r ON ru.registrar_id = r.id JOIN registrar r ON ru.registrar_id = r.id
WHERE ru.user_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'])) { if ($result !== null && isset($result[0]['currency'])) {
$_SESSION['_currency'] = $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) { $translateFunction = new TwigFunction('__', function ($text) use ($translations) {
// Find the translation // Find the translation