diff --git a/app/templates/page-footer.php b/app/templates/page-footer.php index 9e7c076..5248206 100644 --- a/app/templates/page-footer.php +++ b/app/templates/page-footer.php @@ -4,13 +4,74 @@ - - -
- - +hasRight($userId, 'superuser'); + } + + if ($canSeeSessionDebug) { + Session::startSession(); + $remember = !empty($_SESSION['REMEMBER_ME']); + $timeoutSeconds = $remember ? (30 * 24 * 60 * 60) : 7200; + $lastActivity = $_SESSION['LAST_ACTIVITY'] ?? null; + + $remainingLabel = 'Session activity timestamp unavailable.'; + $expiresAtLabel = 'unknown expiry'; + + if ($lastActivity !== null) { + $elapsed = time() - (int)$lastActivity; + $secondsRemaining = max(0, $timeoutSeconds - $elapsed); + + $days = intdiv($secondsRemaining, 86400); + $hours = intdiv($secondsRemaining % 86400, 3600); + $minutes = intdiv($secondsRemaining % 3600, 60); + $seconds = $secondsRemaining % 60; + + $parts = []; + if ($days > 0) { + $parts[] = $days . ' ' . ($days === 1 ? 'day' : 'days'); + } + if ($hours > 0) { + $parts[] = $hours . ' ' . ($hours === 1 ? 'hour' : 'hours'); + } + if ($minutes > 0) { + $parts[] = $minutes . ' ' . ($minutes === 1 ? 'minute' : 'minutes'); + } + if ($seconds > 0 || empty($parts)) { + $parts[] = $seconds . ' ' . ($seconds === 1 ? 'second' : 'seconds'); + } + + $remainingLabel = implode(' ', $parts); + $expiresAtLabel = date('Y-m-d H:i:s', time() + $secondsRemaining); + } + + ob_start(); +?> + + Session debug: + = $remember ? 'Remember-me' : 'Standard' ?> session expires in = htmlspecialchars($remainingLabel) ?> (= htmlspecialchars($expiresAtLabel) ?>) + + + + + + @@ -42,6 +103,5 @@ document.addEventListener('DOMContentLoaded', function() { }); -