routeSQL : Allow to put the parameters in any order

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2002 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-03-11 10:49:30 +00:00
parent 177c6bd1e8
commit a50b19480e

View File

@@ -144,12 +144,17 @@ class routeSQL
$route->redirect ("/".$this->url_prefix, "");
});
$route->get ($this->url_prefix."(\?(page={page})?&?(num={num})?)?",
function ($page, $num) use ($route)
$route->get ($this->url_prefix."(\?({p1}={v1})(&{p2}={v2})?)?",
function ($p1, $v1, $p2, $v2) use ($route)
{
// LIST ALL THE OBJECTS OF THE TABLE
// num is the number of elements displayed by page
// page is the page to display
// Allow the parameters to be sent in any order
if ($p1 === "num") $num = $v1;
if ($p2 === "num") $num = $v2;
if ($p1 === "page") $page = $v1;
if ($p2 === "page") $page = $v2;
$this->connect();
$csrf = new csrf ();
$token = $csrf->createToken ();