Exemple #1
0
** CONTEST PORTAL v3 
** Created By Andy Sturzu (sturzu.org)
*/
require_once dirname(__FILE__) . '/app/config/config.php';
require_once dirname(__FILE__) . '/app/frameworks/panel.php';
require_once dirname(__FILE__) . '/app/functions/functions.php';
session_start();
session_regenerate_id();
date_default_timezone_set('America/Chicago');
$panel = new Panel('panel', false, 'logs/' . date('Y-m-d') . '.txt');
//include default routing engine with logs enabled
$panel->route('/', function ($panel) {
    //index router, check for login
    $schools = json_decode(file_get_contents(dirname(__FILE__) . "/app/config/schools.json"), true);
    if (!isLoggedIn()) {
        return $panel->render("login.html", ["title" => title, "contest_name" => contest_name, "schools" => $schools]);
    }
    return $panel->render("home.html", ["title" => title, "contest_name" => contest_name, "t" => $_SESSION['team'], "navbar_title" => navbar_title, "written" => getTeamWritten(), "info" => getTeamInfo(), "pizza_ordered" => hasOrderedPizza($_SESSION['team'])]);
});
$panel->route('/scoreboard', function ($panel) {
    $schools = json_decode(file_get_contents(dirname(__FILE__) . "/app/config/schools.json"), true);
    if (!isLoggedIn()) {
        return $panel->render("login.html", ["title" => title, "contest_name" => contest_name, "schools" => $schools]);
    }
    return $panel->render("scoreboard.html", ["title" => title, "contest_name" => contest_name]);
});
$panel->route('/admin', function ($panel) {
    if (adminIsLoggedIn()) {
        return $panel->render("admin.html", []);
    }
    return $panel->render("adminlogin.html", []);