Moves $timeNow as early as possible. Available to whole site.

main
Yasen Pramatarov 2026-01-12 13:13:08 +02:00
parent 49ba04bffa
commit f4238f205f
2 changed files with 1 additions and 3 deletions

View File

@ -3,9 +3,6 @@
<!-- Sidebar --> <!-- Sidebar -->
<div class="col-md-3 sidebar-wrapper" id="sidebar"> <div class="col-md-3 sidebar-wrapper" id="sidebar">
<div class="text-center" id="time_now"> <div class="text-center" id="time_now">
<?php
$timeNow = new DateTime('now', new DateTimeZone($userTimezone));
?>
<span><?= htmlspecialchars($timeNow->format('H:i')) ?>&nbsp;&nbsp;<?= htmlspecialchars($userTimezone) ?></span> <span><?= htmlspecialchars($timeNow->format('H:i')) ?>&nbsp;&nbsp;<?= htmlspecialchars($userTimezone) ?></span>
</div> </div>

View File

@ -348,6 +348,7 @@ if ($page == 'logout') {
$userDetails = $userObject->getUserDetails($userId); $userDetails = $userObject->getUserDetails($userId);
$userRights = $userObject->getUserRights($userId); $userRights = $userObject->getUserRights($userId);
$userTimezone = (!empty($userDetails[0]['timezone'])) ? $userDetails[0]['timezone'] : 'UTC'; // Default to UTC if no timezone is set (or is missing) $userTimezone = (!empty($userDetails[0]['timezone'])) ? $userDetails[0]['timezone'] : 'UTC'; // Default to UTC if no timezone is set (or is missing)
$timeNow = new DateTime('now', new DateTimeZone($userTimezone)); // We init local viewer's time as early as possible
// check if the Jilo Server is running // check if the Jilo Server is running
require APP_PATH . 'classes/server.php'; require APP_PATH . 'classes/server.php';