Allow to set custom cookie validity.
Will be needed for blog.s9y.org templatechooser, which is why I need it in 2.0.1
This commit is contained in:
parent
104122925b
commit
5f59a811e8
@ -53,6 +53,8 @@ Version 2.1 ()
|
||||
Version 2.0.2 ()
|
||||
------------------------------------------------------------------------
|
||||
|
||||
* Allow serendipity_setCookie() function to set custom expiry.
|
||||
|
||||
* Adapt .htaccess profile of "mod_rewrite for 1&1 and problematic
|
||||
servers" to not include the "Options -MultiViews" option, since
|
||||
this is often blocked
|
||||
|
@ -692,9 +692,10 @@ function serendipity_restoreVar(&$source, &$target) {
|
||||
* @access public
|
||||
* @param string The name of the cookie variable
|
||||
* @param string The contents of the cookie variable
|
||||
* @param int Cookie validity (unix timestamp)
|
||||
* @return null
|
||||
*/
|
||||
function serendipity_setCookie($name, $value, $securebyprot = true) {
|
||||
function serendipity_setCookie($name, $value, $securebyprot = true, $custom_timeout = false) {
|
||||
global $serendipity;
|
||||
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
@ -713,7 +714,11 @@ function serendipity_setCookie($name, $value, $securebyprot = true) {
|
||||
$host = '';
|
||||
}
|
||||
|
||||
setcookie("serendipity[$name]", $value, time()+60*60*24*30, $serendipity['serendipityHTTPPath'], $host, $secure);
|
||||
if ($custom_timeout === false) {
|
||||
$custom_timeout = time() + 60*60*24*30;
|
||||
}
|
||||
|
||||
setcookie("serendipity[$name]", $value, $serendipity['serendipityHTTPPath'], $host, $secure);
|
||||
$_COOKIE[$name] = $value;
|
||||
$serendipity['COOKIE'][$name] = $value;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user