get((int) qg('id')); if (!$l) { throw new UserException("Cette localisation n'existe pas."); } $csrf_key = 'delete_location_' . $l->id; if (f('delete') && $form->check($csrf_key) && !$form->hasErrors()) { try { $loc->delete($l->id); Utils::redirect(PLUGIN_URL . 'localisations/index.php'); } catch (\RuntimeException $e) { $form->addError($e->getMessage()); } } $cancel_link = PLUGIN_URL . 'localisations/index.php'; $tpl->assign(compact('l', 'csrf_key', 'cancel_link')); $tpl->display(PLUGIN_ROOT . '/templates/localisations/supprimer_localisation.tpl');