aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMIkhail Gulyaev <gmichaelat@gmail.com>2016-10-11 16:12:30 +0700
committerGulyaev Mikhail <gmichaelat@gmail.com>2016-10-17 12:54:08 +0700
commit868d55913da617a9c897af3b04c4e0dfb69e00d3 (patch)
tree6984909b6456df674b03e390b399c8760827c50c /phpBB/includes/functions.php
parent1ad64f89b817a42722b522f4a763424eea3b5a5f (diff)
downloadforums-868d55913da617a9c897af3b04c4e0dfb69e00d3.tar
forums-868d55913da617a9c897af3b04c4e0dfb69e00d3.tar.gz
forums-868d55913da617a9c897af3b04c4e0dfb69e00d3.tar.bz2
forums-868d55913da617a9c897af3b04c4e0dfb69e00d3.tar.xz
forums-868d55913da617a9c897af3b04c4e0dfb69e00d3.zip
[ticket/14818] Optimize generate_board_url function
if $config['force_server_vars'] no need to calculate $request
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 12ca5540ca..b3a3c9c6d7 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;