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>, '; // 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>"; }
?> </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); if ($show_compile == 2 || $show_compile == 1 && $row['result'] == 'compiler-error') { echo "<h2>Compilation output</h2>\n\n"; if (strlen(@$row['output_compile']) > 0) { echo "<pre class=\"output_text\">\n" . htmlspecialchars(@$row['output_compile']) . "\n</pre>\n\n"; } else { echo "<p class=\"nodata\">There were no compiler errors or warnings.</p>\n"; } if ($row['result'] == 'compiler-error') { echo "<p class=\"compilation-error\">Compilation failed.</p>\n"; } else { echo "<p class=\"compilation-success\">Compilation successful.</p>\n";
/** * 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']) ? '&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 = ' '; $jury_member = ' '; } else { $verified = printyn($row['verified']); if (empty($row['jury_member'])) { $jury_member = ' '; } 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}&claim=1\">claim</a>"; } else { if (!$row['verified'] && $jury_member == $username) { echo "<a class=\"button\" href=\"{$linkurl}&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; }
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'] . '&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';
</div> <nav> <h2>Tags</h2> <?php printtagforsidebar(); ?> </nav> <div id="wrapper"> <div class = "fortop"> <form action='gallery.php' method='GET'> Search for specific tags: <input type='text' name="sea"/> <input type="submit" value="Submit!"/> <?php printresult(); ?> </form> </div> <div class="main"> <div class="transbox1"> <?php getimage(); ?> </div> </div> </div> </body> </html>