route : store in session the last valid get page to allow to return with small method : $route->lastValidGetPageRedirect ();
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2703 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
22
route.php
22
route.php
@@ -413,6 +413,9 @@ class route
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = $function ();
|
$data = $function ();
|
||||||
|
if ($this->method () === "GET" && isset ($_SESSION))
|
||||||
|
$_SESSION["domframework"]["route"]["lastGet"] =
|
||||||
|
"/".$this->requestURL ();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
@@ -467,6 +470,9 @@ class route
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = call_user_func_array ($function, $params);
|
$data = call_user_func_array ($function, $params);
|
||||||
|
if ($this->method () === "GET" && isset ($_SESSION))
|
||||||
|
$_SESSION["domframework"]["route"]["lastGet"] =
|
||||||
|
"/".$this->requestURL ();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
@@ -596,4 +602,20 @@ class route
|
|||||||
$output->out ($message, $http->codetext ($getCode));
|
$output->out ($message, $http->codetext ($getCode));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return the last valid get page to return */
|
||||||
|
public function lastValidGetPage ()
|
||||||
|
{
|
||||||
|
if (isset ($_SESSION["domframework"]["route"]["lastGet"]))
|
||||||
|
return $_SESSION["domframework"]["route"]["lastGet"];
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Redirect to last valid get page if defined */
|
||||||
|
public function lastValidGetPageRedirect ()
|
||||||
|
{
|
||||||
|
$lastValidGetPage = $this->lastValidGetPage ();
|
||||||
|
if ($lastValidGetPage !== "")
|
||||||
|
$this->redirect ($lastValidGetPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user