$_SESSION['message'] = "Event rejected."; $f3->reroute("/admin"); }); $f3->route('POST /event/@id/delete', function ($f3) { admin_check(); readonly_check(); Events::delete(intval($f3->get('PARAMS.id'))); echo "Deleted"; }); /***********************/ /**** Posts in bulk ****/ /***********************/ $f3->route('POST /posts/purge', function ($f3) { admin_check(); readonly_check(); Feeds::purge(intval($_POST['months'])); $_SESSION['message'] = "Old posts purged."; $f3->reroute("/admin"); }); /***********************/ /**** Editing posts ****/ /***********************/ $f3->route('GET /post/edit', function ($f3) { admin_check(); readonly_check(); $r = Feeds::$db->exec("SELECT id, title, summary FROM posts WHERE id=:id", [":id" => $_GET['id']]); $r = $r[0]; $f3->set('id', $r['id']); $f3->set('title', $r['title']); $f3->set('summary', $r['summary']); echo Template::instance()->render("post_edit.html");