aboutsummaryrefslogtreecommitdiff
path: root/src/judge
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2013-07-02 05:46:45 +0000
committercassio <cassiopc@gmail.com>2013-07-02 05:46:45 +0000
commitbe2491b093b1f0ca430bede679ecbb670041e483 (patch)
treefe2da63d1811cb93e4352a43a113ace37b9f6017 /src/judge
parenta9aa438ea0558eb0044cf1e54a9190ddb41b65e5 (diff)
downloadboca-be2491b093b1f0ca430bede679ecbb670041e483.tar.gz
boca-be2491b093b1f0ca430bede679ecbb670041e483.zip
restructuring of boca's git
Diffstat (limited to 'src/judge')
-rw-r--r--src/judge/clar.php124
-rw-r--r--src/judge/claredit.php155
-rw-r--r--src/judge/header.php98
-rw-r--r--src/judge/history.php129
-rw-r--r--src/judge/index.php22
-rw-r--r--src/judge/option.php21
-rw-r--r--src/judge/run.php84
-rw-r--r--src/judge/runchief.php187
-rw-r--r--src/judge/runedit.php250
-rw-r--r--src/judge/runeditchief.php320
-rw-r--r--src/judge/score.php21
-rw-r--r--src/judge/team.php195
12 files changed, 1606 insertions, 0 deletions
diff --git a/src/judge/clar.php b/src/judge/clar.php
new file mode 100644
index 0000000..a5d56ce
--- /dev/null
+++ b/src/judge/clar.php
@@ -0,0 +1,124 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+
+if (isset($_POST["message"]) && isset($_POST["problem"]) && isset($_POST["Submit"])) {
+ if ($_POST["confirmation"] == "confirm") {
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ $param['site']=$_SESSION["usertable"]["usersitenumber"];
+ $param['user']= $_SESSION["usertable"]["usernumber"];
+ $param['problem'] = htmlspecialchars($_POST["problem"]);
+ $param['question'] = htmlspecialchars($_POST["message"]);
+ DBNewClar($param);
+ }
+ ForceLoad("clar.php");
+}
+?>
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Clar #</b></td>
+ <td><b>Site</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Status</b></td>
+ <td><b>Question</b></td>
+ </tr>
+<?php
+
+if(($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+$clar = DBOpenClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"]);
+
+for ($i=0; $i<count($clar); $i++) {
+ echo " <tr>\n";
+ if (strpos($clar[$i]["status"], "answered") === false)
+ echo " <td nowrap><a href=\"claredit.php?clarnumber=".$clar[$i]["number"]."&clarsitenumber=".$clar[$i]["site"] .
+ "\">" . $clar[$i]["number"] . "</td>\n";
+ else
+ echo " <td nowrap>" . $clar[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["site"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($clar[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["problem"] . "</td>\n";
+ if ($clar[$i]["judge"] == $_SESSION["usertable"]["usernumber"] &&
+ $clar[$i]["judgesite"] == $_SESSION["usertable"]["usersitenumber"])
+ $color="ff7777";
+ else if ($clar[$i]["status"] == "answering") $color="77ff77";
+ else if ($clar[$i]["status"] == "openclar") $color="ffff88";
+ else $color="ffffff";
+
+ echo " <td nowrap bgcolor=\"#$color\">" . $clar[$i]["status"] . "</td>\n";
+
+ if ($clar[$i]["question"] == "") $clar[$i]["question"] = "&nbsp;";
+
+ echo " <td>";
+// echo "<pre>" . $clar[$i]["question"] . "</pre>";
+// echo $clar[$i]["question"];
+ echo " <textarea name=\"m$i\" cols=\"60\" rows=\"8\" readonly>".$clar[$i]["question"]."</textarea>\n";
+ echo "</td>\n";
+
+ echo " </tr>\n";
+}
+
+echo "</table>";
+if (count($clar) == 0) echo "<br><center><b><font color=\"#ff0000\">NO CLARIFICATIONS AVAILABLE</font></b></center>";
+
+?>
+<br><br><br><center><b>To submit a clarification, just fill in the following fields
+</b></center>
+<form name="form1" method="post" action="clar.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <center>
+ <table border="0">
+ <tr>
+ <td width="13%" align=right>Problem:</td>
+ <td width="87%">
+ <select name="problem">
+<?php
+$prob = DBGetAllProblems($_SESSION["usertable"]["contestnumber"]);
+for ($i=0;$i<count($prob);$i++)
+ echo "<option value=\"" . $prob[$i]["number"] . "\">" . $prob[$i]["problem"] . "</option>\n";
+?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="13%" align=right>Clarification:</td>
+ <td width="87%">
+ <textarea name="message" cols="60" rows="8" maxlength="2000"></textarea>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm clarification?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Send" onClick="conf()">
+ <input type="reset" name="Submit2" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/src/judge/claredit.php b/src/judge/claredit.php
new file mode 100644
index 0000000..5408e6b
--- /dev/null
+++ b/src/judge/claredit.php
@@ -0,0 +1,155 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+
+if (isset($_POST["answer"]) && isset($_POST["giveup"]) && $_POST["giveup"]=="Cancel" &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["number"]) &&
+ is_numeric($_POST["sitenumber"])) {
+
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+
+ DBClarGiveUp($number, $sitenumber, $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ MSGError("Clarification returned.");
+ ForceLoad("clar.php");
+}
+
+if (isset($_POST["answer"]) && isset($_POST["Submit"]) && ($_POST["Submit"]=="Answer" || $_POST["Submit"]=="No response") &&
+ is_numeric($_POST["number"]) && isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["sitenumber"])) {
+ if ($_POST["confirmation"]=="confirm") {
+
+ $ans = myhtmlspecialchars($_POST["answer"]);
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+
+ if ($_POST["Submit"]=="No response")
+ $ans='No response. '.$ans;
+
+ if (trim($ans)=="") {
+ DBClarGiveUp($number, $sitenumber, $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ MSGError("Clarification returned.");
+ } else {
+ if (isset($_POST["answerall"])) $type='all';
+ else if (isset($_POST["answersite"])) $type='site';
+ else $type = 'none';
+
+ DBUpdateClar($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"],
+ $sitenumber, $number, $ans, $type);
+ }
+ }
+ ForceLoad("clar.php");
+}
+
+if (!isset($_GET["clarnumber"]) || !isset($_GET["clarsitenumber"]) ||
+ !is_numeric($_GET["clarnumber"]) || !is_numeric($_GET["clarsitenumber"])) {
+ IntrusionNotify("tried to open the judge/claredit.php with wrong parameters.");
+ ForceLoad("clar.php");
+}
+
+$clarsitenumber = myhtmlspecialchars($_GET["clarsitenumber"]);
+$clarnumber = myhtmlspecialchars($_GET["clarnumber"]);
+
+if (($a = DBGetClarToAnswer($clarnumber, $clarsitenumber,
+ $_SESSION["usertable"]["contestnumber"])) === false) {
+ MSGError("Another judge got it first.");
+ ForceLoad("clar.php");
+}
+
+?>
+<br><br><center><b>Use the following fields to answer the clarification:
+</b></center>
+<form name="form1" method="post" action="claredit.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <center>
+ <table border="0">
+ <tr>
+ <td width="20%" align=right><b>Clarification Site:</b></td>
+ <td width="80%">
+ <input type=hidden name="sitenumber" value="<?php echo $a["sitenumber"]; ?>" />
+ <?php echo $a["sitenumber"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Clarification Number:</b></td>
+ <td width="80%">
+ <input type=hidden name="number" value="<?php echo $a["number"]; ?>" />
+ <?php echo $a["number"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Clarification Time:</b></td>
+ <td width="80%">
+ <?php echo dateconvminutes($a["timestamp"]); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Problem:</b></td>
+ <td width="80%">
+ <?php echo $a["problemname"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Clarification:</b></td>
+ <td width="80%">
+ <textarea name="message" readonly cols="60" rows="8"><?php echo $a["question"]; ?></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Answer:</b></td>
+ <td width="80%">
+ <textarea name="answer" cols="60" rows="8"><?php echo $a["answer"]; ?></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td width="20%" align=right><b>Answer to all users in the site</b></td>
+ <td width="80%">
+ <input class=checkbox type=checkbox name="answersite" value="yes">
+ </td>
+ </tr>
+<!--
+ <tr>
+ <td width="20%" align=right><b>Answer to all users in all sites</b></td>
+ <td width="80%">
+ <input class=checkbox type=checkbox name="answerall" value="yes">
+ </td>
+ </tr>
+-->
+ </table>
+ </center>
+ <script language="javascript">
+ function conf() {
+// if (confirm("Confirm clarification?")) {
+ document.form1.confirmation.value='confirm';
+// }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Answer" onclick="conf()">
+ <input type="submit" name="Submit" value="No response" onclick="conf()">
+ <input type="submit" name="giveup" value="Cancel">
+ <input type="reset" name="Submit2" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/src/judge/header.php b/src/judge/header.php
new file mode 100644
index 0000000..db2136d
--- /dev/null
+++ b/src/judge/header.php
@@ -0,0 +1,98 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 21/jul/2012 by cassio@ime.usp.br
+ob_start();
+header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Cache-Control: no-cache, must-revalidate");
+header ("Pragma: no-cache");
+header ("Content-Type: text/html; charset=utf-8");
+session_start();
+ob_end_flush();
+require('../version.php');
+require_once("../globals.php");
+require_once("../db.php");
+
+$runteam='team.php';
+$runphp = "runchief.php";
+$runeditphp = "runeditchief.php";
+
+echo "<html><head><title>Judge's Page</title>\n";
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
+echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n";
+
+//temporario!!!!
+//echo "<meta http-equiv=\"refresh\" content=\"60\" />";
+if(!ValidSession()) {
+ InvalidSession("judge/index.php");
+ ForceLoad("../index.php");
+}
+if($_SESSION["usertable"]["usertype"] != "judge") {
+ IntrusionNotify("judge/index.php");
+ ForceLoad("../index.php");
+}
+
+if(($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+if($s["sitechiefname"]== $_SESSION["usertable"]["username"])
+ $cc = "338833";
+else
+ $cc = "77cc77";
+
+
+echo "<script language=\"javascript\" src=\"../reload.js\"></script>\n";
+echo "</head><body onload=\"Comecar()\" onunload=\"Parar()\"><table border=1 width=\"100%\">\n";
+echo "<tr><td nowrap bgcolor=\"#$cc\" align=center>";
+echo "<img src=\"../images/smallballoontransp.png\" alt=\"\">";
+echo "<font color=\"#000000\">BOCA</font>";
+echo "</td><td bgcolor=\"#$cc\" width=\"99%\">\n";
+echo "Username: " . $_SESSION["usertable"]["userfullname"] . " (site=".$_SESSION["usertable"]["usersitenumber"].")<br>\n";
+list($clockstr,$clocktype)=siteclock();
+echo "</td><td bgcolor=\"#$cc\" align=center nowrap>&nbsp;".$clockstr."&nbsp;</td></tr>\n";
+echo "</table>\n";
+
+$clar = DBOpenClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"]);
+$run = DBOpenRunsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"]);
+if($s["sitechiefname"]== $_SESSION["usertable"]["username"]) {
+$nrchief = 0;
+$rrun = DBAllRunsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"]);
+for ($i=0; $i<count($rrun); $i++) {
+ if($rrun[$i]["answer1"] != 0 && $rrun[$i]["answer2"] != 0 && $rrun[$i]["status"] != "judged")
+ $nrchief++;
+}
+}
+$nr=count($run);
+$nc=count($clar);
+
+echo "<table border=0 width=\"100%\" align=center>\n";
+echo " <tr>\n";
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=run.php>Runs ($nr)</a></td>\n";
+if($s["sitechiefname"]== $_SESSION["usertable"]["username"]) {
+ echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=runchief.php>Chief ($nrchief)</a></td>\n";
+}
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=score.php>Score</a></td>\n";
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=clar.php>Clarifications ($nc)</a></td>\n";
+
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=history.php>History</a></td>\n";
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=team.php>As Team</a></td>\n";
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n";
+echo " <td align=center width=\"10%\"><a class=menu style=\"font-weight:bold\" href=../index.php>Logout</a></td>\n";
+echo " </tr>\n";
+echo "</table>\n";
+?>
diff --git a/src/judge/history.php b/src/judge/history.php
new file mode 100644
index 0000000..b612f9a
--- /dev/null
+++ b/src/judge/history.php
@@ -0,0 +1,129 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+// updated 20/oct/08 by cassio@ime.usp.br
+// - bugfix of Marcelo Cezar Pinto (mcpinto@unipampa.edu.br) - div by zero at counts
+require('header.php');
+?>
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Clar # (site)</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Status</b></td>
+ <td><b>Question</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$clar = DBAllClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], "clar");
+//$clar = DBJudgedClars($_SESSION["usertable"]["contestnumber"],
+// $_SESSION["usertable"]["usersitenumber"],
+// $_SESSION["usertable"]["usernumber"]);
+$myclars = 0;
+for ($i=0; $i<count($clar); $i++) {
+ echo " <tr>\n";
+ if($clar[$i]["judge"] == $_SESSION["usertable"]["usernumber"] &&
+ $clar[$i]["judgesite"] == $_SESSION["usertable"]["usersitenumber"]) {
+ echo " <td nowrap bgcolor=\"#b0b0a0\">" . $clar[$i]["number"] . "(" . $clar[$i]["site"] . ")</td>\n";
+ $myclars++;
+ }
+ else
+ echo " <td nowrap>" . $clar[$i]["number"] . "(" . $clar[$i]["site"] . ")</td>\n";
+ echo " <td nowrap>" . dateconvminutes($clar[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["problem"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["status"] . "</td>\n";
+ if ($clar[$i]["question"] == "") $clar[$i]["question"] = "&nbsp;";
+ if ($clar[$i]["answer"] == "") $clar[$i]["answer"] = "&nbsp;";
+
+ echo " <td>";
+// echo "<pre>" . $clar[$i]["question"] . "</pre>";
+// echo $clar[$i]["question"];
+ echo " <textarea name=\"m$i\" cols=\"60\" rows=\"8\" readonly>".$clar[$i]["question"]."</textarea>\n";
+ echo "</td>\n";
+ if (trim($clar[$i]["answer"]) == "") $clar[$i]["answer"] = "Not answered yet";
+ echo " <td>";
+// echo " <pre>" . $clar[$i]["answer"] . "</pre>";
+// echo $clar[$i]["answer"];
+ echo " <textarea name=\"a$i\" cols=\"60\" rows=\"8\" readonly>".$clar[$i]["answer"]."</textarea>\n";
+ echo "</td>\n";
+
+ echo " </tr>\n";
+}
+echo "</table>";
+if (count($clar) == 0) echo "<br><center><b><font color=\"#ff0000\">NO CLARIFICATIONS AVAILABLE</font></b></center>";
+else echo "<br><b><font color=\"#b0b0a0\">* Shadowed clars and runs were judged by this judge</font></b>";
+
+?>
+<br><br>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Run #</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Language</b></td>
+ <td><b>Status</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$run = DBAllRunsInSites($_SESSION["usertable"]["contestnumber"],
+ $s["sitejudging"],
+ "run");
+//$run = DBJudgedRuns($_SESSION["usertable"]["contestnumber"],
+// $_SESSION["usertable"]["usersitenumber"],
+// $_SESSION["usertable"]["usernumber"]);
+$yes = 0;
+$myyes = 0;
+$myruns = 0;
+for ($i=0; $i<count($run); $i++) {
+ echo " <tr>\n";
+ if($run[$i]["yes"]=="t") $yes++;
+ if(($_SESSION["usertable"]["usersitenumber"] == $run[$i]["judgesite1"] &&
+ $_SESSION["usertable"]["usernumber"] == $run[$i]["judge1"]) ||
+ ($_SESSION["usertable"]["usersitenumber"] == $run[$i]["judgesite2"] &&
+ $_SESSION["usertable"]["usernumber"] == $run[$i]["judge2"])) {
+ echo " <td nowrap bgcolor=\"#b0b0a0\">" . $run[$i]["number"] . "</td>\n";
+ if($run[$i]["yes"]=="t") $myyes++;
+ $myruns++;
+ }
+ else
+ echo " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["problem"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["status"] . "</td>\n";
+ if ($run[$i]["answer"] == "") $run[$i]["answer"] = "&nbsp;";
+ echo " <td>" . $run[$i]["answer"] . "</td>\n";
+ echo " </tr>\n";
+}
+echo "</table>";
+if (count($run) == 0) echo "<br><center><b><font color=\"#ff0000\">NO RUNS AVAILABLE</font></b></center>";
+
+echo "<br><br>\n";
+echo "My answered clars: " . $myclars . "/" . count($clar) . " (";
+if(count($clar)>0) echo ((int) ($myclars*1000/count($clar)))/10 . "%)<br>\n";
+else echo "0%)<br>\n";
+echo "My judged runs: " . $myruns . "/" . count($run) ." (";
+if(count($run)>0) echo ((int) ($myruns*1000/count($run)))/10 . "%)<br>\n";
+else echo "0%)<br>\n";
+echo "Accepted runs that I've judged: " . $myyes . "/" . $yes . " (";
+if($yes>0) echo ((int) ($myyes*1000/$yes))/10 ."%)<br>\n";
+else echo "0%)<br>\n";
+?>
+</body>
+</html>
diff --git a/src/judge/index.php b/src/judge/index.php
new file mode 100644
index 0000000..ec74ce9
--- /dev/null
+++ b/src/judge/index.php
@@ -0,0 +1,22 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+?>
+</body>
+</html>
diff --git a/src/judge/option.php b/src/judge/option.php
new file mode 100644
index 0000000..81e5879
--- /dev/null
+++ b/src/judge/option.php
@@ -0,0 +1,21 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+require('../optionlower.php');
+?>
diff --git a/src/judge/run.php b/src/judge/run.php
new file mode 100644
index 0000000..9f08851
--- /dev/null
+++ b/src/judge/run.php
@@ -0,0 +1,84 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 21/jul/2012 by cassio@ime.usp.br
+require('header.php');
+?>
+
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Run #</b></td>
+ <td><b>Site</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Language</b></td>
+<!-- <td><b>Filename</b></td> -->
+ <td><b>Status</b></td>
+ <td><b>AJ</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+$run = DBOpenRunsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"]);
+
+for ($i=0; $i<count($run); $i++) {
+ echo " <tr>\n";
+// if (strpos($run[$i]["status"], "judged") === false || $run[$i]["judge"]=="" || $run[$i]["judge"]==$_SESSION["usertable"]["usernumber"])
+ echo " <td nowrap><a href=\"runedit.php?runnumber=".$run[$i]["number"]."&runsitenumber=".$run[$i]["site"] .
+ "\">" . $run[$i]["number"] . "</td>\n";
+// else
+// echo " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["site"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["problem"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+// echo " <td nowrap>" . $run[$i]["filename"] . "</td>\n";
+ if ($run[$i]["judge1"] == $_SESSION["usertable"]["usernumber"] &&
+ $run[$i]["judgesite1"] == $_SESSION["usertable"]["usersitenumber"])
+ $color="ff7777";
+ else if ($run[$i]["judge2"] == $_SESSION["usertable"]["usernumber"] &&
+ $run[$i]["judgesite2"] == $_SESSION["usertable"]["usersitenumber"])
+ $color="ff7777";
+ else if ($run[$i]["status"] == "judged+") $color="ffff00";
+ else if ($run[$i]["status"] == "judged") $color="0000ff";
+ else if ($run[$i]["status"] == "judging") $color="77ff77";
+ else if ($run[$i]["status"] == "openrun") $color="ffff88";
+ else $color="ffffff";
+
+ echo " <td nowrap bgcolor=\"#$color\">" . $run[$i]["status"] . "</td>\n";
+ if ($run[$i]["autoend"] != "") {
+ $color="bbbbff";
+ if ($run[$i]["autoanswer"]=="") $color="ff7777";
+ }
+ else if ($run[$i]["autobegin"]=="") $color="ffff88";
+ else $color="77ff77";
+ echo "<td bgcolor=\"#$color\">&nbsp;&nbsp;</td>\n";
+
+ if ($run[$i]["answer"] == "") $run[$i]["answer"] = "&nbsp;";
+ echo " <td>" . $run[$i]["answer"] . "</td>\n";
+ echo " </tr>\n";
+}
+
+echo "</table>";
+if (count($run) == 0) echo "<br><center><b><font color=\"#ff0000\">NO RUNS AVAILABLE</font></b></center>";
+
+?>
+</body>
+</html>
diff --git a/src/judge/runchief.php b/src/judge/runchief.php
new file mode 100644
index 0000000..a4cd443
--- /dev/null
+++ b/src/judge/runchief.php
@@ -0,0 +1,187 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require 'header.php';
+if(isset($_GET["order"]) && $_GET["order"] != "") {
+$order = myhtmlspecialchars($_GET["order"]);
+ $_SESSION["runline"] = $order;
+} else {
+ if(isset($_SESSION["runline"]))
+ $order = $_SESSION["runline"];
+ else
+ $order = '';
+}
+?>
+
+<form name="form1" method="post" action="<?php echo $runphp; ?>">
+ <input type=hidden name="confirmation" value="noconfirm" />
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b><a href="<?php echo $runphp; ?>?order=run">Run #</a></b></td>
+ <td><b><a href="<?php echo $runphp; ?>?order=site">Site</a></b></td>
+<?php if($runphp == "run.php") { ?>
+ <td><b><a href="<?php echo $runphp; ?>?order=user">User</a></b></td>
+<?php } ?>
+ <td><b>Time</b></td>
+ <td><b><a href="<?php echo $runphp; ?>?order=problem">Problem</a></b></td>
+ <td><b><a href="<?php echo $runphp; ?>?order=language">Language</a></b></td>
+<!-- <td><b>Filename</b></td> -->
+ <td><b><a href="<?php echo $runphp; ?>?order=status">Status</a></b></td>
+ <td><b><a href="<?php echo $runphp; ?>?order=judge">Judge (Site)</a></b></td>
+ <td><b>AJ</b></td>
+ <td><b><a href="<?php echo $runphp; ?>?order=answer">Answer</a></b></td>
+ </tr>
+<?php
+if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+// forca aparecer as runs do proprio site
+if (trim($s["sitejudging"])!="") $s["sitejudging"].=",".$_SESSION["usertable"]["usersitenumber"];
+else $s["sitejudging"]=$_SESSION["usertable"]["usersitenumber"];
+
+$run = DBAllRunsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], $order);
+
+if(isset($_POST)) {
+ $nrenew = 0;
+ $nreopen = 0;
+ for ($i=0; $i<count($run); $i++) {
+ if(isset($_POST["cbox_" . $run[$i]["number"] . "_" . $run[$i]["site"]]) &&
+ $_POST["cbox_" . $run[$i]["number"] . "_" . $run[$i]["site"]] != "") {
+ if(isset($_POST["auto"]) && $_POST["auto"]=="Re-run autojudge for selected runs") {
+ if (DBGiveUpRunAutojudging($_SESSION["usertable"]["contestnumber"],
+ $run[$i]["site"], $run[$i]["number"]))
+ $nrenew++;
+ }
+ if(isset($_POST["open"]) && $_POST["open"]=="Open selected runs for rejudging") {
+ DBGiveUpRunAutojudging($_SESSION["usertable"]["contestnumber"],
+ $run[$i]["site"], $run[$i]["number"]);
+ if (DBChiefRunGiveUp($run[$i]["number"], $run[$i]["site"],
+ $_SESSION["usertable"]["contestnumber"]))
+ $nreopen++;
+ }
+ }
+ }
+ if($nrenew > 0) {
+ MSGError($nrenew . " runs renewed for autojudging.");
+ ForceLoad($runphp);
+ }
+ if($nreopen > 0) {
+ MSGError($nreopen . " runs reopened.");
+ ForceLoad($runphp);
+ }
+}
+
+
+for ($i=0; $i<count($run); $i++) {
+ if($run[$i]["answer1"] != 0 && $run[$i]["answer2"] != 0 && $run[$i]["status"] != "judged") {
+ if($runphp == "runchief.php")
+ echo " <tr bgcolor=\"ff0000\">\n";
+ else echo "<tr>\n";
+ echo " <td nowrap bgcolor=\"ff0000\">";
+ }
+ else {
+ echo " <tr><td nowrap>";
+ }
+ echo "<input type=\"checkbox\" name=\"cbox_" . $run[$i]["number"] . "_" . $run[$i]["site"] . "\" />";
+ echo " <a href=\"" . $runeditphp . "?runnumber=".$run[$i]["number"]."&runsitenumber=".$run[$i]["site"] .
+ "\">" . $run[$i]["number"] . "</a></td>\n";
+
+ echo " <td nowrap>" . $run[$i]["site"] . "</td>\n";
+ if($runphp == "run.php") {
+ if ($run[$i]["user"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["site"], $run[$i]["user"]);
+ echo " <td nowrap>" . $u["username"] . "</td>\n";
+ }
+ }
+ echo " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["problem"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+// echo " <td nowrap>" . $run[$i]["filename"] . "</td>\n";
+ if ($run[$i]["judge"] == $_SESSION["usertable"]["usernumber"] &&
+ $run[$i]["judgesite"] == $_SESSION["usertable"]["usersitenumber"] && $run[$i]["status"] == "judging")
+ $color="ff7777";
+ else if ($run[$i]["status"]== "judged+" && $run[$i]["judge"]=="") $color="ffff00";
+ else if ($run[$i]["status"]== "judged") $color="bbbbff";
+ else if ($run[$i]["status"] == "judging" || $run[$i]["status"]== "judged+") $color="77ff77";
+ else if ($run[$i]["status"] == "openrun") $color="ffff88";
+ else $color="ffffff";
+
+ echo " <td nowrap bgcolor=\"#$color\">" . $run[$i]["status"] . "</td>\n";
+ if ($run[$i]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["judgesite"], $run[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $run[$i]["judgesite"] . ")";
+ } else
+ echo " <td>&nbsp;";
+
+ if ($run[$i]["judge1"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["judgesite1"], $run[$i]["judge1"]);
+ echo " [" . $u["username"] . " (" . $run[$i]["judgesite1"] . ")]";
+ }
+ if ($run[$i]["judge2"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["judgesite2"], $run[$i]["judge2"]);
+ echo " [" . $u["username"] . " (" . $run[$i]["judgesite2"] . ")]";
+ }
+
+ echo "</td>\n";
+
+ if ($run[$i]["autoend"] != "") {
+ $color="bbbbff";
+ if ($run[$i]["autoanswer"]=="") $color="ff7777";
+ }
+ else if ($run[$i]["autobegin"]=="") $color="ffff88";
+ else $color="77ff77";
+ echo "<td bgcolor=\"#$color\">&nbsp;&nbsp;</td>\n";
+
+ if ($run[$i]["answer"] == "") {
+ echo " <td>&nbsp;</td>\n";
+ } else {
+ echo " <td>" . $run[$i]["answer"];
+ if($run[$i]['yes']=='t') {
+ echo " <img alt=\"".$run[$i]["colorname"]."\" width=\"10\" ".
+ "src=\"" . balloonurl($run[$i]["color"]) ."\" />";
+ }
+ echo "</td>\n";
+ }
+ echo " </tr>\n";
+}
+
+echo "</table>";
+if (count($run) == 0) echo "<br><center><b><font color=\"#ff0000\">NO RUNS AVAILABLE</font></b></center>";
+else {
+?>
+ <br>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+<b>Click on the number of a run to edit it or select them with<br />the checkboxes and use the buttons to work on multiple runs:</b><br /><br />
+ <input type="submit" name="auto" value="Re-run autojudge for selected runs" onClick="conf()">
+ <input type="submit" name="open" value="Open selected runs for rejudging" onClick="conf()">
+<br><br>
+ </center>
+ </form>
+<?php
+}
+?>
+</body>
+</html>
diff --git a/src/judge/runedit.php b/src/judge/runedit.php
new file mode 100644
index 0000000..e53b3a3
--- /dev/null
+++ b/src/judge/runedit.php
@@ -0,0 +1,250 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 21/jul/2012 by cassio@ime.usp.br
+require('header.php');
+
+if (isset($_POST["answer"]) && isset($_POST["giveup"]) && $_POST["giveup"]=="Cancel editing" &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["number"]) &&
+ is_numeric($_POST["sitenumber"])) {
+
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+
+ DBRunGiveUp($_POST["number"],
+ $_POST["sitenumber"],
+ $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"],
+ $_SESSION["usertable"]["usersitenumber"]);
+ MSGError("Run returned.");
+ ForceLoad("run.php");
+}
+
+if (isset($_POST["answer"]) && isset($_POST["Submit"]) && $_POST["Submit"]=="Judge" && is_numeric($_POST["answer"]) &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["sitenumber"]) &&
+ is_numeric($_POST["number"])) { // && isset($_POST["notifyuser"]) && isset($_POST["updatescore"])) {
+
+ if ($_POST["confirmation"] == "confirm") {
+ $answer = myhtmlspecialchars($_POST["answer"]);
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+// $notuser = myhtmlspecialchars($_POST["notifyuser"]);
+// $updscore = myhtmlspecialchars($_POST["updatescore"]);
+
+ DBUpdateRun($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"],
+ $sitenumber, $number, $answer); //, $notuser, $updscore);
+ }
+ ForceLoad("run.php");
+}
+
+if (!isset($_GET["runnumber"]) || !isset($_GET["runsitenumber"]) ||
+ !is_numeric($_GET["runnumber"]) || !is_numeric($_GET["runsitenumber"])) {
+ IntrusionNotify("tried to open the judge/runedit.php with wrong parameters.");
+ ForceLoad("run.php");
+}
+
+$runsitenumber = myhtmlspecialchars($_GET["runsitenumber"]);
+$runnumber = myhtmlspecialchars($_GET["runnumber"]);
+
+if (($a = DBGetRunToAnswer($runnumber, $runsitenumber,
+ $_SESSION["usertable"]["contestnumber"])) === false) {
+ MSGError("Another judge got it first.");
+ ForceLoad("run.php");
+}
+
+$b = DBGetProblemData($_SESSION["usertable"]["contestnumber"], $a["problemnumber"]);
+?>
+<br><br><center><b>Use the following fields to judge the run:
+</b></center>
+<form name="form1" method="post" action="runedit.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <center>
+ <table border="1">
+ <tr>
+ <td width="27%" align=right><b>Site:</b></td>
+ <td width="83%">
+ <input type=hidden name="sitenumber" value="<?php echo $a["sitenumber"]; ?>" />
+ <?php echo $a["sitenumber"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Number:</b></td>
+ <td width="83%">
+ <input type=hidden name="number" value="<?php echo $a["number"]; ?>" />
+ <?php echo $a["number"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Time:</b></td>
+ <td width="83%">
+ <?php echo dateconvminutes($a["timestamp"]); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Problem</b><i> <?php echo $a["problemname"]; ?></i>: </td>
+ <td width="83%">
+<?php
+for ($i=0;$i<count($b);$i++) {
+ $if = rawurlencode($b[$i]["inputfilename"]);
+
+ echo "<a href=\"../filedownload.php?". filedownload($b[$i]["inputoid"],$b[$i]["inputfilename"]) . "\">";
+ echo basename($b[$i]["inputfilename"]) . "</a>";
+}
+?>
+ &nbsp;</td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Language</b>:</td>
+ <td width="83%">
+ <i> <?php echo $a["language"]; ?></i></td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Source code:</b></td>
+ <td width="83%">
+<?php
+echo "<a href=\"../filedownload.php?". filedownload($a["sourceoid"], $a["sourcename"]) . "\">" . $a["sourcename"] . "</a>\n";
+ echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?" .
+ filedownload($a["sourceoid"], $a["sourcename"]) . "', 'View - SOURCE CODE', ".
+ "'width=680,height=600,scrollbars=yes,resizable=yes')\">view</a>\n";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Answer:</b></td>
+ <td width="83%">
+ <select name="answer">
+<?php
+$ans = DBGetAnswers($_SESSION["usertable"]["contestnumber"]);
+for ($i=0;$i<count($ans);$i++)
+ if ($a["answer"] == $ans[$i]["number"])
+ echo "<option selected value=\"" . $ans[$i]["number"] . "\">" . $ans[$i]["desc"] . "</option>\n";
+ else
+ echo "<option value=\"" . $ans[$i]["number"] . "\">" . $ans[$i]["desc"] . "</option>\n";
+?>
+ </select>
+ </td>
+ </tr>
+<!--
+ <tr>
+ <td width="27%" align=right><b>Notify user:</b></td>
+ <td width="83%">
+ <input class=checkbox type=checkbox name="notifyuser" value="yes"
+<?php
+if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+if ($a["timestamp"] < $s["sitelastmileanswer"]) echo "checked"; ?>>
+(do not change this unless you know exactly what you are doing)
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Update score board:</b></td>
+ <td width="83%">
+ <input class=checkbox type=checkbox name="updatescore" value="yes"
+<?php if ($a["timestamp"] < $s["sitelastmilescore"]) echo "checked"; ?>>
+(do not change this unless you know exactly what you are doing)
+ </td>
+ </tr>
+-->
+ </table>
+ </center>
+ <br>
+ <script language="javascript">
+ function conf() {
+// if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+// }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Judge" onClick="conf()">
+ <input type="submit" name="giveup" value="Cancel editing">
+ <input type="reset" name="Submit2" value="Clear">
+
+<br><br>
+<!--
+<font color=#ff0000><b>
+Remember to not leave the correct output files in a readable directory.<br>
+A malicious source code could try to find the correct output file on the disk and copy it.
+</b></font>
+-->
+ </center>
+
+ <center>
+<br>
+<b>Autojudging:</b>
+<br><br>
+ <table border="1">
+ <tr>
+ <td width="27%" align=right><b>Autojudging answer:</b></td>
+ <td width="83%">
+<?php
+if($a["autobegin"]!="" && $a["autoend"]=="")
+ echo "in progress";
+else if($a["autoend"]!="") {
+ if($a["autoanswer"]!="") echo $a["autoanswer"];
+ else echo "Autojudging error";
+} else
+ echo "unavailable";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Autojudged by:</b></td>
+<?php if($a["autobegin"]!="" && $a["autoend"]=="")
+ echo "<td width=\"83%\">". $a["autoip"] ." since ". dateconvsimple($a["autobegin"]) ."</td>";
+else if($a["autoend"]!="")
+ echo "<td width=\"83%\">". $a["autoip"] ." from ". dateconvsimple($a["autobegin"]) ." to ". dateconvsimple($a["autoend"]) ."</td>";
+else
+ echo "<td width=\"83%\">unavailable</td>";
+?>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Standard output:</b></td>
+ <td width="83%">
+<?php
+if($a["autostdout"]!="") {
+ echo "<a href=\"../filedownload.php?". filedownload($a["autostdout"],"stdout") ."\">stdout</a>\n";
+ echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($a["autostdout"],"stdout") ."', 'View - STDOUT','width=680,height=600,scrollbars=yes,".
+ "resizable=yes')\">view</a>\n";
+} else
+ echo "unavailable";
+?>
+</td>
+ </tr>
+<tr>
+<td width="27%" align=right><b>Standard error:</b></td>
+ <td width="83%">
+<?php
+if($a["autostderr"]!="") {
+ echo "<a href=\"../filedownload.php?". filedownload($a["autostderr"], "stderr") ."\">stderr</a>\n";
+ echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($a["autostderr"], "stderr") ."', 'View - STDERR','width=680,height=600,scrollbars=yes,".
+ "resizable=yes')\">view</a>\n";
+} else
+ echo "unavailable";
+?>
+ </td>
+ </tr>
+ </table></center>
+
+</form>
+</body>
+</html>
diff --git a/src/judge/runeditchief.php b/src/judge/runeditchief.php
new file mode 100644
index 0000000..c538dca
--- /dev/null
+++ b/src/judge/runeditchief.php
@@ -0,0 +1,320 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require 'header.php';
+
+if (isset($_POST["cancel"]) && $_POST["cancel"]=="Cancel editing")
+ ForceLoad($runphp);
+
+if (isset($_POST["giveup"]) && $_POST["giveup"]=="Renew" &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["number"]) &&
+ is_numeric($_POST["sitenumber"])) {
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+ if (DBGiveUpRunAutojudging($_SESSION["usertable"]["contestnumber"], $sitenumber, $number))
+ MSGError("Run renewed.");
+ ForceLoad($runphp);
+}
+
+if (isset($_POST["delete"]) && $_POST["delete"]=="Delete" &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["number"]) &&
+ is_numeric($_POST["sitenumber"])) {
+ if ($_POST["confirmation"]=="confirm") {
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+
+ if (DBRunDelete($number, $sitenumber, $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]))
+ MSGError("Run deleted.");
+ }
+ ForceLoad($runphp);
+}
+
+if (isset($_POST["answer"]) && isset($_POST["open"]) && $_POST["open"]=="Open run for rejudging" &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["number"]) &&
+ is_numeric($_POST["sitenumber"])) {
+
+ if ($_POST["confirmation"] == "confirm") {
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+
+ DBGiveUpRunAutojudging($_SESSION["usertable"]["contestnumber"], $sitenumber, $number);
+ if (DBChiefRunGiveUp($_POST["number"], $_POST["sitenumber"], $_SESSION["usertable"]["contestnumber"]))
+ MSGError("Run returned.");
+ ForceLoad($runphp);
+ }
+}
+
+if (isset($_POST["answer"]) && isset($_POST["Submit"]) && $_POST["Submit"]=="Judge" && is_numeric($_POST["answer"]) &&
+ isset($_POST["sitenumber"]) && isset($_POST["number"]) && is_numeric($_POST["sitenumber"]) &&
+ is_numeric($_POST["number"])) { // && isset($_POST["notifyuser"]) && isset($_POST["updatescore"])) {
+
+ if ($_POST["confirmation"] == "confirm") {
+ $answer = myhtmlspecialchars($_POST["answer"]);
+ $sitenumber = myhtmlspecialchars($_POST["sitenumber"]);
+ $number = myhtmlspecialchars($_POST["number"]);
+// $notuser = myhtmlspecialchars($_POST["notifyuser"]);
+// $updscore = myhtmlspecialchars($_POST["updatescore"]);
+
+ DBChiefUpdateRun($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"],
+ $sitenumber, $number, $answer); //, $notuser, updscore);
+ }
+ ForceLoad($runphp);
+}
+
+if (!isset($_GET["runnumber"]) || !isset($_GET["runsitenumber"]) ||
+ !is_numeric($_GET["runnumber"]) || !is_numeric($_GET["runsitenumber"])) {
+ IntrusionNotify("tried to open the admin/runedit.php with wrong parameters.");
+ ForceLoad($runphp);
+}
+
+// ???
+$runsitenumber = myhtmlspecialchars($_GET["runsitenumber"]);
+$runnumber = myhtmlspecialchars($_GET["runnumber"]);
+
+if (($a = DBChiefGetRunToAnswer($runnumber, $runsitenumber,
+ $_SESSION["usertable"]["contestnumber"])) === false) {
+ MSGError("Another judge got it first.");
+ ForceLoad($runphp);
+}
+
+$b = DBGetProblemData($_SESSION["usertable"]["contestnumber"], $a["problemnumber"]);
+?>
+<br><br><center><b>Use the following fields to judge the run:
+</b></center>
+<form name="form1" method="post" action="<?php echo $runeditphp; ?>">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <center>
+ <table border="1">
+ <tr>
+ <td width="27%" align=right><b>Site:</b></td>
+ <td width="83%">
+ <input type=hidden name="sitenumber" value="<?php echo $a["sitenumber"]; ?>" />
+ <?php echo $a["sitenumber"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Number:</b></td>
+ <td width="83%">
+ <input type=hidden name="number" value="<?php echo $a["number"]; ?>" />
+ <?php echo $a["number"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Time:</b></td>
+ <td width="83%">
+ <?php echo dateconvminutes($a["timestamp"]); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Problem</b><i> <?php echo $a["problemname"]; ?></i>: </td>
+ <td width="83%">
+<?php
+for ($i=0;$i<count($b);$i++) {
+ echo "<b>Input:</b><a href=\"../filedownload.php?". filedownload($b[$i]["inputoid"], $b[$i]["inputfilename"]) ."\">";
+ echo $b[$i]["inputfilename"] . "</a>";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($b[$i]["inputoid"], $b[$i]["inputfilename"]) ."', 'View$i - INPUT','width=680,height=600,scrollbars=yes,resizable=yes')\">view</a> &nbsp;";
+
+ echo "<b>Sol:</b><a href=\"../filedownload.php?". filedownload($b[$i]["soloid"], $b[$i]["solfilename"]) . "\">";
+ echo $b[$i]["solfilename"] . "</a>";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($b[$i]["soloid"], $b[$i]["solfilename"]) ."', 'View$i - CORRECT OUTPUT','width=680,height=600,scrollbars=yes,resizable=yes')\">view</a>";
+}
+?>
+ &nbsp;</td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Language</b>:</td>
+ <td width="83%"><i> <?php echo $a["language"]; ?></i>
+ &nbsp;</td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Source code:</b></td>
+ <td width="83%">
+<?php
+ echo "<a href=\"../filedownload.php?". filedownload($a["sourceoid"],$a["sourcename"]) . "\">" . $a["sourcename"] . "</a>\n";
+echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?" .
+filedownload($a["sourceoid"],$a["sourcename"]) ."', 'View - SOURCE', ".
+"'width=680,height=600,scrollbars=yes,resizable=yes')\">view</a>\n";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Answer:</b></td>
+ <td width="83%">
+ <select name="answer">
+<?php
+$ans = DBGetAnswers($_SESSION["usertable"]["contestnumber"]);
+//$isfak = true;
+for ($i=0;$i<count($ans);$i++)
+ if ($a["answer"] == $ans[$i]["number"]) {
+// if($ans[$i]["fake"] != "t") $isfak = false;
+ echo "<option selected value=\"" . $ans[$i]["number"] . "\">" . $ans[$i]["desc"] . "</option>\n";
+ } else
+ echo "<option value=\"" . $ans[$i]["number"] . "\">" . $ans[$i]["desc"] . "</option>\n";
+ echo "</select>";
+// if(!$isfak) {
+ if($a["judgesite"] != "" && $a["judge"] != "") {
+ $uu = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $a["judgesite"], $a["judge"]);
+ echo " [judge=" . $uu["username"] . " (" . $a["judgesite"] . ")]";
+ }
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Answer 1:</b></td>
+ <td width="83%">
+<?php
+$ans = DBGetAnswers($_SESSION["usertable"]["contestnumber"]);
+for ($i=0;$i<count($ans);$i++)
+ if ($a["answer1"] == $ans[$i]["number"]) {
+// if($ans[$i]["fake"] != "t") {
+ if($a["judgesite1"] != "" && $a["judge1"] != "") {
+ $uu = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $a["judgesite1"], $a["judge1"]);
+ echo $ans[$i]["desc"] . " [judge=" . $uu["username"] . " (" . $a["judgesite1"] . ")]";
+ } else
+ echo $ans[$i]["desc"];
+ }
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Answer 2:</b></td>
+ <td width="83%">
+<?php
+$ans = DBGetAnswers($_SESSION["usertable"]["contestnumber"]);
+for ($i=0;$i<count($ans);$i++)
+ if ($a["answer2"] == $ans[$i]["number"]) {
+// if($ans[$i]["fake"] != "t") {
+ if($a["judgesite2"] != "" && $a["judge2"] != "") {
+ $uu = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $a["judgesite2"], $a["judge2"]);
+ echo $ans[$i]["desc"] . " [judge=" . $uu["username"] . " (" . $a["judgesite2"] . ")]";
+ } else
+ echo $ans[$i]["desc"];
+ }
+?>
+ </td>
+ </tr>
+
+<!--
+ <tr>
+ <td width="27%" align=right><b>Notify user:</b></td>
+ <td width="83%">
+ <input class=checkbox type=checkbox name="notifyuser" value="yes"
+<?php
+if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+if ($a["timestamp"] < $s["sitelastmileanswer"]) echo "checked"; ?>>
+(do not change this unless you know exactly what you are doing)
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Update score board:</b></td>
+ <td width="83%">
+ <input class=checkbox type=checkbox name="updatescore" value="yes"
+<?php if ($a["timestamp"] < $s["sitelastmilescore"]) echo "checked"; ?>>
+(do not change this unless you know exactly what you are doing)
+ </td>
+ </tr>
+-->
+ </table>
+ </center>
+ <br>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Judge" onClick="conf()">
+ <input type="submit" name="open" value="Open run for rejudging" onClick="conf()">
+ <input type="submit" name="cancel" value="Cancel editing">
+ <input type="submit" name="delete" value="Delete" onClick="conf()">
+ <input type="reset" name="Submit2" value="Clear">
+<br><br>
+ </center>
+
+ <center>
+<br>
+<b>Autojudging:</b>
+<input type="submit" name="giveup" value="Renew">
+<br><br>
+ <table border="1">
+ <tr>
+ <td width="27%" align=right><b>Autojudging answer:</b></td>
+ <td width="83%">
+<?php
+if($a["autobegin"]!="" && $a["autoend"]=="")
+ echo "in progress";
+else if($a["autoend"]!="") {
+ if($a["autoanswer"]!="") echo $a["autoanswer"];
+ else echo "Autojudging error";
+} else
+ echo "unavailable";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Autojudged by:</b></td>
+<?php if($a["autobegin"]!="" && $a["autoend"]=="")
+ echo "<td width=\"83%\">". $a["autoip"] ." since ". dateconvsimple($a["autobegin"]) ."</td>";
+else if($a["autoend"]!="")
+ echo "<td width=\"83%\">". $a["autoip"] ." from ". dateconvsimple($a["autobegin"]) ." to ". dateconvsimple($a["autoend"]) ."</td>";
+else
+ echo "<td width=\"83%\">unavailable</td>";
+?>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Standard output:</b></td>
+ <td width="83%">
+<?php
+if($a["autostdout"]!="") {
+ echo "<a href=\"../filedownload.php?".filedownload($a["autostdout"],"stdout") ."\">stdout</a>\n";
+ echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($a["autostdout"],"stdout") ."', 'View - STDOUT','width=680,height=600,scrollbars=yes,".
+ "resizable=yes')\">view</a>\n";
+} else
+ echo "unavailable";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Standard error:</b></td>
+ <td width="83%">
+<?php
+if($a["autostderr"]!="") {
+ echo "<a href=\"../filedownload.php?". filedownload($a["autostderr"],"stderr") . "\">stderr</a>\n";
+ echo "<a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($a["autostderr"],"stderr") ."', 'View - STDERR','width=680,height=600,scrollbars=yes,".
+ "resizable=yes')\">view</a>\n";
+} else
+ echo "unavailable";
+?>
+ </td>
+ </tr>
+ </table></center>
+
+</form>
+</body>
+</html>
diff --git a/src/judge/score.php b/src/judge/score.php
new file mode 100644
index 0000000..bea0800
--- /dev/null
+++ b/src/judge/score.php
@@ -0,0 +1,21 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 21/jul/2012 by cassio@ime.usp.br
+require('header.php');
+require('../scorelower.php');
+?>
diff --git a/src/judge/team.php b/src/judge/team.php
new file mode 100644
index 0000000..11d03ad
--- /dev/null
+++ b/src/judge/team.php
@@ -0,0 +1,195 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 21/jul/2012 by cassio@ime.usp.br
+require('header.php');
+
+if (isset($_FILES["sourcefile"]) && isset($_POST["problem"]) && isset($_POST["Submit"]) && isset($_POST["language"]) &&
+ is_numeric($_POST["problem"]) && is_numeric($_POST["language"]) && $_FILES["sourcefile"]["name"]!="") {
+ if ($_POST["confirmation"] == "confirm") {
+ if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+
+ $prob = myhtmlspecialchars($_POST["problem"]);
+ $lang = myhtmlspecialchars($_POST["language"]);
+
+ $type=myhtmlspecialchars($_FILES["sourcefile"]["type"]);
+ $size=myhtmlspecialchars($_FILES["sourcefile"]["size"]);
+ $name=myhtmlspecialchars($_FILES["sourcefile"]["name"]);
+ $temp=myhtmlspecialchars($_FILES["sourcefile"]["tmp_name"]);
+
+ if ($size > $ct["contestmaxfilesize"]) {
+ LOGLevel("User {$_SESSION["usertable"]["username"]} tried to submit file " .
+ "$name with $size bytes ({$ct["contestmaxfilesize"]} max allowed).", 1);
+ MSGError("File size exceeds the limit allowed.");
+ ForceLoad($runteam);
+ }
+ if(strpos($name,' ') === true || strpos($temp,' ') === true) {
+ MSGError("File name cannot contain spaces.");
+ ForceLoad($runteam);
+ }
+ if (!is_uploaded_file($temp) || strlen($name)>100) {
+ IntrusionNotify("file upload problem.");
+ ForceLoad("../index.php");
+ }
+
+
+ $ac=array('contest','site','user','problem','lang','filename','filepath');
+ $ac1=array('runnumber','rundate','rundatediff','rundatediffans','runanswer','runstatus','runjudge','runjudgesite',
+ 'runjudge1','runjudgesite1','runanswer1','runjudge2','runjudgesite2','runanswer2',
+ 'autoip','autobegindate','autoenddate','autoanswer','autostdout','autostderr','updatetime');
+ $param = array('contest'=>$_SESSION["usertable"]["contestnumber"],
+ 'site'=>$_SESSION["usertable"]["usersitenumber"],
+ 'user'=> $_SESSION["usertable"]["usernumber"],
+ 'problem'=>$prob,
+ 'lang'=>$lang,
+ 'filename'=>$name,
+ 'filepath'=>$temp);
+ if($runteam=='team.php') $param['allowneg']=1;
+ DBNewRun ($param);
+ $_SESSION['forceredo']=true;
+ }
+ ForceLoad($runteam);
+}
+
+$ds = DIRECTORY_SEPARATOR;
+if($ds=="") $ds = "/";
+
+$runtmp = $_SESSION["locr"] . $ds . "private" . $ds . "runtmp" . $ds . "run-contest" . $_SESSION["usertable"]["contestnumber"] .
+ "-site". $_SESSION["usertable"]["usersitenumber"] . "-user" . $_SESSION["usertable"]["usernumber"] . ".php";
+$redo = TRUE;
+if(!isset($_SESSION['forceredo']) || $_SESSION['forceredo']==false) {
+ $actualdelay = 30;
+ if(file_exists($runtmp)) {
+ if(isset($strtmp) || (($strtmp = file_get_contents($runtmp,FALSE,NULL,-1,1000000)) !== FALSE)) {
+ list($d) = sscanf($strtmp,"%*s %d");
+ if($d > time() - $actualdelay) {
+ $conf=globalconf();
+ $strtmp = decryptData(substr($strtmp,strpos($strtmp,"\n")+1),$conf["key"],'runtmp');
+ if($strtmp !== false)
+ $redo = FALSE;
+ }
+ }
+ }
+}
+if($redo) {
+ $_SESSION['forceredo']=false;
+ if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+ $strtmp="<br>\n<table width=\"100%\" border=1>\n <tr>\n <td><b>Run #</b></td>\n<td><b>Time</b></td>\n".
+ " <td><b>Problem</b></td>\n <td><b>Language</b></td>\n <td><b>Answer</b></td>\n <td><b>File</b></td>\n </tr>\n";
+ $strcolors = "0";
+ $run = DBUserRuns($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"]);
+ for ($i=0; $i<count($run); $i++) {
+ $strtmp .= " <tr>\n";
+ $strtmp .= " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ $strtmp .= " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+ $strtmp .= " <td nowrap>" . $run[$i]["problem"] . "</td>\n";
+ $strtmp .= " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+// $strtmp .= " <td nowrap>" . $run[$i]["status"] . "</td>\n";
+ if (trim($run[$i]["answer"]) == "") {
+ $run[$i]["answer"] = "Not answered yet";
+ $strtmp .= " <td>Not answered yet";
+ }
+ else {
+ $strtmp .= " <td>" . $run[$i]["answer"];
+ if($run[$i]['yes']=='t') {
+ $strtmp .= " <img alt=\"".$run[$i]["colorname"]."\" width=\"15\" ".
+ "src=\"" . balloonurl($run[$i]["color"]) ."\" />";
+ $strcolors .= "\t" . $run[$i]["colorname"] . "\t" . $run[$i]["color"];
+ }
+ }
+ $strtmp .= "</td>\n";
+ $strtmp .= "<td nowrap><a href=\"../filedownload.php?" . filedownload($run[$i]["oid"],$run[$i]["filename"]) . "\">";
+ $strtmp .= $run[$i]["filename"] . "</a>";
+
+ $strtmp .= "</td>\n";
+
+ $strtmp .= " </tr>\n";
+
+ if ($run[$i]["anstime"]>$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && $run[$i]["anstime"] < $st['sitelastmileanswer'] &&
+ $run[$i]["ansfake"]!="t" && !isset($_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]])) {
+ $_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]] = "Run ".$run[$i]["number"]." result: ".$run[$i]["answer"]. "<br>";
+ }
+ }
+$strtmp .= "</table>";
+if (count($run) == 0) $strtmp .= "<br><center><b><font color=\"#ff0000\">NO RUNS AVAILABLE</font></b></center>";
+
+$strtmp .= "<br><br><center><b>To submit a program, just fill in the following fields:</b></center>\n".
+"<form name=\"form1\" enctype=\"multipart/form-data\" method=\"post\" action=\"". $runteam ."\">\n".
+" <input type=hidden name=\"confirmation\" value=\"noconfirm\" />\n".
+" <center>\n".
+" <table border=\"0\">\n".
+" <tr> \n".
+" <td width=\"25%\" align=right>Problem:</td>\n".
+" <td width=\"75%\">\n".
+" <select name=\"problem\" onclick=\"Arquivo()\">\n";
+$prob = DBGetProblems($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usertype"]=='judge');
+for ($i=0;$i<count($prob);$i++)
+ $strtmp .= "<option value=\"" . $prob[$i]["number"] . "\">" . $prob[$i]["problem"] . "</option>\n";
+$strtmp .= " </select>\n".
+" </td>\n".
+" </tr>\n".
+" <tr> \n".
+" <td width=\"25%\" align=right>Language:</td>\n".
+" <td width=\"75%\"> \n".
+" <select name=\"language\" onclick=\"Arquivo()\">\n";
+$lang = DBGetLanguages($_SESSION["usertable"]["contestnumber"]);
+for ($i=0;$i<count($lang);$i++)
+ $strtmp .= "<option value=\"" . $lang[$i]["number"] . "\">" . $lang[$i]["name"] . "</option>\n";
+$strtmp .= " </select>\n".
+" </td>\n".
+" </tr>\n".
+" <tr> \n".
+" <td width=\"25%\" align=right>Source code:</td>\n".
+" <td width=\"75%\">\n".
+" <input type=\"file\" name=\"sourcefile\" size=\"40\" onclick=\"Arquivo()\">\n".
+" </td>\n".
+" </tr>\n".
+" </table>\n".
+" </center>\n".
+" <script language=\"javascript\">\n".
+" function conf() {\n".
+" if (confirm(\"Confirm submission?\")) {\n".
+" document.form1.confirmation.value='confirm';\n".
+" }\n".
+" }\n".
+" </script>\n".
+" <center>\n".
+" <input type=\"submit\" name=\"Submit\" value=\"Send\" onClick=\"conf()\">\n".
+" <input type=\"reset\" name=\"Submit2\" value=\"Clear\">\n".
+" </center>\n".
+"</form>\n";
+ $conf=globalconf();
+ $strtmp1 = "<!-- " . time() . " --> <?php exit; ?>\t" . encryptData($strcolors,$conf["key"],false) . "\n" . encryptData($strtmp,$conf["key"],false);
+ $randnum = session_id() . "_" . rand();
+ if(file_put_contents($runtmp . "_" . $randnum, $strtmp1,LOCK_EX)===FALSE) {
+ if(!isset($_SESSION['writewarn'])) {
+ LOGError("Cannot write to the user-run cache file $runtmp -- performance might be compromised");
+ $_SESSION['writewarn']=true;
+ }
+ }
+ @rename($runtmp . "_" . $randnum, $runtmp);
+}
+echo $strtmp;
+?>
+
+
+</body>
+</html>