aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_session.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-01-24 05:07:08 +0000
committerrvelices <rv-github@modusoptimus.com>2007-01-24 05:07:08 +0000
commit585d7c434e9dfdadd3d6755f0af7957f20f6b5a9 (patch)
tree1ff919c24113089bd503e3439eb88daec1c7085e /include/functions_session.inc.php
parentd71f764762c13927b8dd2a94dd4be8b734b35090 (diff)
- plugins with own independent scripts work now (cookie_path and url root are
correct) - prepare a bit some url functions so that later we can fully embed pwg in scripts located outside pwg - remove some unnecessary language strings git-svn-id: http://piwigo.org/svn/trunk@1750 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_session.inc.php')
-rw-r--r--include/functions_session.inc.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index ba1820028..d02fea3ae 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -111,8 +111,25 @@ function cookie_path()
$scr = $_SERVER['SCRIPT_NAME'];
}
$scr = substr($scr,0,strrpos( $scr,'/'));
+
// add a trailing '/' if needed
- return ($scr{strlen($scr)-1} == '/') ? $scr : $scr . '/';
+ $scr .= ($scr{strlen($scr)-1} == '/') ? '' : '/';
+
+ 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 ?
+ $scr = $scr.PHPWG_ROOT_PATH;
+ while (1)
+ {
+ $new = preg_replace('#[^/]+/\.\.(/|$)#', '', $scr);
+ if ($new==$scr)
+ {
+ break;
+ }
+ $scr=$new;
+ }
+ }
+ return $scr;
}
/**