diff --git a/admin/choix_annee.php b/admin/choix_annee.php index f63797d..4a95bdb 100644 --- a/admin/choix_annee.php +++ b/admin/choix_annee.php @@ -12,14 +12,13 @@ if ($anneesFiscales[0] < $anneeCourante) { array_unshift($anneesFiscales, $anneeCourante); } -if (f('change')) -{ +$csrf_key = 'acc_select_year'; +$form->runIf('change', function () { $_SESSION['annee_recu'] = f('annee_recu'); - \Paheko\Utils::redirect(f('from') ?: \Paheko\Utils::plugin_url()); -} +}, $csrf_key, PLUGIN_ROOT . '/admin/index.php'); + +$tpl->assign(compact('anneesFiscales', 'csrf_key')); -$tpl->assign('anneesFiscales', $anneesFiscales); $tpl->assign('annee_recu', $_SESSION['annee_recu']); -$tpl->assign('from', qg('from')); $tpl->display(PLUGIN_ROOT . '/templates/choix_annee.tpl'); diff --git a/templates/choix_annee.tpl b/templates/choix_annee.tpl index e834159..796a3b8 100644 --- a/templates/choix_annee.tpl +++ b/templates/choix_annee.tpl @@ -11,8 +11,7 @@

- {csrf_field key="acc_select_year"} - + {csrf_field key=$csrf_key} {button type="submit" name="change" label="Changer" shape="right" class="main"}

diff --git a/templates/index.tpl b/templates/index.tpl index 1f6ca84..d04af70 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -4,7 +4,7 @@