Fix samsite support for php <= 7.2
This commit is contained in:
parent
5529075fb3
commit
ed5262432f
|
@ -141,11 +141,8 @@ zm_session_start();
|
||||||
|
|
||||||
$cookie_options = array(
|
$cookie_options = array(
|
||||||
'expires'=>time()+3600*24*30*12*10,
|
'expires'=>time()+3600*24*30*12*10,
|
||||||
|
'samesite' => 'Strict',
|
||||||
);
|
);
|
||||||
if ( version_compare(phpversion(), '7.3.0', '>=') ) {
|
|
||||||
# samesite was introduced in 7.3.0
|
|
||||||
$cookie_options['samesite'] = 'Strict';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isset($_SESSION['skin']) ||
|
!isset($_SESSION['skin']) ||
|
||||||
|
@ -154,7 +151,11 @@ if (
|
||||||
($_COOKIE['zmSkin'] != $skin)
|
($_COOKIE['zmSkin'] != $skin)
|
||||||
) {
|
) {
|
||||||
$_SESSION['skin'] = $skin;
|
$_SESSION['skin'] = $skin;
|
||||||
|
if (version_compare(phpversion(), '7.3.0', '>=')) {
|
||||||
setcookie('zmSkin', $skin, $cookie_options);
|
setcookie('zmSkin', $skin, $cookie_options);
|
||||||
|
} else {
|
||||||
|
setcookie('zmSkin', $skin, $cookie_options['expires'], '/; samesite=strict');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -164,7 +165,11 @@ if (
|
||||||
($_COOKIE['zmCSS'] != $css)
|
($_COOKIE['zmCSS'] != $css)
|
||||||
) {
|
) {
|
||||||
$_SESSION['css'] = $css;
|
$_SESSION['css'] = $css;
|
||||||
|
if (version_compare(phpversion(), '7.3.0', '>=')) {
|
||||||
setcookie('zmCSS', $css, $cookie_options);
|
setcookie('zmCSS', $css, $cookie_options);
|
||||||
|
} else {
|
||||||
|
setcookie('zmCSS', $css, $cookie_options['expires'], '/; samesite=strict');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Running is global but only do the daemonCheck if it is actually needed
|
# Running is global but only do the daemonCheck if it is actually needed
|
||||||
|
|
Loading…
Reference in New Issue