diff --git a/includes/getsettings.php b/includes/getsettings.php index 19120cbba..1ffeaf816 100644 --- a/includes/getsettings.php +++ b/includes/getsettings.php @@ -7,14 +7,9 @@ $settings = $result->fetchArray(SQLITE3_ASSOC); if ($settings) { - $cookieExpire = time() + (30 * 24 * 60 * 60); $themeMapping = array(0 => 'light', 1 => 'dark', 2 => 'automatic'); $themeKey = isset($settings['dark_theme']) ? $settings['dark_theme'] : 2; $themeValue = $themeMapping[$themeKey]; - setcookie('theme', $themeValue, [ - 'expires' => $cookieExpire, - 'samesite' => 'Strict' - ]); $settings['update_theme_setttings'] = false; if (isset($_COOKIE['inUseTheme']) && $settings['dark_theme'] == 2) { $inUseTheme = $_COOKIE['inUseTheme']; diff --git a/includes/header.php b/includes/header.php index b132a44c8..e7b3d9294 100644 --- a/includes/header.php +++ b/includes/header.php @@ -38,6 +38,14 @@ $customCss = $settings['customCss']; } + if (isset($themeValue)) { + $cookieExpire = time() + (30 * 24 * 60 * 60); + setcookie('theme', $themeValue, [ + 'expires' => $cookieExpire, + 'samesite' => 'Strict' + ]); + } + $isAdmin = $_SESSION['userId'] == 1; function hex2rgb($hex) { diff --git a/includes/version.php b/includes/version.php index a45bed749..71ad0c7f5 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file diff --git a/index.php b/index.php index 42a2a6ae2..f516c20c5 100644 --- a/index.php +++ b/index.php @@ -155,6 +155,7 @@ +