diff options
author | Tristan Darricau <github@nicofuma.fr> | 2016-10-24 23:08:06 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2016-10-24 23:08:06 +0200 |
commit | e3a85ff0a741549815224f962f87748818ed1b9e (patch) | |
tree | 2db18dcea33c6ce829328174522c346dd3f5bccb | |
parent | 163292bc1188efdd623a1270a1aedf7e9b281801 (diff) | |
parent | 868d55913da617a9c897af3b04c4e0dfb69e00d3 (diff) | |
download | forums-e3a85ff0a741549815224f962f87748818ed1b9e.tar forums-e3a85ff0a741549815224f962f87748818ed1b9e.tar.gz forums-e3a85ff0a741549815224f962f87748818ed1b9e.tar.bz2 forums-e3a85ff0a741549815224f962f87748818ed1b9e.tar.xz forums-e3a85ff0a741549815224f962f87748818ed1b9e.zip |
Merge pull request #4487 from gmixo/patch-2
[ticket/14818] Optimize generate_board_url function
* gmixo/patch-2:
[ticket/14818] Optimize generate_board_url function
-rw-r--r-- | phpBB/includes/functions.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c7af54da19..a152d9b620 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2233,13 +2233,6 @@ function generate_board_url($without_script_path = false) global $config, $user, $request; $server_name = $user->host; - $server_port = $request->server('SERVER_PORT', 0); - $forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO'); - - if (!empty($forwarded_proto) && $forwarded_proto === 'https') - { - $server_port = 443; - } // Forcing server vars is the only way to specify/override the protocol if ($config['force_server_vars'] || !$server_name) @@ -2254,6 +2247,13 @@ function generate_board_url($without_script_path = false) } else { + $server_port = $request->server('SERVER_PORT', 0); + $forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO'); + + if (!empty($forwarded_proto) && $forwarded_proto === 'https') + { + $server_port = 443; + } // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection $cookie_secure = $request->is_secure() ? 1 : 0; $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name; |