Route relative is now relative to the base of the website instead of the current directory

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5626 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-10-31 08:16:41 +00:00
parent 3d45646dd9
commit 7d80c36a51
2 changed files with 14 additions and 10 deletions

View File

@@ -127,7 +127,10 @@ class route
{
// Calculate the root in relative
$request = $this->requestURL ();
if (substr ($_SERVER["REQUEST_URI"], -1 * strlen ($request)) === $request)
if (! isset ($_SERVER["REQUEST_URI"]))
$this->baseURL = "/";
elseif (substr ($_SERVER["REQUEST_URI"], -1 * strlen ($request)) ===
$request)
{
$this->baseURL = substr ($_SERVER["REQUEST_URI"], 0,
strlen ($_SERVER["REQUEST_URI"]) - strlen ($request));
@@ -156,7 +159,8 @@ class route
if ($this->module != FALSE)
{
$this->baseURLmodule = $this->baseURL;
$this->baseURL = dirname ($this->baseURL)."/";
if (dirname ($this->baseURL) !== "/")
$this->baseURL = dirname ($this->baseURL)."/";
}
return $this->baseURL;