From 945c733ec563722bfafeade499b10c8d19b1ba01 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Fri, 26 Sep 2008 19:08:20 +0000 Subject: [PATCH] Make more readable; expose header replace parameter when setting cookies git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13287 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/global.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/functions/global.php b/functions/global.php index e1d9ec8e..455911e9 100644 --- a/functions/global.php +++ b/functions/global.php @@ -494,16 +494,26 @@ function sqsession_start() { /** * Set a cookie + * * @param string $sName The name of the cookie. * @param string $sValue The value of the cookie. - * @param int $iExpire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. - * @param string $sPath The path on the server in which the cookie will be available on. + * @param int $iExpire The time the cookie expires. This is a Unix + * timestamp so is in number of seconds since + * the epoch. + * @param string $sPath The path on the server in which the cookie + * will be available on. * @param string $sDomain The domain that the cookie is available. - * @param boolean $bSecure Indicates that the cookie should only be transmitted over a secure HTTPS connection. + * @param boolean $bSecure Indicates that the cookie should only be + * transmitted over a secure HTTPS connection. * @param boolean $bHttpOnly Disallow JS to access the cookie (IE6 only) + * @param boolean $bReplace Replace previous cookies with same name? + * * @return void + * */ -function sqsetcookie($sName,$sValue='deleted',$iExpire=0,$sPath="",$sDomain="",$bSecure=false,$bHttpOnly=true) { +function sqsetcookie($sName, $sValue='deleted', $iExpire=0, $sPath="", $sDomain="", + $bSecure=false, $bHttpOnly=true, $bReplace=false) { + // if we have a secure connection then limit the cookies to https only. if ($sName && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) { $bSecure = true; @@ -534,10 +544,11 @@ function sqsetcookie($sName,$sValue='deleted',$iExpire=0,$sPath="",$sDomain="",$ . (empty($sPath) ? '' : '; path=' . $sPath) . (empty($sDomain) ? '' : '; domain=' . $sDomain) . (!$bSecure ? '' : '; secure') - . (!$bHttpOnly ? '' : '; HttpOnly'), false); + . (!$bHttpOnly ? '' : '; HttpOnly'), $bReplace); } } + /** * session_regenerate_id replacement for PHP < 4.3.2 * -- 2.25.1