From 585d7c434e9dfdadd3d6755f0af7957f20f6b5a9 Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 24 Jan 2007 05:07:08 +0000 Subject: - 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 --- include/functions_url.inc.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'include/functions_url.inc.php') 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 { -- cgit v1.2.3