checkCsrf('admin', $_POST['csrf'])) { $delete_id = filter_input(INPUT_POST, 'delete_poll', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); $poll_to_delete = $pollService->findById($delete_id); } // Traitement de la confirmation de suppression if (!empty($_POST['delete_confirm']) && $securityService->checkCsrf('admin', $_POST['csrf'])) { $poll_id = filter_input(INPUT_POST, 'delete_confirm', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]); $adminPollService->deleteEntirePoll($poll_id); } $polls = $superAdminService->findAllPolls(); // Assign data to template $smarty->assign('polls', $polls); $smarty->assign('poll_to_delete', $poll_to_delete); $smarty->assign('log_file', is_readable('../' . LOG_FILE) ? LOG_FILE : null); $smarty->assign('crsf', $securityService->getToken('admin')); $smarty->display('admin/polls.tpl');