new param $path for egw_setcookie to optionally specify a path

This commit is contained in:
Ralf Becker 2006-12-25 11:04:21 +00:00
parent 4d5d4c42c0
commit 80d063e041

View File

@ -500,16 +500,19 @@
* Set a cookie * Set a cookie
* *
* @param string $cookiename name of cookie to be set * @param string $cookiename name of cookie to be set
* @param string $cookievalue value to be used, if unset cookie is cleared (optional) * @param string $cookievalue='' value to be used, if unset cookie is cleared (optional)
* @param int $cookietime when cookie should expire, 0 for session only (optional) * @param int $cookietime=0 when cookie should expire, 0 for session only (optional)
* @param string $cookiepath=null optional path (eg. '/') if the eGW install-dir should not be used
*/ */
function egw_setcookie($cookiename,$cookievalue='',$cookietime=0) function egw_setcookie($cookiename,$cookievalue='',$cookietime=0,$cookiepath=null)
{ {
if (!$this->cookie_domain || !$this->cookie_path) if (!$this->cookie_domain || !$this->cookie_path)
{ {
$this->egw_set_cookiedomain(); $this->egw_set_cookiedomain();
} }
setcookie($cookiename,$cookievalue,$cookietime,$this->cookie_path,$this->cookie_domain); if (is_null($cookiepath)) $cookiepath = $this->cookie_path;
setcookie($cookiename,$cookievalue,$cookietime,$cookiepath,$this->cookie_domain);
} }
/** /**