= 1) ? $page : 1; /* PAGE */ /* ---- */ if (!empty($_POST['delete_poll']) && $securityService->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); } $found = $superAdminService->findAllPolls($page-1, POLLS_PER_PAGE); $polls = $found['polls']; $count = $found['count']; // Assign data to template $smarty->assign('polls', $polls); $smarty->assign('count', $count); $smarty->assign('page', $page); $smarty->assign('pages', ceil($count / POLLS_PER_PAGE)); $smarty->assign('poll_to_delete', $poll_to_delete); $smarty->assign('crsf', $securityService->getToken('admin')); $smarty->display('admin/polls.tpl');