Rename a few classes, fix bugs, fix syntax

This commit is contained in:
osaajani 2019-11-06 20:34:26 +01:00
parent 7cb963b8cf
commit bda1c7ddfd
18 changed files with 106 additions and 37 deletions

View file

@ -108,6 +108,7 @@ namespace controllers\publics;
if (!$this->verify_csrf($csrf))
{
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
@ -118,16 +119,19 @@ namespace controllers\publics;
if (!$name || !$script)
{
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Renseignez au moins un nom et un script.');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
if (!$this->internal_command->create($name, $script, $admin))
{
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Impossible créer cette commande.');
return $this->redirect(\descartes\Router::url('commands', 'add'));
}
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'La commande a bien été crée.');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
@ -144,6 +148,7 @@ namespace controllers\publics;
if (!$this->verify_csrf($csrf))
{
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
@ -157,10 +162,12 @@ namespace controllers\publics;
if ($nb_commands_update !== \count($_POST['commands']))
{
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Certaines commandes n\'ont pas pu êtres mises à jour.');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Toutes les commandes ont été modifiées avec succès.');
return $this->redirect(\descartes\Router::url('Command', 'list'));
}
}