route : Correct support of SERVER_PORT
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1500 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
22
route.php
22
route.php
@@ -29,11 +29,19 @@ class route
|
||||
$this->module = $module;
|
||||
if ($this->baseURL !== "")
|
||||
return $this->baseURL;
|
||||
|
||||
if (!isset ($_SERVER["SERVER_PORT"]))
|
||||
$_SERVER["SERVER_PORT"] = 80;
|
||||
$port = ":".$_SERVER["SERVER_PORT"];
|
||||
if (!isset ($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] === 80)
|
||||
$port = "";
|
||||
if (isset ($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] === 443)
|
||||
$port = "";
|
||||
|
||||
if (isset ($_SERVER["SCRIPT_NAME"]))
|
||||
$this->baseURL = dirname ($_SERVER["SCRIPT_NAME"]);
|
||||
if (isset ($_SERVER["SERVER_NAME"]))
|
||||
$this->baseURL = "//".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"]
|
||||
.$this->baseURL;
|
||||
$this->baseURL = "//".$_SERVER["SERVER_NAME"].$port.$this->baseURL;
|
||||
if (isset ($_SERVER["HTTPS"]))
|
||||
$this->baseURL = "https:".$this->baseURL;
|
||||
else
|
||||
@@ -75,8 +83,16 @@ class route
|
||||
$url = "https:";
|
||||
else
|
||||
$url = "http:";
|
||||
if (!isset ($_SERVER["SERVER_PORT"]))
|
||||
$_SERVER["SERVER_PORT"] = 80;
|
||||
$port = ":".$_SERVER["SERVER_PORT"];
|
||||
if (!isset ($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] === 80)
|
||||
$port = "";
|
||||
if (isset ($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] === 443)
|
||||
$port = "";
|
||||
|
||||
if (isset ($_SERVER["SERVER_NAME"]))
|
||||
$url .= "//".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
|
||||
$url .= "//".$_SERVER["SERVER_NAME"].$port;
|
||||
if (isset ($_SERVER["REQUEST_URI"]))
|
||||
$url .= $_SERVER["REQUEST_URI"];
|
||||
return $url;
|
||||
|
||||
Reference in New Issue
Block a user