mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-04-13 16:31:54 +00:00
fix: guard setcookie() and header() with headers_sent() check
functions.php and session.php are included from post.php inside footer, after HTML output has started. setcookie() and header() calls without headers_sent() guard produced 'Cannot modify header information' warnings.
This commit is contained in:
@@ -26,11 +26,15 @@ if (isset($_SESSION['hash'])) {
|
||||
}
|
||||
|
||||
if (!empty($rUserInfo['hue']) && (!isset($_COOKIE['hue']) || $_COOKIE['hue'] != $rUserInfo['hue'])) {
|
||||
setcookie('hue', $rUserInfo['hue'], time() + 604800);
|
||||
if (!headers_sent()) {
|
||||
setcookie('hue', $rUserInfo['hue'], time() + 604800);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_COOKIE['theme']) || $_COOKIE['theme'] != $rUserInfo['theme']) {
|
||||
setcookie('theme', $rUserInfo['theme'], time() + 604800);
|
||||
if (!headers_sent()) {
|
||||
setcookie('theme', $rUserInfo['theme'], time() + 604800);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($_COOKIE['lang']) || $_COOKIE['lang'] != $rUserInfo['lang']) {
|
||||
@@ -46,7 +50,9 @@ if (isset($_SESSION['hash'])) {
|
||||
unset($rUserInfo, $rPermissions);
|
||||
|
||||
destroySession();
|
||||
header('Location: index');
|
||||
if (!headers_sent()) {
|
||||
header('Location: index');
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ if (!isset($_SESSION['hash'])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
header('Location: ./login?referrer=' . urlencode(basename($_SERVER['REQUEST_URI'], '.php')));
|
||||
if (!headers_sent()) {
|
||||
header('Location: ./login?referrer=' . urlencode(basename($_SERVER['REQUEST_URI'], '.php')));
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user