route : relative routes are now relative to site base and not relative to current directory. Due to bad coded crawlers and browser as they don't manage correctely the ../ in front of relative URL.
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5473 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
18
route.php
18
route.php
@@ -127,11 +127,29 @@ class route
|
||||
{
|
||||
// Calculate the root in relative
|
||||
$request = $this->requestURL ();
|
||||
if (substr ($_SERVER["REQUEST_URI"], -1 * strlen ($request)) === $request)
|
||||
{
|
||||
$this->baseURL = substr ($_SERVER["REQUEST_URI"], 0,
|
||||
strlen ($_SERVER["REQUEST_URI"]) - strlen ($request));
|
||||
}
|
||||
elseif ($_SERVER["REQUEST_URI"] !== "")
|
||||
{
|
||||
$this->baseURL = $_SERVER["REQUEST_URI"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->baseURL = "/";
|
||||
}
|
||||
/*
|
||||
// This part was to get really relative to current directory (with ../)
|
||||
// But it is not really well supported by the bad coded crawlers. So, the
|
||||
// URL is now relative to base of URL
|
||||
$this->baseURL = str_repeat ("../",
|
||||
substr_count ($request, "/")).
|
||||
$this->baseURL;
|
||||
if ($this->baseURL === "")
|
||||
$this->baseURL = "./";
|
||||
*/
|
||||
}
|
||||
$this->baseURLmodule = $this->baseURL;
|
||||
// Only != NOT !== (cause : $this->module can be converted in string "0")
|
||||
|
||||
Reference in New Issue
Block a user