diff options
author | shadlaws <shad@shadlaws.com> | 2013-03-11 18:44:45 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-03-11 18:44:45 +0100 |
commit | 63e5dd76d989c97f944c1cf0650f659bc5a40140 (patch) | |
tree | 374ce9c706a22aeeccb7d33c3f256f243d58d164 /system/helpers | |
parent | ff5f386320b150fe3e33440c0dba4c71bc1830ef (diff) |
#2049 - Fix issues with ports other than http/80 or https/443.
- get SERVER_PORT and add to SERVER_NAME if it's not http/80 or https/443
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/url.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/system/helpers/url.php b/system/helpers/url.php index 014f96fe..02956fc3 100644 --- a/system/helpers/url.php +++ b/system/helpers/url.php @@ -62,7 +62,9 @@ class url_Core { if ($site_domain === '' OR $site_domain[0] === '/') { // Guess the server name if the domain starts with slash - $base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?$_SERVER['SERVER_NAME']:$_SERVER['HTTP_HOST']).$site_domain; + $port = $_SERVER['SERVER_PORT']; + $port = ((($port == 80) && ($protocol == 'http')) || (($port == 443) && ($protocol == 'https')) || !$port) ? '' : ":$port"; + $base_url = $protocol.'://'.($_SERVER['SERVER_NAME']?($_SERVER['SERVER_NAME'].$port):$_SERVER['HTTP_HOST']).$site_domain; } else { |