diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 21:01:39 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-10-20 21:01:39 +0200 |
commit | f0bf54f9eb01379ae3c18b351da75bbd8b071c64 (patch) | |
tree | 54c80e303a6a160b71968e7b8ea0fb7c39a1c1db /phpBB/phpbb | |
parent | 4e3b22b33241c7237ad2e007a7fa3be4f1b38d09 (diff) | |
parent | 1aaeb2bca997282800f4cc30a6951104322ae433 (diff) | |
download | forums-f0bf54f9eb01379ae3c18b351da75bbd8b071c64.tar forums-f0bf54f9eb01379ae3c18b351da75bbd8b071c64.tar.gz forums-f0bf54f9eb01379ae3c18b351da75bbd8b071c64.tar.bz2 forums-f0bf54f9eb01379ae3c18b351da75bbd8b071c64.tar.xz forums-f0bf54f9eb01379ae3c18b351da75bbd8b071c64.zip |
Merge pull request #5703 from senky/ticket/16174
[ticket/16174] Add core.set_cookie
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/session.php | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 31f32af7c4..cc5a1b8f8f 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -1077,7 +1077,7 @@ class session */ function set_cookie($name, $cookiedata, $cookietime, $httponly = true) { - global $config; + global $config, $phpbb_dispatcher; // If headers are already set, we just return if (headers_sent()) @@ -1085,6 +1085,32 @@ class session return; } + $disable_cookie = false; + /** + * Event to modify or disable setting cookies + * + * @event core.set_cookie + * @var bool disable_cookie Set to true to disable setting this cookie + * @var string name Name of the cookie + * @var string cookiedata The data to hold within the cookie + * @var int cookietime The expiration time as UNIX timestamp + * @var bool httponly Use HttpOnly? + * @since 3.2.9-RC1 + */ + $vars = array( + 'disable_cookie', + 'name', + 'cookiedata', + 'cookietime', + 'httponly', + ); + extract($phpbb_dispatcher->trigger_event('core.set_cookie', compact($vars))); + + if ($disable_cookie) + { + return; + } + $name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata); $expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime); $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain']; |