routeSQL : allow chain to not be defined
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2045 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
23
routeSQL.php
23
routeSQL.php
@@ -290,7 +290,7 @@ class routeSQL
|
||||
$route->allowSlashes=false;
|
||||
$route->get ("rest/".$this->url_prefix."(\.{extension})?".
|
||||
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
|
||||
function ($extension, $p1, $v1, $p2, $v2, $p3, $v3, $chain)
|
||||
function ($extension, $p1, $v1, $p2, $v2, $p3, $v3, $chain=null)
|
||||
{
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -369,7 +369,7 @@ class routeSQL
|
||||
});
|
||||
|
||||
$route->post ("rest/".$this->url_prefix."(\.{extension})?",
|
||||
function ($extension, $chain)
|
||||
function ($extension, $chain=null)
|
||||
{
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -437,7 +437,7 @@ class routeSQL
|
||||
});
|
||||
|
||||
$route->put ("rest/".$this->url_prefix."(\.{extension})?/{id}",
|
||||
function ($extension, $id, $chain)
|
||||
function ($extension, $id, $chain=null)
|
||||
{
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -503,7 +503,7 @@ class routeSQL
|
||||
});
|
||||
|
||||
$route->delete ("rest/".$this->url_prefix."(\.{extension})?/{id}",
|
||||
function ($extension, $id, $chain)
|
||||
function ($extension, $id, $chain=null)
|
||||
{
|
||||
if ($this->chained !== null)
|
||||
{
|
||||
@@ -573,7 +573,7 @@ class routeSQL
|
||||
$route = new route ();
|
||||
$route->debug = $this->debug;;
|
||||
$route->allowSlashes=false;
|
||||
$route->get ($this->url_prefix."/", function ($chain) use ($route)
|
||||
$route->get ($this->url_prefix."/", function ($chain=null) use ($route)
|
||||
{
|
||||
$route->redirect ("/".str_replace ("{chain}", $chain, $this->url_prefix),
|
||||
"");
|
||||
@@ -581,7 +581,7 @@ class routeSQL
|
||||
|
||||
$route->get ($this->url_prefix.
|
||||
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
|
||||
function ($p1, $v1, $p2, $v2, $p3, $v3, $chain) use ($route)
|
||||
function ($p1, $v1, $p2, $v2, $p3, $v3, $chain=null) use ($route)
|
||||
{
|
||||
// List all the objects of the table
|
||||
if ($this->chained !== null)
|
||||
@@ -851,7 +851,7 @@ class routeSQL
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/{id}/delete/{token}",
|
||||
function ($id, $token, $chain)
|
||||
function ($id, $token, $chain=null)
|
||||
{
|
||||
// Delete an existing object if the token is valid
|
||||
if ($this->chained !== null)
|
||||
@@ -912,7 +912,7 @@ class routeSQL
|
||||
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/add", function ($chain)
|
||||
$route->get ($this->url_prefix."/add", function ($chain=null)
|
||||
{
|
||||
// Add a new entry : form to be filled by the user
|
||||
if ($this->chained !== null)
|
||||
@@ -1025,7 +1025,7 @@ class routeSQL
|
||||
$this->rendererhtml ($content);
|
||||
});
|
||||
|
||||
$route->post ($this->url_prefix."/add", function ($chain) use ($route)
|
||||
$route->post ($this->url_prefix."/add", function ($chain=null) use ($route)
|
||||
{
|
||||
// Add a new entry : effective save of the datas
|
||||
if ($this->chained !== null)
|
||||
@@ -1100,7 +1100,7 @@ class routeSQL
|
||||
|
||||
});
|
||||
|
||||
$route->get ($this->url_prefix."/{id}", function ($id, $chain)
|
||||
$route->get ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
{
|
||||
// List the details of one existing object
|
||||
if ($this->chained !== null)
|
||||
@@ -1221,7 +1221,8 @@ class routeSQL
|
||||
$this->rendererhtml ($content);
|
||||
});
|
||||
|
||||
$route->post ($this->url_prefix."/{id}", function ($id, $chain) use ($route)
|
||||
$route->post ($this->url_prefix."/{id}", function ($id, $chain=null)
|
||||
use ($route)
|
||||
{
|
||||
// Save the details of one existing object
|
||||
if ($this->chained !== null)
|
||||
|
||||
Reference in New Issue
Block a user