php-cs-fixer for all the code

This commit is contained in:
2023-04-13 20:21:34 +02:00
parent eed1fe690d
commit 63b150a493
18 changed files with 279 additions and 278 deletions

View File

@@ -154,19 +154,19 @@ class RouteSQL
switch ($flash[0]) {
case 4:
$dataflash .= "alert-danger";
$alert = dgettext("domframework", "Error!");
$alert = dgettext("domframework", "Error!");
break;
case 3:
$dataflash .= "alert-warning";
$alert = dgettext("domframework", "Warning!");
$alert = dgettext("domframework", "Warning!");
break;
case 2:
$dataflash .= "alert-info";
$alert = dgettext("domframework", "Info:");
$alert = dgettext("domframework", "Info:");
break;
case 1:
$dataflash .= "alert-success";
$alert = dgettext("domframework", "Success:");
$alert = dgettext("domframework", "Success:");
break;
}
$dataflash .= " alert-dismissable'>\n";
@@ -457,7 +457,7 @@ class RouteSQL
$foreignSelect
);
}
// Limiting access to data only to data with read access right
// Limiting access to data only to data with read access right
foreach ($data as $key => $vals) {
if (
$this->accessright(
@@ -783,7 +783,7 @@ class RouteSQL
$this->url_prefix .
"(\?({p1}=({v1})?)(&{p2}=({v2})?(&{p3}=({v3})?)?)?)?",
function ($p1, $v1, $p2, $v2, $p3, $v3, $chain = null) use ($route) {
// List all the objects of the table
// List all the objects of the table
if ($this->chained !== null) {
if (
$this->chained->accessright($this->authHTML["email"], $chain) !==
@@ -841,9 +841,9 @@ class RouteSQL
if (isset($_COOKIE["$cookiePrefix-search"])) {
$search = $_COOKIE["$cookiePrefix-search"];
}
// num is the number of elements displayed by page
// page is the page to display
// Allow the parameters to be sent in any order
// 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;
}
@@ -891,10 +891,10 @@ class RouteSQL
time() + 3600 * 24 * 30,
$this->path
);
//echo "PAGE=$page\n";
//echo "NUM=$num\n";
//echo "SEARCH=$search\n";
//$route->debug=$this->debug;
//echo "PAGE=$page\n";
//echo "NUM=$num\n";
//echo "SEARCH=$search\n";
//$route->debug=$this->debug;
$this->connect();
$csrf = new Csrf();
$token = $csrf->createToken();
@@ -936,7 +936,7 @@ class RouteSQL
$foreignSelect
);
}
// Limiting access to data only to data with read access right
// Limiting access to data only to data with read access right
foreach ($data as $key => $vals) {
if (
$this->accessright(
@@ -948,8 +948,8 @@ class RouteSQL
}
}
// Get the non mandatory foreign keys and display them instead of the
// unusable id
// Get the non mandatory foreign keys and display them instead of the
// unusable id
$foreignData = array();
if (isset($this->objectDB->foreign)) {
foreach ($this->objectDB->foreign as $foreign => $params) {
@@ -976,9 +976,9 @@ class RouteSQL
$associated = array();
$unique = reset($foreignObject->unique);
foreach ($tmpData as $vals) {
// TODO : If $foreignObject->unique is not an array ?
// or multidimensionnal array
$associated[$vals[$column]] = $vals[$unique];
// TODO : If $foreignObject->unique is not an array ?
// or multidimensionnal array
$associated[$vals[$column]] = $vals[$unique];
}
// Add the unique text to the identifier
foreach ($data as $line => $vals) {
@@ -1001,7 +1001,7 @@ class RouteSQL
$route->redirect("/" . str_replace("{chain}", $chain, $this->url_prefix)
. "?page=1&num=$num&search=$search", "");
}
// Push on the last page if the values are too high
// Push on the last page if the values are too high
if ($nbentries > 0 && ($page - 1) * $num > $nbentries) {
$maxPage = intval($nbentries / $num) + 1;
$route->redirect("/" . str_replace("{chain}", $chain, $this->url_prefix) .
@@ -1010,7 +1010,7 @@ class RouteSQL
$content = "";
// Internal CSS
// Internal CSS
if ($this->enableInternalCSS === true) {
$content .= "<style type='text/css' scoped='scoped'>\n";
$content .= ".routeSQL {
@@ -1314,7 +1314,7 @@ class RouteSQL
$route->get(
$this->url_prefix . "/{id}/delete/{token}",
function ($id, $token, $chain = null) {
// Delete an existing object if the token is valid
// Delete an existing object if the token is valid
if ($this->chained !== null) {
if (
$this->chained->editright($this->authHTML["email"], $chain) !==
@@ -1372,10 +1372,10 @@ class RouteSQL
);
}
$this->connect();
$csrf = new Csrf();
$renderer = new Renderer();
$route = new Route();
$this->connect();
$csrf = new Csrf();
$renderer = new Renderer();
$route = new Route();
try {
$csrf->checkToken($token);
$this->objectDB->delete($id);