Uses datetime helper to display times

main
Yasen Pramatarov 2026-01-29 14:12:36 +02:00
parent 32c11a9c04
commit e9dc4463c1
4 changed files with 14 additions and 4 deletions

View File

@ -3,7 +3,10 @@
<!-- 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">
<span><?= htmlspecialchars($timeNow->format('H:i')) ?>&nbsp;&nbsp;<?= htmlspecialchars($userTimezone) ?></span> <?php
$timeNowLabel = app_format_local_datetime(gmdate('Y-m-d H:i:s'), 'H:i', $userTimezone) ?: '--:--';
?>
<span><?= htmlspecialchars($timeNowLabel) ?>&nbsp;&nbsp;<?= htmlspecialchars($userTimezone) ?></span>
</div> </div>
<div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div> <div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div>

View File

@ -18,6 +18,7 @@ foreach ($themes as $themeData) {
break; break;
} }
} }
$userTimezone = \App\App::get('user_timezone') ?: 'UTC';
$totalThemes = count($themes); $totalThemes = count($themes);
?> ?>
@ -106,7 +107,10 @@ $totalThemes = count($themes);
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($theme['last_modified'])): <?php if (!empty($theme['last_modified'])):
$lastEdited = is_numeric($theme['last_modified']) ? date('M j, Y', (int)$theme['last_modified']) : $theme['last_modified']; $lastEditedRaw = is_numeric($theme['last_modified'])
? gmdate('Y-m-d H:i:s', (int)$theme['last_modified'])
: $theme['last_modified'];
$lastEdited = app_format_local_datetime($lastEditedRaw, 'M j, Y', $userTimezone) ?: $lastEditedRaw;
?> ?>
<div class="tm-theme-stat"> <div class="tm-theme-stat">
<dt>Last edit</dt> <dt>Last edit</dt>

View File

@ -143,7 +143,7 @@ function logs_plugin_render_list($logObject, $db, int $userId, bool $validSessio
$username = $userObject->getUserDetails($userId)[0]['username']; $username = $userObject->getUserDetails($userId)[0]['username'];
$page = 'logs'; // For pagination template $page = 'logs'; // For pagination template
// Get any new feedback messages // Get any new feedback messages
include_once APP_PATH . 'helpers/feedback.php'; include_once APP_PATH . 'helpers/feedback.php';
require_once PLUGIN_LOGS_PATH . 'helpers/logs_view_helper.php'; require_once PLUGIN_LOGS_PATH . 'helpers/logs_view_helper.php';

View File

@ -1,4 +1,7 @@
<?php
$userTimezone = \App\App::get('user_timezone') ?: 'UTC';
?>
<!-- log events --> <!-- log events -->
<div class="container-fluid mt-4"> <div class="container-fluid mt-4">
<div class="row mb-4"> <div class="row mb-4">
@ -92,7 +95,7 @@
<?php if ($scope === 'system') { ?> <?php if ($scope === 'system') { ?>
<td style="white-space: nowrap;"><?= $row['userID'] ? '<strong>' . htmlspecialchars($row['username'] . " ({$row['userID']})") . '</strong>' : '<span class="text-muted font-weight-normal small">SYSTEM</span>' ?></td> <td style="white-space: nowrap;"><?= $row['userID'] ? '<strong>' . htmlspecialchars($row['username'] . " ({$row['userID']})") . '</strong>' : '<span class="text-muted font-weight-normal small">SYSTEM</span>' ?></td>
<?php } ?> <?php } ?>
<td style="white-space: nowrap;"><span class="text-muted"><?= date('d M Y H:i', strtotime($row['time'])) ?></span></td> <td style="white-space: nowrap;"><span class="text-muted"><?= app_format_local_datetime($row['time'] ?? null, 'd M Y H:i', $userTimezone) ?: '—' ?></span></td>
<td style="white-space: nowrap;"><span class="<?= getLogLevelClass($row['log level']) ?>"><?= htmlspecialchars($row['log level']) ?></span></td> <td style="white-space: nowrap;"><span class="<?= getLogLevelClass($row['log level']) ?>"><?= htmlspecialchars($row['log level']) ?></span></td>
<td style="width: 100%; word-break: break-word;"><?= htmlspecialchars($row['log message']) ?></td> <td style="width: 100%; word-break: break-word;"><?= htmlspecialchars($row['log message']) ?></td>
</tr> </tr>