Use external cookie library to prevent incorrect cookie setting (#1160)

* Use external cookie library to prevent incorrect cookie setting

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-11-23 08:26:32 +07:00 committed by GitHub
commit 357bb08387
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 22 deletions

View file

@ -82,18 +82,11 @@ define('COOKIE_MAX_TRACKS', 90);
* @param bool $httponly
* @return bool
*/
function bb_setcookie($name, $val, int $lifetime = COOKIE_PERSIST, bool $httponly = false)
function bb_setcookie($name, $val, int $lifetime = COOKIE_PERSIST, bool $httponly = false): bool
{
global $bb_cfg;
return setcookie($name, $val, [
'expires' => $lifetime,
'path' => $bb_cfg['script_path'],
'domain' => $bb_cfg['cookie_domain'],
'secure' => $bb_cfg['cookie_secure'],
'httponly' => $httponly,
'samesite' => $bb_cfg['cookie_same_site'],
]);
return \Delight\Cookie\Cookie::setcookie($name, $val, $lifetime, $bb_cfg['script_path'], $bb_cfg['cookie_domain'], $bb_cfg['server_secure'], $httponly, $bb_cfg['cookie_same_site']);
}
// User Levels