nicer urls when used over https

git-svn-id: http://piwigo.org/svn/trunk@23187 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2013-06-13 18:41:32 +00:00
parent 3f610c0fd8
commit cecee258bb

View File

@@ -51,9 +51,11 @@ function get_absolute_root_url($with_scheme=true)
$url = '';
if ($with_scheme)
{
$is_https = false;
if (isset($_SERVER['HTTPS']) &&
((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))
((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))
{
$is_https = true;
$url .= 'https://';
}
else
@@ -61,7 +63,8 @@ function get_absolute_root_url($with_scheme=true)
$url .= 'http://';
}
$url .= $_SERVER['HTTP_HOST'];
if ($_SERVER['SERVER_PORT'] != 80)
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
||($is_https && $_SERVER['SERVER_PORT'] != 443))
{
$url_port = ':'.$_SERVER['SERVER_PORT'];
if (strrchr($url, ':') != $url_port)