1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 11:47:51 +02:00

Merge pull request #416 from thegeeex/dev

Update install.php to handle https requests
This commit is contained in:
Sergey Romanenko
2016-06-11 14:34:14 +03:00
committed by GitHub

View File

@@ -24,15 +24,21 @@
// Get array with the names of all modules compiled and loaded // Get array with the names of all modules compiled and loaded
$php_modules = get_loaded_extensions(); $php_modules = get_loaded_extensions();
// Protocol to use
$protocol = 'http';
// Get server port // Get server port
if ($_SERVER["SERVER_PORT"] == "80") { if ($_SERVER["SERVER_PORT"] == "80") {
$port = ""; $port = "";
} elseif ($_SERVER["SERVER_PORT"] == "443") {
$port = "";
$protocol = 'https';
} else { } else {
$port = ':'.$_SERVER["SERVER_PORT"]; $port = ':'.$_SERVER["SERVER_PORT"];
} }
// Get site URL // Get site URL
$site_url = 'http://'.$_SERVER["SERVER_NAME"].$port.str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']); $site_url = $protocol . '://'.$_SERVER["SERVER_NAME"].$port.str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);
// Replace last slash in site_url // Replace last slash in site_url
$site_url = rtrim($site_url, '/'); $site_url = rtrim($site_url, '/');