if (!empty($data['color'])) { echo '<tr><td>Colour:</td><td><div class="circle" style="background-color: ' . specialchars($data['color']) . ';"></div> ' . specialchars($data['color']) . "</td></tr>\n"; } if (!empty($data['problemtext_type'])) { echo '<tr><td>Problem text:</td><td class="nobreak"><a href="problem.php?id=' . urlencode($id) . '&cmd=viewtext"><img src="../images/' . urlencode($data['problemtext_type']) . '.png" alt="problem text" ' . 'title="view problem description" /></a> ' . "</td></tr>\n"; } echo '<tr><td>Run script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_run']) . '">' . specialchars($data['special_run']) . "</a>" . (@$defaultrun ? ' (default)' : '') . "</td></tr>\n"; echo '<tr><td>Compare script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_compare']) . '">' . specialchars($data['special_compare']) . "</a>" . (@$defaultcompare ? ' (default)' : '') . "</td></tr>\n"; if (!empty($data['special_compare_args'])) { echo '<tr><td>Compare script arguments:</td><td>' . specialchars($data['special_compare_args']) . "</td></tr>\n"; } echo "</table>\n" . addEndForm(); if (IS_ADMIN) { echo "<p>" . exportLink($id) . "\n" . editLink('problem', $id) . "\n" . delLink('problem', 'probid', $id) . "</p>\n\n"; } echo rejudgeForm('problem', $id) . "<br />\n\n"; if ($current_cid === null) { echo "<h3>Contests</h3>\n\n"; $res = $DB->q('TABLE SELECT c.*, cp.shortname AS problemshortname, cp.allow_submit, cp.allow_judge, cp.color FROM contest c INNER JOIN contestproblem cp USING (cid) WHERE cp.probid = %i ORDER BY starttime DESC', $id); if (count($res) == 0) { echo "<p class=\"nodata\">No contests defined</p>\n\n"; } else { $times = array('activate', 'start', 'freeze', 'end', 'unfreeze'); echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>"; echo "<th scope=\"col\">contest<br />shortname</th>\n"; echo "<th scope=\"col\">contest<br />name</th>"; echo "<th scope=\"col\">problem<br />shortname</th>";
$tclist = "<tr><td>testcase runs:</td><td>" . $tclist . "</td></tr>\n"; if ($lastjud !== NULL) { $lastjudging_ended = !empty($lastjud['endtime']); list($lasttclist, $sum_lastruntime, $max_lastruntime) = display_runinfo($lastruns, $lastjudging_ended); $lasttclist = "<tr class=\"lasttcruns\"><td><a href=\"submission.php?id={$lastsubmitid}\">s{$lastsubmitid}</a> runs:</td><td>" . $lasttclist . "</td></tr>\n"; } $state = ''; if (isset($jud['rejudgingid'])) { $reason = $DB->q('VALUE SELECT reason FROM rejudging WHERE rejudgingid=%i', $jud['rejudgingid']); $state = ' (rejudging <a href="rejudging.php?id=' . urlencode($jud['rejudgingid']) . '">r' . specialchars($jud['rejudgingid']) . '</a>, reason: ' . specialchars($reason) . ')'; } else { if ($jud['valid'] != 1) { $state = ' (INVALID)'; } } echo rejudgeForm('submission', $id) . "<br /><br />\n\n"; echo "<h2 style=\"display:inline;\">Judging j" . (int) $jud['judgingid'] . $state . "</h2>\n\n "; if (!$jud['verified']) { echo addForm($pagename . '?id=' . urlencode($id) . '&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>, ';
?> </td></tr> <?php if (!empty($data['color'])) { echo '<tr><td>Colour:</td><td><div class="circle" style="background-color: ' . htmlspecialchars($data['color']) . ';"></div> ' . htmlspecialchars($data['color']) . "</td></tr>\n"; } if (!empty($data['problemtext_type'])) { echo '<tr><td>Problem text:</td><td class="nobreak"><a href="problem.php?id=' . urlencode($id) . '&cmd=viewtext"><img src="../images/' . urlencode($data['problemtext_type']) . '.png" alt="problem text" ' . 'title="view problem description" /></a> ' . "</td></tr>\n"; } echo '<tr><td>Run script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_run']) . '">' . htmlspecialchars($data['special_run']) . "</a>" . (@$defaultrun ? ' (default)' : '') . "</td></tr>\n"; echo '<tr><td>Compare script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_compare']) . '">' . htmlspecialchars($data['special_compare']) . "</a>" . (@$defaultcompare ? ' (default)' : '') . "</td></tr>\n"; if (!empty($data['special_compare_args'])) { echo '<tr><td>Compare script arguments:</td><td>' . htmlspecialchars($data['special_compare_args']) . "</td></tr>\n"; } echo "</table>\n" . addEndForm(); echo "<br />\n" . rejudgeForm('problem', $id) . "\n\n"; if (IS_ADMIN) { echo "<p>" . exportLink($id) . "\n" . editLink('problem', $id) . "\n" . delLink('problem', 'probid', $id) . "</p>\n\n"; } if ($current_cid === null) { echo "<h3>Contests</h3>\n\n"; $res = $DB->q('TABLE SELECT c.*, cp.shortname AS problemshortname, cp.allow_submit, cp.allow_judge, cp.color FROM contest c INNER JOIN contestproblem cp USING (cid) WHERE cp.probid = %i ORDER BY starttime DESC', $id); if (count($res) == 0) { echo "<p class=\"nodata\">No contests defined</p>\n\n"; } else { $times = array('activate', 'start', 'freeze', 'end', 'unfreeze'); echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>";
} echo ", time since judgehost last checked in: " . printtimediff($row['polltime']) . 's.'; } ?> </td></tr> </table> <?php if (IS_ADMIN) { $cmd = $row['active'] == 1 ? 'deactivate' : 'activate'; echo addForm($pagename) . "<p>\n" . addHidden('id', $row['hostname']) . addHidden('cmd', $cmd) . addSubmit($cmd) . "</p>\n" . addEndForm(); } if (IS_ADMIN) { echo "<p>" . delLink('judgehost', 'hostname', $row['hostname']) . "</p>\n\n"; } echo rejudgeForm('judgehost', $row['hostname']) . "<br />\n\n"; echo "<h3>Judgings by " . printhost($row['hostname']) . "</h3>\n\n"; // get the judgings for a specific key and value pair // select only specific fields to avoid retrieving large blobs $cids = getCurContests(FALSE); if (!empty($cids)) { $res = $DB->q('SELECT judgingid, submitid, starttime, endtime, judgehost, 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()) {
} else { echo "Critical"; } } echo ", time since judgehost last checked in: " . printtimediff($row['polltime']) . 's.'; } ?> </td></tr> </table> <?php if (IS_ADMIN) { $cmd = $row['active'] == 1 ? 'deactivate' : 'activate'; echo addForm($pagename) . "<p>\n" . addHidden('id', $row['hostname']) . addHidden('cmd', $cmd) . addSubmit($cmd) . "</p>\n" . addEndForm(); } echo rejudgeForm('judgehost', $row['hostname']); if (IS_ADMIN) { echo "<p>" . delLink('judgehost', 'hostname', $row['hostname']) . "</p>\n\n"; } echo "<h3>Judgings by " . printhost($row['hostname']) . "</h3>\n\n"; // get the judgings for a specific key and value pair // select only specific fields to avoid retrieving large blobs $cids = getCurContests(FALSE); if (!empty($cids)) { $res = $DB->q('SELECT judgingid, submitid, starttime, endtime, judgehost, 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";
if (is_readable($countryflag)) { echo '<img src="' . $countryflag . '" alt="' . specialchars($row['country']) . '" /> '; } echo specialchars($row['country']) . "</td></tr>\n"; } if (!empty($row['members'])) { echo '<tr><td>Members: </td><td>' . nl2br(specialchars($row['members'])) . "</td></tr>\n"; } if (!empty($row['comments'])) { echo '<tr><td>Comments:</td><td>' . nl2br(specialchars($row['comments'])) . "</td></tr>\n"; } echo "</table></div>\n"; if (IS_ADMIN) { echo "<p class=\"nomorecol\">" . editLink('team', $id) . "\n" . delLink('team', 'teamid', $id) . "</p>\n\n"; } echo rejudgeForm('team', $id) . "\n\n"; if ($cid) { echo "<h3>Score</h3>\n\n"; putTeamRow($cdata, array($id)); } echo '<h3>Submissions'; if (isset($key)) { $keystr = ""; switch ($key) { case 'probid': $keystr = "problem"; break; case 'langid': $keystr = "language"; break; case 'judgehost':
foreach ($teams as $i => $team) { if ($i != 0) { echo '</td></tr>'; echo '<tr><td></td><td>'; } echo '<a href="team.php?id=' . $team['teamid'] . '&cid=' . $id . '">'; echo $team['name'] . ' (t' . $team['teamid'] . ')'; echo '</a>'; } } } echo '</td></tr>'; echo "</table>\n\n"; if (IS_ADMIN) { if (in_array($data['cid'], $cids)) { echo "<p>" . rejudgeForm('contest', $data['cid']) . "</p>\n\n"; } echo "<p>" . editLink('contest', $data['cid']) . "\n" . delLink('contest', 'cid', $data['cid']) . "</p>\n\n"; } echo "<h3>Problems</h3>\n\n"; $res = $DB->q('TABLE SELECT * FROM problem INNER JOIN contestproblem USING (probid) WHERE cid = %i ORDER BY shortname', $id); if (count($res) == 0) { echo "<p class=\"nodata\">No problems added yet</p>\n\n"; } else { echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">probid</th>"; echo "<th scope=\"col\">name</th>"; echo "<th scope=\"col\">shortname</th>";
?> </td></tr> <tr><td>Time factor: </td><td><?php echo specialchars($data['time_factor']); ?> ×</td></tr> <tr><td>Compile script:</td><td class="filename"> <?php if (empty($data['compile_script'])) { echo '<span class="nodata">none specified</span>'; } else { echo '<a href="executable.php?id=' . urlencode($data['compile_script']) . '">' . specialchars($data['compile_script']) . '</a>'; } ?> </td></tr> <tr><td>Extensions: </td><td><?php echo specialchars(implode(', ', json_decode($data['extensions']))); ?> </td></tr> </table> <?php echo addEndForm(); if (IS_ADMIN) { echo "<p>" . editLink('language', $data['langid']) . "\n" . delLink('language', 'langid', $data['langid']) . "</p>\n\n"; } echo rejudgeForm('language', $data['langid']) . "<br />\n\n"; echo "<h2>Submissions in " . specialchars($data['name']) . "</h2>\n\n"; $restrictions = array('langid' => $id); putSubmissions($cdatas, $restrictions); require LIBWWWDIR . '/footer.php';
if ($i != 0) { echo '</td></tr>'; echo '<tr><td></td><td>'; } echo '<a href="team.php?id=' . $team['teamid'] . '&cid=' . $id . '">'; echo $team['name'] . ' (t' . $team['teamid'] . ')'; echo '</a>'; } } } echo '</td></tr>'; echo "</table>\n\n"; if (IS_ADMIN) { echo "<p>" . editLink('contest', $data['cid']) . "\n" . delLink('contest', 'cid', $data['cid']) . "</p>\n\n"; if (in_array($data['cid'], $cids)) { echo rejudgeForm('contest', $data['cid']) . "<br />\n\n"; } } echo "<h3>Problems</h3>\n\n"; $res = $DB->q('TABLE SELECT * FROM problem INNER JOIN contestproblem USING (probid) WHERE cid = %i ORDER BY shortname', $id); if (count($res) == 0) { echo "<p class=\"nodata\">No problems added yet</p>\n\n"; } else { echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">probid</th>"; echo "<th scope=\"col\">name</th>"; echo "<th scope=\"col\">shortname</th>"; echo "<th scope=\"col\">points</th>";
} } echo "<h2 style=\"display:inline;\">Judging j" . (int) $jud['judgingid'] . $state . "</h2>\n\n "; if (!$jud['verified']) { echo addForm($pagename . '?id=' . urlencode($id) . '&jid=' . urlencode($jid)); if (!empty($jud['jury_member'])) { echo ' (claimed by ' . htmlspecialchars($jud['jury_member']) . ') '; } if ($jury_member == @$jud['jury_member']) { echo addSubmit('unclaim', 'unclaim'); } else { echo addSubmit('claim', 'claim'); } echo addEndForm(); } echo rejudgeForm('submission', $id); echo $lastjud === NULL ? '' : "<span class=\"testcases_prev\">" . "<a href=\"javascript:togglelastruns();\">show/hide</a> results of previous " . "<a href=\"submission.php?id={$lastsubmitid}\">submission s{$lastsubmitid}</a>" . (empty($lastjud['verify_comment']) ? '' : "<span class=\"prevsubmit\"> (verify comment: '" . $lastjud['verify_comment'] . "')</span>") . "</span>"; echo '<br/><br/>'; 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']) { 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);
} } echo "<h2 style=\"display:inline;\">Judging j" . (int) $jud['judgingid'] . $state . "</h2>\n\n "; if (!$jud['verified']) { echo addForm($pagename . '?id=' . urlencode($id) . '&jid=' . urlencode($jid)); if (!empty($jud['jury_member'])) { echo ' (claimed by ' . htmlspecialchars($jud['jury_member']) . ') '; } if ($jury_member == @$jud['jury_member']) { echo addSubmit('unclaim', 'unclaim'); } else { echo addSubmit('claim', 'claim'); } echo addEndForm(); } echo rejudgeForm('submission', $id) . '<br/><br/>'; 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>";