mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Fix pre-flight port number check. (#2681)
This commit is contained in:
parent
40f00665b3
commit
7d272e3c96
|
@ -52,29 +52,18 @@ class SettingsController extends Controller
|
|||
|
||||
$protocol = array_key_exists('HTTPS', $_SERVER) && ( $_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
|
||||
|
||||
|
||||
$pageURL = $protocol;
|
||||
if ($_SERVER["SERVER_PORT"] != "80") {
|
||||
$main_page = $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
|
||||
$pageURL .= $main_page.$_SERVER["REQUEST_URI"];
|
||||
} else {
|
||||
$main_page = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
||||
$pageURL .= $main_page;
|
||||
$host = $_SERVER['SERVER_NAME'];
|
||||
if (($protocol === 'http://' && $_SERVER['SERVER_PORT'] != '80') || ($protocol === 'https://' && $_SERVER['SERVER_PORT'] != '443')) {
|
||||
$host .= ':' . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
$pageURL = $protocol . $host . $_SERVER['REQUEST_URI'];
|
||||
|
||||
$start_settings['env_location'] = $pageURL.'../.env';
|
||||
|
||||
|
||||
if (config('app.url').'/setup'!=$pageURL) {
|
||||
$start_settings['url_valid']= false;
|
||||
} else {
|
||||
$start_settings['url_valid']= true;
|
||||
}
|
||||
$start_settings['url_valid'] = (config('app.url').'/setup' === $pageURL);
|
||||
|
||||
$start_settings['url_config'] = config('app.url');
|
||||
$start_settings['real_url'] = $pageURL;
|
||||
|
||||
$exposed_env = @file_get_contents($main_page.'/.env');
|
||||
$exposed_env = @file_get_contents($protocol . $host.'/.env');
|
||||
|
||||
if ($exposed_env) {
|
||||
$start_settings['env_exposed'] = true;
|
||||
|
|
Loading…
Reference in a new issue