diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/database_update.php | 4 | ||||
-rw-r--r-- | phpBB/install/index.php | 16 | ||||
-rw-r--r-- | phpBB/install/install_install.php | 22 |
3 files changed, 22 insertions, 20 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 37fe6817d5..cd060a0b2b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -143,9 +143,9 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); unset($dbpasswd); $user->ip = ''; -if (!empty($_SERVER['REMOTE_ADDR'])) +if ($request->server('REMOTE_ADDR')) { - $user->ip = (function_exists('phpbb_ip_normalise')) ? phpbb_ip_normalise($_SERVER['REMOTE_ADDR']) : htmlspecialchars($_SERVER['REMOTE_ADDR']); + $user->ip = (function_exists('phpbb_ip_normalise')) ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : $request->server('REMOTE_ADDR', '', true); } $sql = "SELECT config_value diff --git a/phpBB/install/index.php b/phpBB/install/index.php index e3f9bda372..bba26fde7a 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -98,9 +98,9 @@ request_var('', 0, false, false, $request); // "dependency injection" for a func // Try and load an appropriate language if required $language = basename(request_var('language', '')); -if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) +if ($request->header('Accept-Language') && !$language) { - $accept_lang_ary = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); + $accept_lang_ary = explode(',', strtolower($request->header('Accept-Language'))); foreach ($accept_lang_ary as $accept_lang) { // Set correct format ... guess full xx_yy form @@ -427,15 +427,17 @@ class module */ function redirect($page) { + global $request; + // HTTP_HOST is having the correct browser url in most cases... - $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); - $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); - $secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0; + $server_name = strtolower($request->header('Host', $request->server('SERVER_NAME'))); + $server_port = $request->server('SERVER_PORT', 0); + $secure = $request->is_secure() ? 1 : 0; - $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + $script_name = $request->server('PHP_SELF'); if (!$script_name) { - $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + $script_name = $request->server('REQUEST_URI'); } // Replace backslashes and doubled slashes (could happen on some proxy setups) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index e36fc1c618..12f541e5f8 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -999,7 +999,7 @@ class install_install extends module */ function obtain_advanced_settings($mode, $sub) { - global $lang, $template, $phpEx; + global $lang, $template, $phpEx, $request; $this->page_title = $lang['STAGE_ADVANCED']; @@ -1017,7 +1017,7 @@ class install_install extends module $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />'; // HTTP_HOST is having the correct browser url in most cases... - $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); + $server_name = strtolower($request->header('Host', $request->server('SERVER_NAME'))); // HTTP HOST can carry a port number... if (strpos($server_name, ':') !== false) @@ -1027,16 +1027,16 @@ class install_install extends module $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true; $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : $server_name; - $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : ((!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT')); - $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'); - $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false); + $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : $request->server('SERVER_PORT', 0); + $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ($request->is_secure() ? 'https://' : 'http://'); + $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : $request->is_secure(); if ($data['script_path'] === '') { - $name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + $name = $request->server('PHP_SELF'); if (!$name) { - $name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + $name = $request->server('REQUEST_URI'); } // Replace backslashes and doubled slashes (could happen on some proxy setups) @@ -1101,7 +1101,7 @@ class install_install extends module */ function load_schema($mode, $sub) { - global $db, $lang, $template, $phpbb_root_path, $phpEx; + global $db, $lang, $template, $phpbb_root_path, $phpEx, $request; $this->page_title = $lang['STAGE_CREATE_TABLE']; $s_hidden_fields = ''; @@ -1117,8 +1117,8 @@ class install_install extends module } // HTTP_HOST is having the correct browser url in most cases... - $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); - $referer = (!empty($_SERVER['HTTP_REFERER'])) ? strtolower($_SERVER['HTTP_REFERER']) : getenv('HTTP_REFERER'); + $server_name = strtolower($request->header('Host', $request->server('SERVER_NAME'))); + $referer = strtolower($request->header('Referer')); // HTTP HOST can carry a port number... if (strpos($server_name, ':') !== false) @@ -1235,7 +1235,7 @@ class install_install extends module $current_time = time(); - $user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? phpbb_ip_normalise($_SERVER['REMOTE_ADDR']) : ''; + $user_ip = $request->server('REMOTE_ADDR') ? phpbb_ip_normalise($request->server('REMOTE_ADDR')) : ''; if ($data['script_path'] !== '/') { |