Esempio n. 1
0
/**
 * Reads scoreboard filter settings from a cookie and explicit POST of
 * filter settings. Also sets the cookie, so must be called before
 * headers are sent. Returns the scoreboard filter settings array.
 */
function initScorefilter()
{
    $scorefilter = array();
    // Read scoreboard filter options from cookie and explicit POST
    if (isset($_COOKIE['domjudge_scorefilter'])) {
        $scorefilter = json_decode($_COOKIE['domjudge_scorefilter'], TRUE);
    }
    if (isset($_REQUEST['clear'])) {
        $scorefilter = array();
    }
    if (isset($_REQUEST['filter'])) {
        $scorefilter = array();
        foreach (array('affilid', 'country', 'categoryid') as $type) {
            if (!empty($_REQUEST[$type])) {
                $scorefilter[$type] = $_REQUEST[$type];
            }
        }
    }
    dj_setcookie('domjudge_scorefilter', json_encode($scorefilter));
    return $scorefilter;
}
Esempio n. 2
0
function do_logout()
{
    global $DB, $ip, $username, $userdata;
    switch (AUTH_METHOD) {
        case 'PHP_SESSIONS':
        case 'LDAP':
            // Check that a session exists:
            if (session_id() == "") {
                session_start();
            }
            // Unset all of the session variables.
            $_SESSION = array();
            // Also delete the session cookie.
            if (ini_get("session.use_cookies")) {
                $params = session_get_cookie_params();
                dj_setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
            }
            // Finally, destroy the session.
            if (!session_destroy()) {
                error("PHP session not successfully destroyed.");
            }
            break;
        default:
            error("Unknown authentication method '" . AUTH_METHOD . "' requested, or logout not supported.");
    }
    header("Location: http://mee.space/");
    die;
    $title = 'Logout';
    $menu = FALSE;
    auditlog('user', @$userdata['userid'], 'logged out', $ip);
    require LIBWWWDIR . '/header.php';
    echo "<h1>Logged out</h1>\n\n<p>Successfully logged out as user '" . htmlspecialchars($username) . "'.</p>\n" . "<p><a href=\"../\">Click here to return to the main site.</a></p>\n\n";
    require LIBWWWDIR . '/footer.php';
    exit;
}
Esempio n. 3
0
<?php

/**
 * Toggle automatic page refresh.
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
if (empty($_SERVER['HTTP_REFERER'])) {
    die("Missing referrer header.");
}
dj_setcookie('domjudge_refresh', $_REQUEST['enable']);
header('Location: ' . $_SERVER['HTTP_REFERER']);
Esempio n. 4
0
if (isset($_COOKIE['domjudge_submissionview']) && isset($viewtypes[$_COOKIE['domjudge_submissionview']])) {
    $view = $_COOKIE['domjudge_submissionview'];
}
if (isset($_REQUEST['view'])) {
    // did someone press any of the four view buttons?
    foreach ($viewtypes as $i => $name) {
        if (isset($_REQUEST['view'][$i])) {
            $view = $i;
        }
    }
}
require 'init.php';
$refresh = array('after' => 15, 'url' => 'submissions.php?' . urlencode('view[' . $view . ']') . '=' . urlencode($viewtypes[$view]));
$title = 'Submissions';
// Set cookie of submission view type, expiry defaults to end of session.
dj_setcookie('domjudge_submissionview', $view);
$jury_member = $username;
$jqtokeninput = true;
require LIBWWWDIR . '/header.php';
echo "<h1>{$title}</h1>\n\n";
$restrictions = array();
if ($viewtypes[$view] == 'unverified') {
    $restrictions['verified'] = 0;
}
if ($viewtypes[$view] == 'unjudged') {
    $restrictions['judged'] = 0;
}
echo addForm($pagename, 'get') . "<p>Show submissions:\n";
for ($i = 0; $i < count($viewtypes); ++$i) {
    echo addSubmit($viewtypes[$i], 'view[' . $i . ']', null, $view != $i);
}
Esempio n. 5
0
    foreach ($_POST['done'] as $done => $dummy) {
        $DB->q('UPDATE balloon SET done=1 WHERE balloonid = %i', $done);
        auditlog('balloon', $done, 'marked done');
    }
    header('Location: balloons.php');
}
$viewall = TRUE;
// Restore most recent view from cookie (overridden by explicit selection)
if (isset($_COOKIE['domjudge_balloonviewall'])) {
    $viewall = $_COOKIE['domjudge_balloonviewall'];
}
// Did someone press the view button?
if (isset($_REQUEST['viewall'])) {
    $viewall = $_REQUEST['viewall'];
}
dj_setcookie('domjudge_balloonviewall', $viewall);
$refresh = array('after' => 15, 'url' => 'balloons.php');
require LIBWWWDIR . '/header.php';
echo "<h1>Balloon Status</h1>\n\n";
foreach ($cdatas as $cdata) {
    if (isset($cdata['freezetime']) && difftime($cdata['freezetime'], now()) <= 0) {
        echo "<h4>Scoreboard of c{$cdata['cid']} ({$cdata['shortname']}) is now frozen.</h4>\n\n";
    }
}
echo addForm($pagename, 'get') . "<p>\n" . addHidden('viewall', $viewall ? 0 : 1) . addSubmit($viewall ? 'view unsent only' : 'view all') . "</p>\n" . addEndForm();
$contestids = $cids;
if ($cid !== null) {
    $contestids = array($cid);
}
// Problem metadata: colours and names.
if (empty($cids)) {
Esempio n. 6
0
<?php

/**
 * Change current contest
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
if (empty($_SERVER['HTTP_REFERER'])) {
    die("Missing referrer header.");
}
dj_setcookie('domjudge_cid', $_REQUEST['cid']);
header('Location: ' . $_SERVER['HTTP_REFERER']);
Esempio n. 7
0
<?php

/**
 * Toggle sending of HTML5 notifications.
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
if (empty($_SERVER['HTTP_REFERER'])) {
    die("Missing referrer header.");
}
dj_setcookie('domjudge_notify', $_REQUEST['enable']);
header('Location: ' . $_SERVER['HTTP_REFERER']);