示例#1
0
文件: index.php 项目: jelek92/echo
    $venue->save();
    $_SESSION['message'] = "Venue added.";
    $f3->reroute("/");
});
/********************************/
/**** Feed display & editing ****/
/********************************/
$f3->route('GET /feeds', function ($f3) {
    admin_check();
    $f3->set('feeds', Feeds::getlist());
    echo Template::instance()->render("admin_feeds.html");
});
$f3->route('POST /feeds/add', function ($f3) {
    admin_check();
    readonly_check();
    if (Feeds::add($_POST['url'])) {
        $_SESSION['message'] = "Feed added.";
    } else {
        $_SESSION['message'] = "Failed to add feed to database.";
    }
    $f3->reroute("/feeds");
});
$f3->route('POST /feeds/edit', function ($f3) {
    global $db;
    admin_check();
    readonly_check();
    for ($i = 1; $i <= count($_POST["feed_url"]); $i++) {
        if (isset($_POST["delete"][$i])) {
            Feeds::delete($_POST["feed_url"][$i]);
        } else {
            Feeds::update($_POST["feed_url"][$i], $_POST["title"][$i], $_POST["site_url"][$i]);