mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-24 16:51:47 -04:00
Fix: Saving "navbar_type" in cookies (index.php)
Also, _REQUEST is more important than _COOKIE Therefore, we check _REQUEST after checking _COOKIE
This commit is contained in:
@@ -112,6 +112,15 @@ global $navbar_type;
|
||||
$navbar_type = isset($_SESSION['navbar_type']) ? $_SESSION['navbar_type'] : '';
|
||||
$valid_navbar_types = ['normal'=>1, 'collapsed'=>1, 'left'=>1];
|
||||
|
||||
# Cookie overrides session
|
||||
if (isset($_COOKIE['zmNavbar_type'])) {
|
||||
if (isset($valid_navbar_types[$_COOKIE['zmNavbar_type']])) {
|
||||
$navbar_type = $_COOKIE['zmNavbar_type'];
|
||||
} else {
|
||||
ZM\Error('Invalid navbar_type '.$_COOKIE['zmNavbar_type'].' specified');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['navbar_type'])) {
|
||||
if (isset($valid_navbar_types[$_REQUEST['navbar_type']])) {
|
||||
$navbar_type = $_REQUEST['navbar_type'];
|
||||
@@ -120,15 +129,6 @@ if (isset($_REQUEST['navbar_type'])) {
|
||||
}
|
||||
}
|
||||
|
||||
# Cookie overrides session
|
||||
if (isset($_COOKIE['navbar_type'])) {
|
||||
if (isset($valid_navbar_types[$_COOKIE['navbar_type']])) {
|
||||
$navbar_type = $_COOKIE['navbar_type'];
|
||||
} else {
|
||||
ZM\Error('Invalid navbar_type '.$_COOKIE['navbar_type'].' specified');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$navbar_type and defined('ZM_WEB_NAVBAR_TYPE')) {
|
||||
if (isset($valid_navbar_types[ZM_WEB_NAVBAR_TYPE])) {
|
||||
$navbar_type = ZM_WEB_NAVBAR_TYPE;
|
||||
@@ -177,7 +177,16 @@ if (
|
||||
$_SESSION['css'] = $css;
|
||||
zm_setcookie('zmCSS', $css);
|
||||
}
|
||||
$_SESSION['navbar_type'] = $navbar_type;
|
||||
|
||||
if (
|
||||
!isset($_SESSION['navbar_type']) ||
|
||||
isset($_REQUEST['navbar_type']) ||
|
||||
!isset($_COOKIE['zmNavbar_type']) ||
|
||||
($_COOKIE['zmNavbar_type'] != $navbar_type)
|
||||
) {
|
||||
$_SESSION['navbar_type'] = $navbar_type;
|
||||
zm_setcookie('zmNavbar_type', $navbar_type);
|
||||
}
|
||||
|
||||
# Add Cross domain access headers
|
||||
CORSHeaders();
|
||||
|
||||
Reference in New Issue
Block a user