$b = new Blocks(); $block = $b->showBlock($id); $app->render(ADMIN_THEME . 'blocks.edit.php', array('block' => $block, 'method' => 'edit')); }); $app->get('/delete/:id', 'validateUser', function ($id) use($app) { $b = new Blocks(); $b->deleteFromBlock($id); $app->flash('success', 'Block successfully deleted.'); $app->redirect(ADMIN_URL . 'blocks'); }); $app->get('(/(:page))', 'validateUser', function ($page = 1) use($app) { $b = new Blocks(); $start = getPaginationStart($page); $count = $b->countBlockList(); $number_of_pages = ceil($count / LIMIT); $blocks = $b->showBlockList($start, LIMIT); $app->render(ADMIN_THEME . 'blocks.php', array('blocks' => $blocks, 'number_of_pages' => $number_of_pages, 'current_page' => $page, 'page_name' => 'blocks')); }); }); /* * Banlist group * Manage ban list */ $app->group('/ban', function () use($app) { $app->post('/', 'isValidReferrer', 'validateUser', function () use($app) { $ban = new Banlist(); $data = $app->request->post(); $ban->addToList($data['type'], $data['value']); $app->flash('success', "{$data['value']} has been added to the ban list."); $app->redirect(ADMIN_URL . 'ban'); });