aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_url.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_url.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_url.inc.php')
-rw-r--r--include/functions_url.inc.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/functions_url.inc.php b/include/functions_url.inc.php
index 1410243da..376d4f4e9 100644
--- a/include/functions_url.inc.php
+++ b/include/functions_url.inc.php
@@ -38,7 +38,7 @@ function get_root_url()
$root_url = $page['root_path'];
}
else
- {
+ {// TODO - add HERE the possibility to call PWG functions from external scripts
$root_url = PHPWG_ROOT_PATH;
}
if ( dirname($root_url)!='.' )
@@ -52,17 +52,22 @@ function get_root_url()
}
/**
- * returns the url of the current host (e.g. http://www.toto.com )
- * TODO: if required by someone, treat https case
+ * returns the absolute url to the root of PWG
+ * @param boolean with_scheme if false - does not add http://toto.com
*/
-function get_host_url()
+function get_absolute_root_url($with_scheme=true)
{
- $url = "http://";
- $url .= $_SERVER['HTTP_HOST'];
- if ($_SERVER['SERVER_PORT']!=80)
+ // TODO - add HERE the possibility to call PWG functions from external scripts
+ $url = '';
+ if ($with_scheme)
{
- $url .= ':'.$_SERVER['SERVER_PORT'];
+ $url .= 'http://'.$_SERVER['HTTP_HOST'];
+ if ($_SERVER['SERVER_PORT']!=80)
+ {
+ $url .= ':'.$_SERVER['SERVER_PORT'];
+ }
}
+ $url .= cookie_path();
return $url;
}
@@ -419,7 +424,7 @@ function set_make_full_url()
$page['save_root_path']['path'] = $page['root_path'];
}
$page['save_root_path']['count'] = 1;
- $page['root_path'] = get_host_url().cookie_path();
+ $page['root_path'] = get_absolute_root_url();
}
else
{