settings cache
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
use MintyPHP\Buffer;
|
||||
use MintyPHP\Http\RequestContext;
|
||||
use MintyPHP\Service\Settings\SettingsSessionGateway;
|
||||
use MintyPHP\Session;
|
||||
|
||||
$defaultTitle = appTitle();
|
||||
@@ -12,10 +11,8 @@ $primaryVars = appPrimaryCssVars();
|
||||
$csrfKey = Session::$csrfSessionKey;
|
||||
$csrfToken = (string) ($_SESSION[$csrfKey] ?? '');
|
||||
$isLoggedIn = !empty($user['id']);
|
||||
$sessionIdleSeconds = 0;
|
||||
if ($isLoggedIn) {
|
||||
$sessionIdleSeconds = app(SettingsSessionGateway::class)->getSessionIdleTimeoutSeconds();
|
||||
}
|
||||
$sessionIdleMinutes = (int) (appSetting('session_idle_timeout_minutes') ?? 30);
|
||||
$sessionIdleSeconds = max($sessionIdleMinutes, 5) * 60;
|
||||
$telemetryEnabled = frontendTelemetryEnabled();
|
||||
$telemetrySampleRate = frontendTelemetrySampleRate();
|
||||
$telemetryAllowedEvents = implode(',', frontendTelemetryAllowedEvents());
|
||||
@@ -44,7 +41,7 @@ if ($bufferTitle !== '') {
|
||||
data-telemetry-allowed-events="<?php e($telemetryAllowedEvents); ?>"
|
||||
data-telemetry-csrf-key="<?php e($csrfKey); ?>"
|
||||
data-telemetry-csrf-token="<?php e($csrfToken); ?>"
|
||||
<?php if ($isLoggedIn && $sessionIdleSeconds > 0): ?>
|
||||
<?php if ($isLoggedIn): ?>
|
||||
data-session-idle-seconds="<?php e((string) $sessionIdleSeconds); ?>"
|
||||
data-session-ping-url="<?php e(lurl('admin/session-ping/data')); ?>"
|
||||
data-session-logout-url="<?php e(lurl('logout')); ?>"
|
||||
@@ -89,7 +86,7 @@ if ($bufferTitle !== '') {
|
||||
|
||||
<script src="<?php e(assetVersion('vendor/fslightbox/fslightbox.js')); ?>"></script>
|
||||
<?php require __DIR__ . '/partials/app-confirm-dialog.phtml'; ?>
|
||||
<?php if ($isLoggedIn && $sessionIdleSeconds > 0): ?>
|
||||
<?php if ($isLoggedIn): ?>
|
||||
<?php require __DIR__ . '/partials/app-session-warning-dialog.phtml'; ?>
|
||||
<script type="module" src="<?php e(assetVersion('js/components/app-session-warning.js')); ?>"></script>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user