Example #1
0
<?php

require SCRIPTROOT . 'jamstates.php';
$jams = $cache->get('jams_list_jams');
if ($jams == null) {
    $stmt = $dbconnection->prepare('SELECT * FROM jams WHERE status != ? ORDER BY suggestionsbegin DESC;');
    $stmt->execute(array(JamStatus::Disabled));
    $jams = $stmt->fetchAll();
    foreach ($jams as $key => $jam) {
        VerifyJamState($jams[$key]);
    }
    $cache->set('jams_list_jams', $jams, CACHE_TIME);
}
Example #2
0
<?php

require SCRIPTROOT . 'jamstates.php';
$jam = $cache->get('jam_' . $id);
if ($jam == null) {
    $stmt = $dbconnection->prepare('SELECT jams.*, themes.name AS selectedtheme FROM jams LEFT JOIN themes ON themes.id = jams.selectedthemeid WHERE jams.id = ? AND jams.status != ?;');
    $stmt->execute(array($id, JamStatus::Disabled));
    if ($stmt->rowCount() == 0) {
        header('Location: ' . $routes->generate('jams'));
        die;
    } else {
        $jam = $stmt->fetchAll()[0];
        VerifyJamState($jam);
        $stmt = $dbconnection->prepare('SELECT id, name, description FROM categories WHERE jamid = ?;');
        $stmt->execute(array($id));
        $jam['categories'] = $stmt->fetchAll();
        $cache->set('jam_' . $id, $jam, CACHE_TIME);
    }
}