route: catch the exception generated by route itself
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3733 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
15
route.php
15
route.php
@@ -240,13 +240,14 @@ class route
|
|||||||
|
|
||||||
// Else http : keep the complete URL
|
// Else http : keep the complete URL
|
||||||
if ($destURL === "")
|
if ($destURL === "")
|
||||||
throw new Exception ("Destination URL is empty", 500);
|
$this->error (new \Exception ("Destination URL is empty", 500));
|
||||||
// Allow to redirect from POST to GET, but not GET to GET (can loop)
|
// Allow to redirect from POST to GET, but not GET to GET (can loop)
|
||||||
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
|
if ($destURL === $requestURL && $_SERVER["REQUEST_METHOD"] === "GET")
|
||||||
throw new Exception ("Redirect to myself", 400);
|
$this->error (new \Exception ("Redirect to myself", 400));
|
||||||
if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL,"/"))
|
if (substr_count ($baseURL, "../") > 1+ substr_count ($destURL,"/"))
|
||||||
throw new Exception ("Can't redirect outside this site (Base $baseURL)",
|
$this->error (new \Exception (
|
||||||
405);
|
"Can't redirect outside this site (Base $baseURL)",
|
||||||
|
405));
|
||||||
|
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
{
|
{
|
||||||
@@ -461,7 +462,7 @@ class route
|
|||||||
$_SESSION["domframework"]["route"]["lastGet"] =
|
$_SESSION["domframework"]["route"]["lastGet"] =
|
||||||
"/".$this->requestURL ();
|
"/".$this->requestURL ();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$this->error ($e);
|
$this->error ($e);
|
||||||
}
|
}
|
||||||
@@ -517,7 +518,7 @@ class route
|
|||||||
$_SESSION["domframework"]["route"]["lastGet"] =
|
$_SESSION["domframework"]["route"]["lastGet"] =
|
||||||
"/".$this->requestURL ();
|
"/".$this->requestURL ();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$this->error ($e);
|
$this->error ($e);
|
||||||
}
|
}
|
||||||
@@ -573,7 +574,7 @@ class route
|
|||||||
$message .= "<p>The Exception code was 0 and converted to 500</p>\n";
|
$message .= "<p>The Exception code was 0 and converted to 500</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
// If there is an error with the ratelimiter (file not writeable...),
|
// If there is an error with the ratelimiter (file not writeable...),
|
||||||
// overload the Exception
|
// overload the Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user