Fixed Nice URL test for servers not running on port 80.

HTTP_HOST will contain the full host name used to access the site, including
the optional port number. However, on some misconfigured servers, HTTP_HOST
will not be defined, in which case the script will attempt to reconstruct the
host name from SERVER_NAME, and if necessary, SERVER_PORT.
This commit is contained in:
Justin Brewer 2011-07-27 22:38:02 -05:00
parent c05cb0d54e
commit 98e170cd86

View File

@ -216,7 +216,15 @@ class Setup extends SimpleExtension {
$themes[$human] = $name; $themes[$human] = $name;
} }
$full = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]; if(isset($_SERVER["HTTP_HOST"])) {
$host = $_SERVER["HTTP_HOST"];
} else {
$host = $_SERVER["SERVER_NAME"];
if($_SERVER["SERVER_PORT"] != "80") {
$host .= ":" . $_SERVER["SERVER_PORT"];
}
}
$full = "http://" . $host . $_SERVER["PHP_SELF"];
$test_url = str_replace("/index.php", "/nicetest", $full); $test_url = str_replace("/index.php", "/nicetest", $full);
$nicescript = "<script language='javascript'> $nicescript = "<script language='javascript'>