mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-06 22:56:27 +02:00
Fix all phpstan and php-cs-fixer errors
This commit is contained in:
parent
117c18ddca
commit
485a0cb6fd
39 changed files with 994 additions and 1142 deletions
|
@ -6,17 +6,17 @@ namespace controllers\publics;
|
|||
*/
|
||||
class Command extends \descartes\Controller
|
||||
{
|
||||
public $bdd;
|
||||
|
||||
private $internal_command;
|
||||
private $internal_event;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$bdd = Model::connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
|
||||
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
|
||||
|
||||
$this->internal_command = new \Controller\internals\Command($bdd);
|
||||
$this->internal_event = new \Controller\internals\Event($bdd);
|
||||
$this->internal_command = new \controllers\internals\Command($bdd);
|
||||
$this->internal_event = new \controllers\internals\Event($bdd);
|
||||
|
||||
\controllers\internals\Tool::verify_connect();
|
||||
\controllers\internals\Tool::verifyconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,18 +36,18 @@ namespace controllers\publics;
|
|||
*/
|
||||
public function delete($csrf)
|
||||
{
|
||||
if (!$this->verifyCSRF($csrf)) {
|
||||
if (!$this->verify_csrf($csrf)) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$ids = $_GET['ids'] ?? [];
|
||||
foreach ($ids as $id) {
|
||||
$this->internalCommand->delete($id);
|
||||
$this->internal_command->delete($id);
|
||||
}
|
||||
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace controllers\publics;
|
|||
global $db;
|
||||
$ids = $_GET['ids'] ?? [];
|
||||
|
||||
$commands = $this->internalCommand->get_by_ids($ids);
|
||||
$commands = $this->internal_command->get_by_ids($ids);
|
||||
|
||||
$this->render('command/edit', array(
|
||||
'commands' => $commands,
|
||||
|
@ -85,9 +85,9 @@ namespace controllers\publics;
|
|||
*/
|
||||
public function create($csrf)
|
||||
{
|
||||
if (!$this->verifyCSRF($csrf)) {
|
||||
if (!$this->verify_csrf($csrf)) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -97,17 +97,17 @@ namespace controllers\publics;
|
|||
|
||||
if (!$name || !$script) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Renseignez au moins un nom et un script.');
|
||||
return header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
return $this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
}
|
||||
|
||||
|
||||
if (!$this->internalCommand->create($name, $script, $admin)) {
|
||||
if (!$this->internal_command->create($name, $script, $admin)) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Impossible créer cette commande.');
|
||||
return header('Location: ' . \descartes\Router::url('commands', 'add'));
|
||||
return $this->redirect(\descartes\Router::url('commands', 'add'));
|
||||
}
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'La commande a bien été crée.');
|
||||
return header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
return $this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,26 +118,26 @@ namespace controllers\publics;
|
|||
*/
|
||||
public function update($csrf)
|
||||
{
|
||||
if (!$this->verifyCSRF($csrf)) {
|
||||
if (!$this->verify_csrf($csrf)) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$nb_commands_update = 0;
|
||||
foreach ($_POST['commands'] as $command) {
|
||||
$update_command = $this->internalCommand->update($command['id'], $command['name'], $command['script'], $command['admin']);
|
||||
$update_command = $this->internal_command->update($command['id'], $command['name'], $command['script'], $command['admin']);
|
||||
$nb_commands_update += (int) $update_command;
|
||||
}
|
||||
|
||||
if ($nb_commands_update != count($_POST['commands'])) {
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Certaines commandes n\'ont pas pu êtres mises à jour.');
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return false;
|
||||
}
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Toutes les commandes ont été modifiées avec succès.');
|
||||
header('Location: ' . \descartes\Router::url('Command', 'list'));
|
||||
$this->redirect(\descartes\Router::url('Command', 'list'));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue