summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-12-30 14:01:41 -0800
committerGreg Roach <fisharebest@gmail.com>2013-12-30 14:01:41 -0800
commita8b37b398de0108b5cd30f2ca8903fa653e5969f (patch)
tree18cdae4b719812054149f279d51b012344a80ffe
parent0d305f571d070e04a69b267d0d2ab934f95b988b (diff)
parent6d3590132bd859cbf4ba4c4930931c5b18ae1589 (diff)
downloadwebtrees-a8b37b398de0108b5cd30f2ca8903fa653e5969f.tar.gz
webtrees-a8b37b398de0108b5cd30f2ca8903fa653e5969f.tar.bz2
webtrees-a8b37b398de0108b5cd30f2ca8903fa653e5969f.zip
Merge pull request #67 from mnoorenberghe/https_port
Don't include the HTTPS port in WT_SERVER_NAME when it's the default
-rwxr-xr-xincludes/session.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/session.php b/includes/session.php
index 70cfd5be6e..edf6f5a3dc 100755
--- a/includes/session.php
+++ b/includes/session.php
@@ -165,10 +165,11 @@ if (!ini_get('date.timezone')) {
// TODO: we ought to generate this dynamically, but lots of code currently relies on this global
$QUERY_STRING=isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
+$https = !empty($_SERVER['HTTPS']) && in_array($_SERVER['HTTPS'], array('1', 'on', 'On', 'ON'));
define('WT_SERVER_NAME',
- (empty($_SERVER['HTTPS']) || !in_array($_SERVER['HTTPS'], array('1', 'on', 'On', 'ON')) ? 'http://' : 'https://').
+ ($https ? 'https://' : 'http://').
(empty($_SERVER['SERVER_NAME']) ? '' : $_SERVER['SERVER_NAME']).
- (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT']==80 ? '' : ':'.$_SERVER['SERVER_PORT'])
+ (empty($_SERVER['SERVER_PORT']) || (!$https && $_SERVER['SERVER_PORT']==80) || ($https && $_SERVER['SERVER_PORT']==443) ? '' : ':'.$_SERVER['SERVER_PORT'])
);
// SCRIPT_NAME should always be correct, but is not always present.