🚀 HESK v3.1.2

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
Luke Tainton
2020-08-25 17:24:00 +01:00
parent 77512a09b4
commit 107839166a
171 changed files with 978 additions and 685 deletions

View File

@@ -173,15 +173,20 @@ function hesk_isValidIP($ip)
function hesk_setcookie($name, $value, $expire=0, $path="")
{
if (HESK_SSL)
// PHP < 7.3 doesn't support the SameSite attribute, let's use a trick
if (PHP_VERSION_ID < 70300)
{
setcookie($name, $value, $expire, $path, "", true, true);
}
else
{
setcookie($name, $value, $expire, $path, "", false, true);
setcookie($name, $value, $expire, $path . "; SameSite=Lax", null, HESK_SSL, true);
return true;
}
setcookie($name, $value, array(
'expires' => $expire,
'path' => $path,
'secure' => HESK_SSL,
'samesite' => 'Lax',
));
return true;
} // END hesk_setcookie()
@@ -2076,6 +2081,24 @@ function hesk_session_regenerate_id()
function hesk_session_start()
{
session_name('HESK' . sha1(dirname(__FILE__) . '$r^k*Zkq|w1(G@!-D?3%') );
// PHP < 7.3 doesn't support the SameSite attribute, let's use a trick
if (PHP_VERSION_ID < 70300)
{
$currentCookieParams = session_get_cookie_params();
session_set_cookie_params(
$currentCookieParams['lifetime'],
$currentCookieParams['path'] . "; SameSite=Lax",
$currentCookieParams['domain'],
$currentCookieParams['secure'],
$currentCookieParams['httponly']
);
}
else
{
session_set_cookie_params(array('samesite' => 'Lax'));
}
session_cache_limiter('nocache');
if ( @session_start() )
{