aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_cookie.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-09-17 01:48:31 +0000
committerrvelices <rv-github@modusoptimus.com>2008-09-17 01:48:31 +0000
commitcc12d640519a673d1a422cc608ca6ec1a59ef46e (patch)
tree988c8cb507ee9561d5b96f30974dbb2753c426b6 /include/functions_cookie.inc.php
parent7ea85bc0355c7ad60c51a4a1d3078e3dc4603031 (diff)
- fix status header (web services + IE6 min display)
- sql optims in feed /notification - dont send cookie for 10 years from admin/history.php git-svn-id: http://piwigo.org/svn/trunk@2543 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_cookie.inc.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/include/functions_cookie.inc.php b/include/functions_cookie.inc.php
index 159a5b538..66b66221f 100644
--- a/include/functions_cookie.inc.php
+++ b/include/functions_cookie.inc.php
@@ -36,15 +36,15 @@ function cookie_path()
{
// mod_rewrite is activated for upper level directories. we must set the
// cookie to the path shown in the browser otherwise it will be discarded.
- if
- (
+ if
+ (
isset($_SERVER['PATH_INFO']) and !empty($_SERVER['PATH_INFO']) and
($_SERVER['REDIRECT_URL'] !== $_SERVER['PATH_INFO']) and
(substr($_SERVER['REDIRECT_URL'],-strlen($_SERVER['PATH_INFO']))
== $_SERVER['PATH_INFO'])
)
{
- $scr = substr($_SERVER['REDIRECT_URL'], 0,
+ $scr = substr($_SERVER['REDIRECT_URL'], 0,
strlen($_SERVER['REDIRECT_URL'])-strlen($_SERVER['PATH_INFO']));
}
else
@@ -64,7 +64,7 @@ function cookie_path()
{
$scr .= '/';
}
-
+
if ( substr(PHPWG_ROOT_PATH,0,3)=='../')
{ // this is maybe a plugin inside pwg directory
// TODO - what if it is an external script outside PWG ?
@@ -87,12 +87,20 @@ function cookie_path()
* @return boolean true on success
* @see pwg_get_cookie_var
*/
-function pwg_set_cookie_var($var, $value)
+function pwg_set_cookie_var($var, $value, $expire=null)
{
- $_COOKIE['pwg_'.$var] = $value;
- return
- setcookie('pwg_'.$var, $value,
- strtotime('+10 years'), cookie_path());
+ if ($value==null or $expire===0)
+ {
+ unset($_COOKIE['pwg_'.$var]);
+ return setcookie('pwg_'.$var, false, 0, cookie_path());
+
+ }
+ else
+ {
+ $_COOKIE['pwg_'.$var] = $value;
+ $expire = is_numeric($expire) ? $expire : strtotime('+10 years');
+ return setcookie('pwg_'.$var, $value, $expire, cookie_path());
+ }
}
/**