Esempio n. 1
0
        $f3->reroute("/");
        die;
    }
}
/********************/
/**** Front page ****/
/********************/
$f3->route('GET /', function ($f3) {
    admin_check(FALSE);
    /* Events */
    $where = "(startdt >= date('now', 'start of day') OR date('now') <= enddt) AND state == 'approved'";
    $limit = "0,10";
    $f3->set('events', Events::load($where, $limit));
    /* Posts */
    $where = "hidden IS NOT 1 AND date >= date('now', '-3 months') AND ( " . "SELECT COUNT(p2.feed_id) FROM post_info AS p2 " . "WHERE p2.feed_id = post_info.feed_id AND p2.date > post_info.date " . ") == 0 ORDER BY date DESC";
    $f3->set('posts', Feeds::load($where));
    echo Template::instance()->render("index.html");
});
/* XXX need to work out a better way to do this that is generic, no time now though */
/* maybe a var 'passthrough' in the ini which just makes pages listed in it serve up <page>.html */
$f3->route('GET /about', function ($f3) {
    echo Template::instance()->render("about.html");
});
/***************************/
/**** Displaying events ****/
/***************************/
function event_page($f3, $events, $calendar = FALSE)
{
    /* Check for what kind of listing we want */
    if (isset($_GET['calendar'])) {
        $_SESSION['calendar'] = true;