Example #1
0
echo "<tr><td>Reason:</td><td>";
if (empty($rejdata['reason'])) {
    echo '<span class="nodata">none</span>';
} else {
    echo specialchars($rejdata['reason']);
}
echo "</td></tr>\n";
foreach (array('userid_start' => 'Issued by', 'userid_finish' => ($rejdata['valid'] ? 'Accepted' : 'Canceled') . ' by') as $user => $msg) {
    if (isset($rejdata[$user])) {
        echo "<tr><td>{$msg}:</td><td>" . '<a href="user.php?id=' . urlencode($rejdata[$user]) . '">' . specialchars($userdata[$rejdata[$user]]) . "</a></td></tr>\n";
    }
}
foreach (array('starttime' => 'Start time', 'endtime' => 'Apply time') as $time => $msg) {
    echo "<tr><td>{$msg}:</td><td>";
    if (isset($rejdata[$time])) {
        echo printtime($rejdata[$time]);
    } else {
        echo '<span class="nodata">-</span>';
    }
    echo "</td></tr>\n";
}
if ($todo > 0) {
    echo "<tr><td>Queued:</td><td>{$todo} unfinished judgings</td>\n";
}
echo "</table>\n\n";
if (!isset($rejdata['endtime'])) {
    echo addForm($pagename . '?id=' . urlencode($id)) . addSubmit('cancel rejudging', 'cancel') . addEndForm();
    if ($todo == 0) {
        echo addForm($pagename . '?id=' . urlencode($id)) . addSubmit('apply rejudging', 'apply') . addEndForm();
    }
}
Example #2
0
	               result, verified, valid FROM judging
	               WHERE cid IN (%Ai) AND judgehost = %s
	               ORDER BY starttime DESC, judgingid DESC', $cids, $row['hostname']);
}
if (empty($cids) || $res->count() == 0) {
    echo "<p class=\"nodata\">No judgings.</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">ID</th><th " . "scope=\"col\">started</th><th scope=\"col\">runtime</th><th " . "scope=\"col\">result</th><th scope=\"col\">valid</th><th " . "scope=\"col\">verified</th></tr>\n</thead>\n<tbody>\n";
    while ($jud = $res->next()) {
        if (empty($jud['endtime'])) {
            if ($jud['valid']) {
                $runtime = printtimediff($jud['starttime'], NULL);
            } else {
                $runtime = '[aborted]';
            }
        } else {
            $runtime = printtimediff($jud['starttime'], $jud['endtime']);
        }
        $link = ' href="submission.php?id=' . (int) $jud['submitid'] . '&amp;jid=' . (int) $jud['judgingid'] . '"';
        echo '<tr' . ($jud['valid'] ? '' : ' class="disabled"') . '>';
        echo "<td><a{$link}>j" . (int) $jud['judgingid'] . '</a></td>';
        echo "<td><a{$link}>" . printtime($jud['starttime']) . '</a></td>';
        echo "<td><a{$link}>" . $runtime . '</a></td>';
        echo "<td><a{$link}>" . printresult(@$jud['result'], $jud['valid']) . '</a></td>';
        echo "<td class=\"tdcenter\"><a{$link}>" . printyn($jud['valid']) . '</a></td>';
        echo "<td class=\"tdcenter\"><a{$link}>" . printyn($jud['verified']) . '</a></td>';
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
Example #3
0
}
?>

<table>
<tr><td>Problem:</td>
	<td><span class="probid"><?php 
echo htmlspecialchars($row['shortname']);
?>
</span> -
    <?php 
echo htmlspecialchars($row['probname']);
?>
</td></tr>
<tr><td>Submitted:</td>
	<td><?php 
echo printtime($row['submittime']);
?>
</td></tr>
<tr><td>Language:</td>
	<td><?php 
echo htmlspecialchars($row['langname']);
?>
</td></tr>
</table>

<p>Result: <?php 
echo printresult($row['result'], TRUE);
?>
</p>
<?php 
$show_compile = dbconfig_get('show_compile', 2);
Example #4
0
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th>" . "<th scope=\"col\">reason</th>" . "<th scope=\"col\">startuser</th>" . "<th scope=\"col\">finishuser</th>" . "<th scope=\"col\">starttime</th>" . "<th scope=\"col\">endtime</th>" . "<th scope=\"col\">status</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $todo = $DB->q('VALUE SELECT COUNT(*) FROM submission
		                WHERE rejudgingid=%i', $row['rejudgingid']);
        $done = $DB->q('VALUE SELECT COUNT(*) FROM judging
		                WHERE rejudgingid=%i AND endtime IS NOT NULL', $row['rejudgingid']);
        $todo -= $done;
        $link = '<a href="rejudging.php?id=' . urlencode($row['rejudgingid']) . '">';
        $class = '';
        if (isset($row['endtime'])) {
            $class = 'class="disabled"';
        } else {
            $class = $todo > 0 ? '' : 'class="unseen"';
        }
        echo "<tr {$class}>" . "<td>" . $link . $row['rejudgingid'] . '</a></td>' . "<td>" . $link . htmlspecialchars($row['reason']) . '</a></td>' . "<td>" . $link . htmlspecialchars($row['startuser']) . "</a></td>" . "<td>" . $link . htmlspecialchars($row['finishuser']) . "</a></td>" . "<td>" . $link . printtime($row['starttime']) . "</a></td>" . "<td>" . $link . printtime($row['endtime']) . "</a></td>" . "<td>" . $link;
        if (isset($row['endtime'])) {
            echo $row['valid'] ? 'applied' : 'canceled';
        } else {
            if ($todo > 0) {
                $perc = (int) (100 * ((double) $done / (double) ($done + $todo)));
                echo "{$perc}% done";
            } else {
                echo 'ready';
            }
        }
        echo "</a></td></tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
Example #5
0
}
echo " | ";
if ($res->count() == 1 + PAGEMAX) {
    echo "<a href=\"?start=" . ($start + PAGEMAX) . "\">next page</a>";
} else {
    echo "<span class=\"nodata\">next page</span>";
}
echo "</p>";
if ($res->count() == 0) {
    echo '<p class="nodata">No entries</p>';
    require LIBWWWDIR . '/footer.php';
    exit;
}
echo "<table class=\"list sortable\">\n" . "<thead><tr><th>id</th><th>when</th><th class=\"sorttable_numeric\">cid</th>" . "<th>who</th><th colspan=\"3\">what</th><th>extra info</th></tr></thead>\n<tbody>\n";
while ($logline = $res->next()) {
    echo "<tr><td>" . specialchars($logline['logid']) . "</td>" . "<td title=\"" . specialchars(printtime($logline['logtime'], "%Y-%m-%d %H:%M:%S (%Z)")) . "\">" . printtime($logline['logtime']) . "</td><td>" . (empty($logline['cid']) ? '' : 'c' . $logline['cid']) . "</td><td>" . specialchars($logline['user']) . "</td><td>" . specialchars($logline['datatype']) . "</td><td>";
    // First define defaults, allow to override afterwards:
    $link = urlencode($logline['datatype']) . '.php?id=' . urlencode($logline['dataid']);
    $name = specialchars($logline['dataid']);
    switch ($logline['datatype']) {
        case 'balloon':
            $link = NULL;
            $name = 'b' . $name;
            break;
        case 'contest':
            $name = 'c' . $name;
            break;
        case 'judging':
            $link = 'submission.php?jid=' . urlencode($logline['dataid']);
            $name = 'j' . $name;
            break;
Example #6
0
require LIBWWWDIR . '/header.php';
echo "<h1>Users</h1>\n\n";
if ($users->count() == 0) {
    echo "<p class=\"nodata\">No users defined</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">username</th><th scope=\"col\">name</th>" . "<th scope=\"col\">email</th><th scope=\"col\">roles</th>" . "<th scope=\"col\">team</th>" . "<th class=\"thleft\" scope=\"col\">status</th><th></th>" . "</tr>\n</thead>\n<tbody>\n";
    while ($row = $users->next()) {
        $status = 0;
        if (isset($row['last_login'])) {
            $status = 1;
        }
        $link = '<a href="user.php?id=' . urlencode($row['userid']) . '">';
        echo "<tr class=\"" . ($row['enabled'] == 1 ? '' : 'sub_ignore') . "\">" . "<td class=\"username\">" . $link . specialchars($row['username']) . "</a></td>" . "<td>" . $link . specialchars($row['name']) . "</a></td>" . "<td>" . $link . (isset($row['email']) ? specialchars($row['email']) : '&nbsp;') . "</a></td>" . "<td>" . $link . specialchars($row['roles']) . "</a></td>" . "<td>" . $link . (isset($row['teamid']) ? "t" . specialchars($row['teamid']) : '&nbsp;') . "</a></td>";
        echo "<td sorttable_customkey=\"" . $status . "\" class=\"";
        if ($status == 1) {
            echo 'team-ok" title="logged in: ' . printtime($row['last_login']) . '"';
        } else {
            echo 'team-nocon" title="no connections made"';
        }
        echo ">{$link}" . CIRCLE_SYM . "</a></td>";
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('user', $row['userid']) . "&nbsp;" . delLink('user', 'userid', $row['userid'], $row['name']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('user') . "</p>\n";
}
require LIBWWWDIR . '/footer.php';
Example #7
0
    echo "No roles assigned";
} else {
    while ($role = $roles->next()) {
        echo "{$role['role']} - {$role['description']}<br>";
    }
}
?>
</td></tr>
<tr><td>Team:</td><?php 
if ($row['teamid']) {
    echo "<td class=\"teamid\"><a href=\"team.php?id=" . urlencode($row['teamid']) . "\">" . htmlspecialchars($row['teamname'] . " (t" . $row['teamid'] . ")") . "</a></td>";
} else {
    echo "<td>-</td>";
}
?>
</tr>
<tr><td>Last login:</td><td><?php 
echo printtime($row['last_login'], '%a %d %b %Y %T %Z');
?>
</td></tr>
<tr><td>Last IP:   </td><td><?php 
echo @$row['ip_address'] ? printhost($row['ip_address'], TRUE) : '';
?>
</td></tr>
</table></div>

<?php 
if (IS_ADMIN) {
    echo "<p class=\"nomorecol\">" . editLink('user', $id) . "\n" . delLink('user', 'userid', $id) . "</p>\n\n";
}
require LIBWWWDIR . '/footer.php';
Example #8
0
$movies = getmovies("biercam", $from, $to);
$nav = "<a href='?from=" . ($from - $step) . "&to=" . ($to - $step) . "'>Eerder</a> ";
if ($from + $step < time()) {
    $nav .= "<a href='?from=" . ($from + $step) . "&to=" . ($to + $step) . "'>Later</a>";
}
$nav .= " <a href='?'>Nu</a>";
$nav .= " <a href='view.php?url=mms://lounge.datux.nl:9192&desc=Biercam Live stream 1'>Livestream 1</a>";
$nav .= " <a href='view.php?url=mmsh://lounge.datux.nl:9192&desc=Biercam Live stream 2'>Livestream 2</a>";
$nav .= " <a href='view.php?url=http://lounge.datux.nl:9192&desc=Biercam Live stream 3'>Livestream 3</a>";
//print navigation
echo "{$nav}";
//print the grand movie table
foreach ($movies as $movie => $thumbs) {
    echo "<h1>";
    $time = movie2timestamp($movie);
    printtime($time);
    echo "</h1>";
    echo "<table>";
    $nr = 0;
    echo "<tr>";
    foreach ($thumbs as $thumb) {
        echo "<td id=thumb>";
        echo "<image src='{$thumb}'><br>";
        $thumbtime = filectime($thumb);
        echo date("G:i", $thumbtime);
        $nr++;
        if ($nr == 5) {
            $nr = 0;
            echo "</tr><tr>";
        }
    }
Example #9
0
    $TOTAL_BALLOONS[$row['teamid']][] = $row['probid'];
    // keep overwriting these variables - in the end they'll
    // contain the id's of the first balloon in each type
    $first_contest[$row['cid']] = $first_problem[$row['probid']] = $first_team[$row['teamid']] = $row['balloonid'];
}
if (!empty($BALLOONS)) {
    echo addForm($pagename);
    echo "<table class=\"list sortable balloons\">\n<thead>\n" . "<tr><th class=\"sorttable_numeric\">ID</th>" . "<th>time</th>" . (count($contestids) > 1 ? "<th>contest</th>" : "") . "<th>solved</th><th>team</th>" . "<th></th><th>loc.</th><th>category</th><th>total</th>" . "<th></th><th></th></tr>\n</thead>\n";
    foreach ($BALLOONS as $row) {
        if (!$viewall && $row['done'] == 1) {
            continue;
        }
        // start a new row, 'disable' if balloon has been handed out already
        echo '<tr' . ($row['done'] == 1 ? ' class="disabled"' : '') . '>';
        echo '<td>b' . (int) $row['balloonid'] . '</td>';
        echo '<td>' . printtime($row['submittime']) . '</td>';
        if (count($contestids) > 1) {
            // contest of this problem, only when more than one active
            echo '<td>' . specialchars($row['shortname']) . '</td>';
        }
        // the balloon earned
        echo '<td class="probid">' . '<div class="circle" style="background-color: ' . specialchars($probs_data[$row['probid']]['color']) . ';"></div> ' . specialchars($row['probshortname']) . '</td>';
        // team name, location (room) and category
        echo '<td>t' . specialchars($row['teamid']) . '</td><td>' . specialchars($row['teamname']) . '</td><td>' . specialchars($row['room']) . '</td><td>' . specialchars($row['catname']) . '</td><td>';
        // list of balloons for this team
        sort($TOTAL_BALLOONS[$row['teamid']]);
        $TOTAL_BALLOONS[$row['teamid']] = array_unique($TOTAL_BALLOONS[$row['teamid']]);
        foreach ($TOTAL_BALLOONS[$row['teamid']] as $prob_solved) {
            echo '<div title="' . specialchars($prob_solved) . '" class="circle" style="background-color: ' . specialchars($probs_data[$prob_solved]['color']) . ';"></div> ';
        }
        echo '</td><td>';
Example #10
0
if (!isset($NOTIFCOMMENT[0]) || empty($NOTIFCOMMENT[0])) {
    $NOTIFCOMMENT[0] = "N/A";
}
if (!isset($NOTIFCOMMENT[1])) {
    $NOTIFCOMMENT[1] = "N/A";
}
if (!isset($COMMENT[0]) || empty($COMMENT[0])) {
    $COMMENT[0] = "N/A";
    $NOCOMMENT = 1;
} else {
    $NOCOMMENT = 0;
}
if (!isset($COMMENT[1])) {
    $COMMENT[1] = "N/A";
}
$STATUSDATA = array('curstat' => "<div class='" . $COLOR . "'>" . $STATUS . " (" . printtime($LASTCHANGEDIFF) . ")" . "</div>", 'outputstatus' => $OUTPUT, 'checkstatus' => $CURATTEMP . "/" . $MAXATTEMP . " | " . $NORMALINTERVAL . "m/" . $RETRYINTERVAL . "m | " . printtime($LASTCHECKTIMEDIFF), 'lastok' => substr($LASTTIMEOK, 0, 4) == "1970" || $STATUS == "OK" ? "N/A" : $LASTTIMEOK . " (" . printtime($LASTTIMEOKDIFF) . ")", 'nextcheck' => printtime($NEXTCHECKTIMEDIFF) < 0 ? "N/A" : $NEXTCHECKTIME . " (" . printtime($NEXTCHECKTIMEDIFF) . ")", 'checkinfo' => $CHKTYPE . ", A={$st_data['ACTIVE']}, P={$st_data['PASSIVE']} | " . $CHECKNAME, 'checktime' => $LATENCY . " | " . $EXEC_TIME, 'laststatus' => printtime($LASTCHANGEDIFF) . " | " . printtime($UPDATETIMEDIFF), 'flapping' => $FLAPPING . " " . ($st_data['FLAPPING'] != 2 ? "(" . $PERCENT . "% " . _('state_change') . ")" : ""), 'groupstatus' => $GROUPS . " | " . $CONTACTGROUP, 'notifystatus' => ($COUNTNOTIFY == 0 ? "N/A (0)" : $LASTNOTIFY . " (" . $COUNTNOTIFY . ") ") . " | " . ($NEXTTIMENOTIFYDIFF <= 0 ? "N/A" : printtime($NEXTTIMENOTIFYDIFF)), $ACK && count($ACKCOMMENT) > 1 ? 'ackcur' : 'noackcur' => $ACKCOMMENT[1], $DOWNTIME && count($DOWNCOMMENT) > 2 ? 'downcur' : 'nodowncur' => $DOWNCOMMENT[2] . " (" . _('end') . " " . $DOWNCOMMENT[1] . ")", !$NOTIF && count($NOTIFCOMMENT) > 1 ? 'notifycur' : 'nonotifycur' => $NOTIFCOMMENT[1], $NOCOMMENT == 0 ? 'commentcur' : 'nocommentcur' => $COMMENT[1]);
/* Open gitory popup */
if (count($_SESSION['HISTORY'])) {
    $STATUSDATA['linkhistory'] = "<a href=\"#\" onClick=\"return pop('history.php?id={$id}&type={$type}&host={$HOSTNAME}&svc={$SERVICE}', '{$id}', '{$HISTORY_POPUP_WIDTH}', '{$HISTORY_POPUP_HEIGHT}');\">" . ucfirst(_('show_history')) . "</a>";
}
/* Custom variables */
/* The $cvar array is only used to build the $variables array which
 * contains the final list of key/value custom variables. Precedence
 * is given to variables defined on the service if also present on
 * the host.
 *
 * Values of custom variables can make reference to other custom
 * variables using the syntax ${_OTHER_VARIABLE}. Values can also
 * reference special properties of the $other_variables array with
 * the same syntax.
 *
Example #11
0
/**
 * Print a list of clarifications in a table with links to the clarifications.
 */
function putClarificationList($clars, $team = NULL)
{
    global $username, $cids;
    if ($team == NULL && !IS_JURY) {
        error("access denied to clarifications: you seem to be team nor jury");
    }
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\">ID</th>" : "") . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\">contest</th>" : "") . "<th scope=\"col\">time</th>" . "<th scope=\"col\">from</th>" . "<th scope=\"col\">to</th><th scope=\"col\">subject</th>" . "<th scope=\"col\">text</th>" . (IS_JURY ? "<th scope=\"col\">answered</th><th scope=\"col\">by</th>" : "") . "</tr>\n</thead>\n<tbody>\n";
    while ($clar = $clars->next()) {
        // check viewing permission for teams
        if (!IS_JURY && !canViewClarification($team, $clar)) {
            continue;
        }
        $clar['clarid'] = (int) $clar['clarid'];
        $link = '<a href="clarification.php?id=' . urlencode($clar['clarid']) . '">';
        if (isset($clar['unread'])) {
            echo '<tr class="unread">';
        } else {
            echo '<tr>';
        }
        if (IS_JURY) {
            echo '<td>' . $link . $clar['clarid'] . '</a></td>';
        }
        echo IS_JURY && count($cids) > 1 ? '<td>' . $link . $clar['contestshortname'] . '</a></td>' : '';
        echo '<td>' . $link . printtime($clar['submittime']) . '</a></td>';
        if ($clar['sender'] == NULL) {
            $sender = 'Jury';
            if ($clar['recipient'] == NULL) {
                $recipient = 'All';
            } else {
                $recipient = htmlspecialchars($clar['toname']);
            }
        } else {
            $sender = htmlspecialchars($clar['fromname']);
            $recipient = 'Jury';
        }
        echo '<td>' . $link . $sender . '</a></td>' . '<td>' . $link . $recipient . '</a></td>';
        echo '<td>' . $link;
        if (is_null($clar['probid'])) {
            echo "general";
        } else {
            echo "problem " . $clar['shortname'];
        }
        echo "</a></td>";
        echo '<td class="clartext">' . $link . summarizeClarification($clar['body']) . "</a></td>";
        if (IS_JURY) {
            unset($answered, $jury_member);
            $claim = FALSE;
            $answered = printyn($clar['answered']);
            if (empty($clar['jury_member'])) {
                $jury_member = '&nbsp;';
            } else {
                $jury_member = htmlspecialchars($clar['jury_member']);
            }
            if (!$clar['answered']) {
                if (empty($clar['jury_member'])) {
                    $claim = TRUE;
                } else {
                    $answered = 'claimed';
                }
            }
            echo "<td>{$link} {$answered}</a></td><td>";
            if ($claim && isset($clar['sender'])) {
                echo "<a class=\"button\" href=\"clarification.php?claim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">claim</a>";
            } else {
                if (!$clar['answered'] && $jury_member == $username) {
                    echo "<a class=\"button\" href=\"clarification.php?unclaim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">unclaim</a>";
                } else {
                    echo "{$link} {$jury_member}</a>";
                }
            }
            echo "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
Example #12
0
/**
 * Print a list of submissions from contests contained in the $cdatas
 * contest data array, either all or only those that match
 * <key> [= <value>] pairs specified in $restrictions:
 *  - 'verified'  if set, only list submissions that are verified
 *  - 'judged'    if set, only list submissions with completed judgings
 *  - 'teamid', 'probid', 'langid', 'categoryid', 'judgehost' can be
 *    set to an ID to filter on that respective team, language, etc.
 * Output is limited to the number $limit, or unlimited by default.
 * If $highlight is a submission ID, then that one is highlighted.
 */
function putSubmissions($cdatas, $restrictions, $limit = 0, $highlight = null)
{
    global $DB, $username;
    /* We need two kind of queries: one for all submissions, and one
     * with the results for the valid ones.
     */
    $cids = array_keys($cdatas);
    $verifyclause = '';
    if (isset($restrictions['verified'])) {
        if ($restrictions['verified']) {
            $verifyclause = 'AND (j.verified = 1) ';
        } else {
            $verifyclause = 'AND (j.verified = 0 OR (j.verified IS NULL AND s.judgehost IS NULL)) ';
        }
    }
    $judgedclause = '';
    if (isset($restrictions['judged'])) {
        if ($restrictions['judged']) {
            $judgedclause = 'AND (j.result IS NOT NULL) ';
        } else {
            $judgedclause = 'AND (j.result IS NULL) ';
        }
    }
    $rejudgingclause = '';
    if (isset($restrictions['rejudgingdiff'])) {
        if ($restrictions['rejudgingdiff']) {
            $rejudgingclause = 'AND (j.result != jold.result) ';
        } else {
            $rejudgingclause = 'AND (j.result = jold.result) ';
        }
    }
    if (isset($restrictions['old_result']) && !isset($restrictions['rejudgingid'])) {
        error('cannot specify restriction on old_result without specifying a rejudgingid');
    }
    // Special case the rejudgingid restriction by showing the
    // corresponding judging and the old (active) judging result:
    $sqlbody = 'FROM submission s
	     LEFT JOIN team           t  USING (teamid)
	     LEFT JOIN problem        p  USING (probid)
	     LEFT JOIN contestproblem cp USING (probid, cid)
	     LEFT JOIN language       l  USING (langid) ' . (isset($restrictions['rejudgingid']) ? 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.rejudgingid = %i)
	     LEFT JOIN judging        jold ON (j.prevjudgingid IS NULL AND s.submitid = jold.submitid AND jold.valid = 1 OR j.prevjudgingid = jold.judgingid) ' : 'LEFT JOIN judging        j    ON (s.submitid = j.submitid    AND j.valid = 1) %_ ') . 'WHERE s.cid IN (%Ai) ' . $verifyclause . $judgedclause . $rejudgingclause . (isset($restrictions['teamid']) ? 'AND s.teamid = %i ' : '%_ ') . (isset($restrictions['categoryid']) ? 'AND t.categoryid = %i ' : '%_ ') . (isset($restrictions['probid']) ? 'AND s.probid = %i ' : '%_ ') . (isset($restrictions['langid']) ? 'AND s.langid = %s ' : '%_ ') . (isset($restrictions['judgehost']) ? 'AND s.judgehost = %s ' : '%_ ') . (isset($restrictions['rejudgingid']) ? 'AND (s.rejudgingid = %i OR ' . '     j.rejudgingid = %i) ' : '%_ %_ ') . (isset($restrictions['old_result']) ? 'AND jold.result = %s ' : '%_ ') . (isset($restrictions['result']) ? 'AND j.result = %s ' : '%_ ');
    // No contests; automatically nothing found and the query can not be run...
    if (empty($cids)) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    $res = $DB->q('SELECT s.submitid, s.teamid, s.probid, s.langid, s.cid,
	               s.submittime, s.judgehost, s.valid, t.name AS teamname,
	               cp.shortname, p.name AS probname, l.name AS langname,
	               j.result, j.judgehost, j.verified, j.jury_member, j.seen ' . (isset($restrictions['rejudgingid']) ? ', jold.result AS oldresult ' : '') . $sqlbody . 'ORDER BY s.submittime DESC, s.submitid DESC ' . ($limit > 0 ? 'LIMIT 0, %i' : '%_'), @$restrictions['rejudgingid'], $cids, @$restrictions['teamid'], @$restrictions['categoryid'], @$restrictions['probid'], @$restrictions['langid'], @$restrictions['judgehost'], @$restrictions['rejudgingid'], @$restrictions['rejudgingid'], @$restrictions['old_result'], @$restrictions['result'], $limit);
    // nothing found...
    if ($res->count() == 0) {
        echo "<p class=\"nodata\">No submissions</p>\n\n";
        return;
    }
    if (IS_JURY) {
        echo addForm('submission.php');
    }
    // print the table with the submissions.
    // table header
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\" class=\"sorttable_numeric\">ID</th>" : '') . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\" class=\"sorttable_numeric\">contest</th>" : '') . "<th scope=\"col\">time</th>" . (IS_JURY ? "<th scope=\"col\">team</th>" : '') . "<th scope=\"col\">problem</th>" . "<th scope=\"col\">lang</th>" . "<th scope=\"col\">result</th>" . (IS_JURY ? "<th scope=\"col\">verified</th><th scope=\"col\">by</th>" : '') . (IS_JURY && isset($restrictions['rejudgingid']) ? "<th scope=\"col\">old result</th>" : '') . "</tr>\n</thead>\n<tbody>\n";
    // print each row with links to detailed information
    $iseven = $subcnt = $corcnt = $igncnt = $vercnt = $quecnt = 0;
    while ($row = $res->next()) {
        $sid = (int) $row['submitid'];
        // always provide link if this is Jury. For team, provide link
        // to a different page, provided that the result is actually
        // present and valid.
        if (IS_JURY) {
            // If rejudging list, link to the new rejudging:
            $linkurl = 'submission.php?id=' . $sid . (isset($restrictions['rejudgingid']) ? '&amp;rejudgingid=' . $restrictions['rejudgingid'] : '');
            $link = ' href="' . $linkurl . '"';
        } elseif ($row['submittime'] < $cdatas[$row['cid']]['endtime'] && $row['result'] && $row['valid'] && (!dbconfig_get('verification_required', 0) || $row['verified'])) {
            $link = ' href="submission_details.php?id=' . $sid . '"';
        } else {
            $link = '';
        }
        echo "<tr class=\"" . ($iseven ? 'roweven' : 'rowodd');
        $iseven = !$iseven;
        if ($row['valid']) {
            $subcnt++;
        } else {
            $igncnt++;
            echo ' sub_ignore';
        }
        if ($sid == $highlight) {
            echo ' highlight';
        }
        if (!IS_JURY && !$row['seen']) {
            echo ' unseen';
        }
        echo '">';
        if (IS_JURY) {
            echo "<td><a{$link}>s{$sid}</a></td>";
        }
        if (IS_JURY && count($cids) > 1) {
            echo "<td><a{$link}>c{$row['cid']}</a></td>";
        }
        echo "<td><a{$link}>" . printtime($row['submittime']) . "</a></td>";
        if (IS_JURY) {
            echo '<td title="t' . htmlspecialchars($row['teamid']) . '">' . "<a{$link}>" . htmlspecialchars(str_cut($row['teamname'], 30)) . '</a></td>';
        }
        echo '<td class="probid" title="' . htmlspecialchars($row['probname']) . '">' . "<a{$link}>" . htmlspecialchars($row['shortname']) . '</a></td>';
        echo '<td class="langid" title="' . htmlspecialchars($row['langname']) . '">' . "<a{$link}>" . htmlspecialchars($row['langid']) . '</a></td>';
        echo "<td class=\"result\"><a{$link}>";
        if (difftime($row['submittime'], $cdatas[$row['cid']]['endtime']) >= 0) {
            echo printresult('too-late');
            if (IS_JURY && $row['result']) {
                echo " (" . printresult($row['result']) . ")";
            }
        } else {
            if (!$row['result'] || !IS_JURY && !$row['verified'] && dbconfig_get('verification_required', 0)) {
                echo printresult($row['judgehost'] || !IS_JURY ? '' : 'queued');
            } else {
                echo printresult($row['result']);
            }
        }
        echo "</a></td>";
        if (IS_JURY) {
            // only display verification if we're done with judging
            unset($verified, $jury_member);
            $claim = FALSE;
            if (empty($row['result'])) {
                $verified = '&nbsp;';
                $jury_member = '&nbsp;';
            } else {
                $verified = printyn($row['verified']);
                if (empty($row['jury_member'])) {
                    $jury_member = '&nbsp;';
                } else {
                    $jury_member = htmlspecialchars($row['jury_member']);
                }
                if (!$row['verified']) {
                    $vercnt++;
                    if (empty($row['jury_member'])) {
                        $claim = TRUE;
                    } else {
                        $verified = 'claimed';
                    }
                }
            }
            echo "<td><a{$link}>{$verified}</a></td><td>";
            if ($claim) {
                echo "<a class=\"button\" href=\"{$linkurl}&amp;claim=1\">claim</a>";
            } else {
                if (!$row['verified'] && $jury_member == $username) {
                    echo "<a class=\"button\" href=\"{$linkurl}&amp;unclaim=1\">unclaim</a>";
                } else {
                    echo "<a{$link}>{$jury_member}</a>";
                }
            }
            echo "</td>";
            if (isset($restrictions['rejudgingid'])) {
                echo "<td class=\"result\"><a href=\"submission.php?id={$sid}\">" . printresult($row['oldresult']) . "</a></td>";
            }
        }
        echo "</tr>\n";
        if ($row['result'] == 'correct') {
            $corcnt++;
        }
    }
    echo "</tbody>\n</table>\n\n";
    if (IS_JURY) {
        echo addEndForm();
        if ($limit > 0) {
            $query_extras = array('subcnt' => '', 'corcnt' => ' AND j.result LIKE \'correct\'', 'igncnt' => ' AND s.valid = 0', 'vercnt' => ' AND verified = 0 AND result IS NOT NULL', 'quecnt' => ' AND result IS NULL');
            foreach ($query_extras as $cnt => $query_extra) {
                ${$cnt} = $DB->q('VALUE SELECT count(s.submitid) ' . $sqlbody . $query_extra, @$restrictions['rejudgingid'], $cids, @$restrictions['teamid'], @$restrictions['categoryid'], @$restrictions['probid'], @$restrictions['langid'], @$restrictions['judgehost'], @$restrictions['rejudgingid'], @$restrictions['rejudgingid'], @$restrictions['old_result'], @$restrictions['result']);
            }
        }
        echo "<p>Total correct: {$corcnt}, submitted: {$subcnt}";
        if ($vercnt > 0) {
            echo ", unverified: {$vercnt}";
        }
        if ($igncnt > 0) {
            echo ", ignored: {$igncnt}";
        }
        if ($quecnt > 0) {
            echo ", judgement pending: {$quecnt}";
        }
        echo "</p>\n\n";
    }
    return;
}
Example #13
0
/**
 * View the internal errors
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$title = 'Internal Errors';
$refresh = array('after' => 15, 'url' => 'internal_errors.php');
require LIBWWWDIR . '/header.php';
echo "<h1>Internal Errors</h1>\n\n";
$res = $DB->q('SELECT errorid, judgingid, description, time, status
               FROM internal_error
               ORDER BY status, errorid');
if ($res->count() == 0) {
    echo "<p class=\"nodata\">No internal errors found</p>\n\n";
} else {
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th>" . "<th scope=\"col\">jid</th>" . "<th scope=\"col\">description</th>" . "<th scope=\"col\">time</th>" . "<th scope=\"col\">status</th></tr>\n" . "</thead>\n<tbody>\n";
    while ($row = $res->next()) {
        $link = '<a href="internal_error.php?id=' . urlencode($row['errorid']) . '">';
        $class = '';
        if ($row['status'] != 'open') {
            $class = 'class="disabled"';
        } else {
            $class = 'class="unseen"';
        }
        echo "<tr {$class}>" . "<td>" . $link . $row['errorid'] . '</a></td>' . "<td>" . $link . "j" . $row['judgingid'] . '</a></td>' . "<td>" . $link . specialchars($row['description']) . "</a></td>" . "<td>" . $link . printtime($row['time']) . "</a></td>" . "<td>" . $link . $row['status'] . '</a></td>' . "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
require LIBWWWDIR . '/footer.php';
Example #14
0
<?php

function printtime($encode)
{
    //setlocale に失敗すると前回の値が使用されるため
    //C でクリアする
    setlocale(LC_TIME, 'C');
    $result = setlocale(LC_TIME, $encode);
    echo strftime("%B - %A - %a") . " ({$encode}) - {$result} \r\n";
}
printtime('ja_JP');
printtime('ja_JP.UTF-8');
printtime('ja');
printtime('Japanese_Japan.932');
printtime('CP932');
printtime('UTF-8');
printtime('Japanese_Japan.65001');
Example #15
0
/**
 * Print contest start time
 */
function printContestStart($cdata)
{
    $res = "scheduled to start ";
    if (printtime(now(), '%Y%m%d') == printtime($cdata['starttime'], '%Y%m%d')) {
        // Today
        $res .= "at " . printtime($cdata['starttime']);
    } else {
        // Print full date
        $res .= "on " . printtime($cdata['starttime'], '%a %d %b %Y %T %Z');
    }
    return $res;
}
Example #16
0
    echo "<th scope=\"col\">shortname</th>";
    foreach ($times as $time) {
        echo "<th scope=\"col\">{$time}</th>";
    }
    echo "<th scope=\"col\">process<br />balloons?</th>";
    echo "<th scope=\"col\">public?</th>";
    echo "<th scope=\"col\" class=\"sorttable_numeric\"># teams</th>";
    echo "<th scope=\"col\" class=\"sorttable_numeric\"># problems</th>";
    echo "<th scope=\"col\">name</th>" . (IS_ADMIN ? "<th scope=\"col\"></th>" : '') . "</tr>\n</thead>\n<tbody>\n";
    $iseven = false;
    foreach ($res as $row) {
        $link = '<a href="contest.php?id=' . urlencode($row['cid']) . '">';
        echo '<tr class="' . ($iseven ? 'roweven' : 'rowodd') . (!$row['enabled'] ? ' disabled' : '') . (in_array($row['cid'], $curcids) ? ' highlight' : '') . '">' . "<td class=\"tdright\">" . $link . "c" . (int) $row['cid'] . "</a></td>\n";
        echo "<td>" . $link . specialchars($row['shortname']) . "</a></td>\n";
        foreach ($times as $time) {
            echo "<td title=\"" . printtime(@$row[$time . 'time'], '%Y-%m-%d %H:%M:%S (%Z)') . "\">" . $link . (isset($row[$time . 'time']) ? printtime($row[$time . 'time']) : '-') . "</a></td>\n";
        }
        echo "<td>" . $link . ($row['process_balloons'] ? 'yes' : 'no') . "</a></td>\n";
        echo "<td>" . $link . ($row['public'] ? 'yes' : 'no') . "</a></td>\n";
        echo "<td>" . $link . ($row['public'] ? '<em>all</em>' : $row['numteams']) . "</a></td>\n";
        echo "<td>" . $link . $numprobs[$row['cid']] . "</a></td>\n";
        echo "<td>" . $link . specialchars($row['name']) . "</a></td>\n";
        $iseven = !$iseven;
        if (IS_ADMIN) {
            echo "<td class=\"editdel\">" . editLink('contest', $row['cid']) . "&nbsp;" . delLink('contest', 'cid', $row['cid']) . "</td>\n";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
Example #17
0
 if (!$jud['verified']) {
     echo addForm($pagename . '?id=' . urlencode($id) . '&amp;jid=' . urlencode($jid));
     if (!empty($jud['jury_member'])) {
         echo ' (claimed by ' . specialchars($jud['jury_member']) . ') ';
     }
     if ($jury_member == @$jud['jury_member']) {
         echo addSubmit('unclaim', 'unclaim');
     } else {
         echo addSubmit('claim', 'claim');
     }
     echo addEndForm();
 }
 echo "<br /><br />\n\n";
 echo 'Result: ' . printresult($jud['result'], $jud['valid']) . ($lastjud === NULL ? '' : '<span class="lastresult"> (<a href="submission.php?id=' . $lastsubmitid . '">s' . $lastsubmitid . '</a>: ' . @$lastjud['result'] . ')</span>') . ', ' . 'Judgehost: <a href="judgehost.php?id=' . urlencode($jud['judgehost']) . '">' . printhost($jud['judgehost']) . '</a>, ';
 // Time (start, end, used)
 echo "<span class=\"judgetime\">Judging started: " . printtime($jud['starttime'], '%H:%M:%S');
 if ($judging_ended) {
     echo ', finished in ' . printtimediff($jud['starttime'], $jud['endtime']) . ' s';
 } elseif ($jud['valid'] || isset($jud['rejudgingid'])) {
     echo ' [still judging - busy ' . printtimediff($jud['starttime']) . ']';
 } else {
     echo ' [aborted]';
 }
 echo "</span>\n";
 if (@$jud['result'] !== 'compiler-error') {
     echo ", max/sum runtime: " . sprintf('%.2f/%.2fs', $max_runtime, $sum_runtime);
     if (isset($max_lastruntime)) {
         echo " <span class=\"lastruntime\">(<a href=\"submission.php?id={$lastsubmitid}\">s{$lastsubmitid}</a>: " . sprintf('%.2f/%.2fs', $max_lastruntime, $sum_lastruntime) . ")</span>";
     }
     echo "<table>\n{$tclist}";
     if ($lastjud !== NULL) {
Example #18
0
        set_internal_error($disabled, $edata['cid'], 1);
    }
    auditlog('internal_error', $id, 'internal error: ' + $status, '');
    header('Location: internal_error.php?id=' . urlencode($id));
}
require LIBWWWDIR . '/header.php';
echo '<br/><h1>Internal Error e' . $id . "</h1>\n\n";
echo "<table>\n";
echo "<tr><td>Description:</td><td>";
if (empty($edata['description'])) {
    echo '<span class="nodata">none</span>';
} else {
    echo specialchars($edata['description']);
}
echo "</td></tr>\n";
echo "<tr><td>Time:</td><td>" . printtime($edata['time']) . "</td></tr>\n";
if (isset($edata['judgingid'])) {
    echo "<tr><td>Related Judging:</td><td>" . "<a href=\"submission.php?jid=" . urlencode($edata['judgingid']) . "\">j" . specialchars($edata['judgingid']) . "</a>" . "</td></tr>\n";
}
if (isset($edata['cid'])) {
    echo "<tr><td>Related Contest:</td><td>" . "<a href=\"contest.php?id=" . urlencode($edata['cid']) . "\">c" . specialchars($edata['cid']) . "</a>" . "</td></tr>\n";
}
$kind = $disabled['kind'];
echo "<tr><td>Affected " . specialchars($kind) . ":</td><td>";
switch ($kind) {
    case 'problem':
        $probid = $disabled['probid'];
        $shortname = $DB->q('VALUE SELECT shortname FROM contestproblem WHERE probid=%i AND cid=%i', $probid, $edata['cid']);
        $name = $DB->q('VALUE SELECT name FROM problem WHERE probid=%i', $probid);
        echo "<a href=\"problem.php?id=" . urlencode($probid) . "\">" . specialchars($shortname . " - " . $name) . "</a>";
        break;