aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/src/admin
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-08-06 09:09:10 +0000
committercassiopc <cassiopc@gmail.com>2012-08-06 09:09:10 +0000
commit866658cded5b92ddb2681dead1ebaf111d712fcc (patch)
treecf7534c4726a142189e096ce82f8d73b2a398ecc /boca-1.5.0/src/admin
downloadboca-866658cded5b92ddb2681dead1ebaf111d712fcc.tar.gz
boca-866658cded5b92ddb2681dead1ebaf111d712fcc.zip
init
Diffstat (limited to 'boca-1.5.0/src/admin')
-rw-r--r--boca-1.5.0/src/admin/answer.php134
-rw-r--r--boca-1.5.0/src/admin/clar.php112
-rw-r--r--boca-1.5.0/src/admin/claredit.php171
-rw-r--r--boca-1.5.0/src/admin/contest.php252
-rw-r--r--boca-1.5.0/src/admin/export.php121
-rw-r--r--boca-1.5.0/src/admin/files.php78
-rw-r--r--boca-1.5.0/src/admin/header.php88
-rw-r--r--boca-1.5.0/src/admin/index.php22
-rw-r--r--boca-1.5.0/src/admin/language.php124
-rw-r--r--boca-1.5.0/src/admin/log.php76
-rw-r--r--boca-1.5.0/src/admin/option.php21
-rw-r--r--boca-1.5.0/src/admin/problem.php262
-rw-r--r--boca-1.5.0/src/admin/report.php89
-rw-r--r--boca-1.5.0/src/admin/report/clar.php82
-rw-r--r--boca-1.5.0/src/admin/report/header.php65
-rw-r--r--boca-1.5.0/src/admin/report/icpc.php46
-rw-r--r--boca-1.5.0/src/admin/report/linechart.php45
-rw-r--r--boca-1.5.0/src/admin/report/piechart.php60
-rw-r--r--boca-1.5.0/src/admin/report/run.php93
-rw-r--r--boca-1.5.0/src/admin/report/score.php43
-rw-r--r--boca-1.5.0/src/admin/report/site.php128
-rw-r--r--boca-1.5.0/src/admin/report/stat.php337
-rw-r--r--boca-1.5.0/src/admin/report/task.php68
-rw-r--r--boca-1.5.0/src/admin/run.php187
-rw-r--r--boca-1.5.0/src/admin/runedit.php331
-rw-r--r--boca-1.5.0/src/admin/score.php21
-rw-r--r--boca-1.5.0/src/admin/site.php605
-rw-r--r--boca-1.5.0/src/admin/task.php147
-rw-r--r--boca-1.5.0/src/admin/user.php444
29 files changed, 4252 insertions, 0 deletions
diff --git a/boca-1.5.0/src/admin/answer.php b/boca-1.5.0/src/admin/answer.php
new file mode 100644
index 0000000..c2d1fdc
--- /dev/null
+++ b/boca-1.5.0/src/admin/answer.php
@@ -0,0 +1,134 @@
+<?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(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("$loc/index.php");
+
+if (isset($_GET["delete"]) && is_numeric($_GET["delete"])) {
+ $param["number"] = $_GET["delete"];
+ if(!DBDeleteAnswer($_SESSION["usertable"]["contestnumber"], $param)) {
+ MSGError('Error deleting answer');
+ LogError('Error deleting answer');
+ }
+ ForceLoad("answer.php");
+}
+
+if (isset($_POST["Submit3"]) && isset($_POST["answernumber"]) && is_numeric($_POST["answernumber"]) && isset($_POST["answername"]) &&
+ $_POST["answername"] != "" && isset($_POST["answeryes"])) {
+ if ($_POST["confirmation"] == "confirm") {
+ $param["number"] = $_POST["answernumber"];
+ $param["name"] = $_POST["answername"];
+ $param["yes"] = $_POST["answeryes"];
+ DBNewAnswer ($_SESSION["usertable"]["contestnumber"],$param);
+ }
+ ForceLoad("answer.php");
+}
+?>
+<br>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ function conf2(url) {
+ if (confirm("Confirm the DELETION of the ANSWER and ALL data associated to it (including the SUBMISSIONS)?")) {
+ if (confirm("Are you REALLY sure about what you are doing? DATA CANNOT BE RECOVERED!")) {
+ document.location=url;
+ } else {
+ document.location='answer.php';
+ }
+ } else {
+ document.location='answer.php';
+ }
+ }
+ </script>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Answer #</b></td>
+ <td><b>Description</b></td>
+ <td><b>Yes/No</b></td>
+ </tr>
+<?php
+$ans = DBGetAnswers($_SESSION["usertable"]["contestnumber"]);
+$n=0;
+for ($i=0; $i<count($ans); $i++) {
+ echo " <tr>\n";
+ if($ans[$i]["fake"]!="t") {
+ if($ans[$i]["number"]>7) {
+ echo " <td nowrap><a href=\"javascript:conf2('answer.php?delete=" . $ans[$i]["number"] .
+ "')\">" . $ans[$i]["number"] . "</a></td>\n";
+ } else
+ echo " <td nowrap>".$ans[$i]["number"]."</td>\n";
+ } else {
+ echo " <td nowrap>".$ans[$i]["number"]." (fake)</td>\n";
+ }
+ echo " <td nowrap>" . $ans[$i]["desc"] . "</td>\n";
+ if($ans[$i]["yes"]=="t") echo " <td nowrap>Yes</td>\n";
+ else echo " <td nowrap>No</td>\n";
+ echo " </tr>\n";
+ $n++;
+}
+echo "</table>";
+if ($n == 0) echo "<br><center><b><font color=\"#ff0000\">NO ANSWERS DEFINED</font></b></center>";
+?>
+
+<br><br><center><b>When allowed, clicking on the answer number will delete it.<br>
+ Inputting with the same number of an existing one will update its description.<br>
+ TAKE CARE: deleting an answer will remove EVERYTHING related to it (ALSO IN OTHER TABLES!!).<br>
+ It is NOT recommended to change anything while the contest is running.<br>
+ To insert a new answer, enter the data below.<br>
+ Note that any changes will overwrite the already defined data.<br><br>
+</b>
+<form name="form1" enctype="multipart/form-data" method="post" action="answer.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>Number:</td>
+ <td width="65%">
+ <input type="text" name="answernumber" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Description:</td>
+ <td width="65%">
+ <input type="text" name="answername" value="" size="50" maxlength="50" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Type:</td>
+ <td width="65%">
+ <select name="answeryes">
+ <option selected value="f">No</option>
+ <option value="t">Yes</option>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+ <input type="submit" name="Submit3" value="Send" onClick="conf()">
+ <input type="reset" name="Submit4" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/clar.php b/boca-1.5.0/src/admin/clar.php
new file mode 100644
index 0000000..66a7b0d
--- /dev/null
+++ b/boca-1.5.0/src/admin/clar.php
@@ -0,0 +1,112 @@
+<?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");
+}
+if(isset($_GET["order"]) && $_GET["order"] != "") {
+ $order = htmlspecialchars($_GET["order"]);
+ $_SESSION["clarline"] = $order;
+} else {
+ if(isset($_SESSION["clarline"]))
+ $order = $_SESSION["clarline"];
+ else
+ $order='';
+}
+?>
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b><a href="clar.php?order=clar">Clar #</a></b></td>
+ <td><b><a href="clar.php?order=site">Site</a></b></td>
+ <td><b><a href="clar.php?order=user">User</a></b></td>
+ <td><b>Time</b></td>
+ <td><b><a href="clar.php?order=problem">Problem</a></b></td>
+ <td><b><a href="clar.php?order=status">Status</a></b></td>
+ <td><b><a href="clar.php?order=judge">Judge (Site)</a></b></td>
+ <td><b>Question</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+
+if(($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("$loc/index.php");
+
+// forca aparecer as clars do proprio site
+if (trim($s["sitejudging"])!="") $s["sitejudging"].=",".$_SESSION["usertable"]["usersitenumber"];
+else $s["sitejudging"]=$_SESSION["usertable"]["usersitenumber"];
+
+$clar = DBAllClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], $order);
+
+for ($i=0; $i<count($clar); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap><a href=\"claredit.php?clarnumber=".$clar[$i]["number"]."&clarsitenumber=".$clar[$i]["site"] .
+ "\">" . $clar[$i]["number"] . "</a></td>\n";
+ echo " <td nowrap>" . $clar[$i]["site"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["user"] . "</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"] && $clar[$i]["status"] == "answering")
+ $color="ff7777";
+ else if (strpos($clar[$i]["status"], "answered") !== false) $color="bbbbff";
+ 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]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $clar[$i]["judgesite"], $clar[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $clar[$i]["judgesite"] . ")</td>\n";
+ }
+ else
+ echo " <td>&nbsp;</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";
+ 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>";
+
+?>
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/claredit.php b/boca-1.5.0/src/admin/claredit.php
new file mode 100644
index 0000000..91fae39
--- /dev/null
+++ b/boca-1.5.0/src/admin/claredit.php
@@ -0,0 +1,171 @@
+<?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")
+ ForceLoad("clar.php");
+
+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 (DBClarDelete($number, $sitenumber, $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]))
+ MSGError("Clarification deleted.");
+ }
+ ForceLoad("clar.php");
+}
+
+if (isset($_POST["answer"]) && isset($_POST["open"]) && $_POST["open"]=="Open the Clar" &&
+ 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 (DBChiefClarGiveUp($number, $sitenumber, $_SESSION["usertable"]["contestnumber"]))
+ MSGError("Clarification returned.");
+ ForceLoad("clar.php");
+ }
+}
+
+if (isset($_POST["answer"]) && isset($_POST["Submit"]) && $_POST["Submit"]=="Answer" && 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 (isset($_POST["answerall"])) $type='all';
+ else if (isset($_POST["answersite"])) $type='site';
+ else $type = 'none';
+
+ if (trim($ans)=="") {
+ DBClarGiveUp($number, $sitenumber, $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ MSGError("Clarification returned.");
+ } else {
+ DBChiefUpdateClar($_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 admin/claredit.php with wrong parameters.");
+ ForceLoad("clar.php");
+}
+
+$clarsitenumber = myhtmlspecialchars($_GET["clarsitenumber"]);
+$clarnumber = myhtmlspecialchars($_GET["clarnumber"]);
+
+if (($a = DBChiefGetClarToAnswer($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 <?php if ($a["status"] == "answeredsite") echo "checked"; ?> 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 <?php if ($a["status"] == "answeredall") echo "checked"; ?> name="answerall" value="yes">
+ </td>
+ </tr>
+-->
+ </table>
+ </center>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Answer" onClick="conf()">
+ <input type="submit" name="open" value="Open the Clar" onClick="conf()">
+ <input type="submit" name="cancel" value="Cancel">
+ <input type="submit" name="delete" value="Delete" onClick="conf()">
+ <input type="reset" name="Submit2" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/contest.php b/boca-1.5.0/src/admin/contest.php
new file mode 100644
index 0000000..361b55b
--- /dev/null
+++ b/boca-1.5.0/src/admin/contest.php
@@ -0,0 +1,252 @@
+<?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';
+
+$contest=$_SESSION["usertable"]["contestnumber"];
+
+if(($ct = DBContestInfo($contest)) == null)
+ ForceLoad("$loc/index.php");
+if ($ct["contestlocalsite"]==$ct["contestmainsite"]) $main=true; else $main=false;
+
+if (isset($_POST["Submit3"]) && isset($_POST["penalty"]) && is_numeric($_POST["penalty"]) &&
+ isset($_POST["maxfilesize"]) && isset($_POST["mainsite"]) && isset($_POST["name"]) &&
+ $_POST["name"] != "" && isset($_POST["lastmileanswer"]) && is_numeric($_POST["lastmileanswer"]) &&
+ is_numeric($_POST["mainsite"]) && isset($_POST["lastmilescore"]) && is_numeric($_POST["lastmilescore"]) &&
+ isset($_POST["duration"]) && is_numeric($_POST["duration"]) && isset($_POST['localsite']) &&
+ isset($_POST["startdateh"]) && $_POST["startdateh"] >= 0 && $_POST["startdateh"] <= 23 &&
+ isset($_POST["startdatemin"]) && $_POST["startdatemin"] >= 0 && $_POST["startdatemin"] <= 59 &&
+ isset($_POST["startdated"]) && isset($_POST["startdatem"]) && isset($_POST["startdatey"]) &&
+ checkdate($_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"])) {
+ if ($_POST["confirmation"] == "confirm") {
+ $param['number']=$contest;
+ if($_POST["Submit3"] == "Become Main Site") {
+ $param['mainsite']=$ct["contestlocalsite"];
+ } else {
+ $at = false;
+ if(!is_numeric($_POST['localsite']) || $_POST['localsite']<=0) $_POST['localsite']=-1;
+ if($_POST["Submit3"] == "Update Contest and All Sites") $at = true;
+ $t = mktime ($_POST["startdateh"], $_POST["startdatemin"], 0,
+ $_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"]);
+ $param['localsite']=$_POST['localsite'];
+ $param['name']=$_POST["name"];
+ $param['startdate']=$t;
+ $param['duration']=$_POST["duration"]*60;
+ $param['lastmileanswer']=$_POST["lastmileanswer"]*60;
+ $param['lastmilescore']= $_POST["lastmilescore"]*60;
+ $param['penalty']=$_POST["penalty"]*60;
+ $param['maxfilesize']=$_POST["maxfilesize"]*1000;
+ $param['active']=0;
+ $param['mainsite']=$_POST["mainsite"];
+ $param['mainsiteurl']=$_POST["mainsiteurl"];
+ $param['unlockkey']=$_POST["unlockkey"];
+
+ if (isset($_FILES["keyfile"]) && $_FILES["keyfile"]["name"]!="") {
+ $type=myhtmlspecialchars($_FILES["keyfile"]["type"]);
+ $size=myhtmlspecialchars($_FILES["keyfile"]["size"]);
+ $name=myhtmlspecialchars($_FILES["keyfile"]["name"]);
+ $temp=myhtmlspecialchars($_FILES["keyfile"]["tmp_name"]);
+ if (!is_uploaded_file($temp)) {
+ IntrusionNotify("file upload problem.");
+ ForceLoad("../index.php");
+ }
+ if (($ar = file($temp)) === false) {
+ IntrusionNotify("Unable to open the uploaded file.");
+ ForceLoad("user.php");
+ }
+ $dd=0;
+ foreach($ar as $val => $key) {
+ $key=trim($key);
+ if($key=='') {
+ unset($ar[$val]);
+ continue;
+ }
+ if(substr($key,10,5) != '#####') {
+ MSGError('Invalid key in the file -- not importing any keys');
+ $dd=0;
+ break;
+ }
+ if(isset($param['unlockkey']) && $param['unlockkey'] != '') {
+ $pass=decryptData(substr($key,15),$param['unlockkey'],'includekeys');
+ if(substr($pass,0,5) != '#####') {
+ MSGError('Invalid key in the file -- not importing any keys');
+ $dd=0;
+ break;
+ }
+ }
+ $ar[$val]=$key;
+ $dd++;
+ }
+ if($dd > 0) {
+ $param['keys']=implode(',',$ar);
+ MSGError(count($ar) . ' keys are being imported from the file');
+ }
+ }
+ $param['atualizasites']=$at;
+ }
+ DBUpdateContest ($param);
+ if(strlen($param['unlockkey'])>1) DBGetFullProblemData($_SESSION["usertable"]["contestnumber"],true);
+ }
+ ForceLoad("contest.php");
+}
+?>
+<br>
+
+<form name="form1" enctype="multipart/form-data" method="post" action="contest.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ function conf2() {
+ if (confirm("This will restart all start/stop related information in all the sites.\n\
+If you have a contest running, the result is unpredictable. Are you really sure?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ function conf3() {
+ if (confirm("This will make your site become the main site, that is, this site will\n\
+play an active position in the contest regarding the information\n\
+flow. ARE YOU SURE?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <br><br>
+ <center>
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>Contest number:</td>
+ <td width="65%">
+<?php
+echo $contest;
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Name:</td>
+ <td width="65%">
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="name" value="<?php echo $ct["contestname"]; ?>" size="50" maxlength="50" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Start date:</td>
+ <td width="65%"> hh:mm
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="startdateh" value="<?php echo date("H", $ct["conteststartdate"]); ?>" size="2" maxlength="2" />
+ :
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="startdatemin" value="<?php echo date("i", $ct["conteststartdate"]); ?>" size="2" maxlength="2" />
+ &nbsp; &nbsp; dd/mm/yyyy
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="startdated" value="<?php echo date("d", $ct["conteststartdate"]); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="startdatem" value="<?php echo date("m", $ct["conteststartdate"]); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" <?php if(!$main) echo "readonly"; ?> name="startdatey" value="<?php echo date("Y", $ct["conteststartdate"]); ?>" size="4" maxlength="4" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Duration (in minutes):</td>
+ <td width="65%">
+ <input type="text" name="duration" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestduration"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Stop answering (in minutes):</td>
+ <td width="65%">
+ <input type="text" name="lastmileanswer" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestlastmileanswer"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Stop scoreboard (in minutes):</td>
+ <td width="65%">
+ <input type="text" name="lastmilescore" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestlastmilescore"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Penalty (in minutes):</td>
+ <td width="65%">
+ <input type="text" name="penalty" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestpenalty"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Max file size allowed for teams (in KB):</td>
+ <td width="65%">
+ <input type="text" name="maxfilesize" <?php if(!$main) echo "readonly"; ?>
+ value="<?php echo $ct["contestmaxfilesize"]/1000; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr><td width="35%" align=right>
+ Your PHP config. allows at most:</td>
+ <td width="65%">
+ <?php echo ini_get('post_max_size').'B(max. post) and '.ini_get('upload_max_filesize').'B(max. filesize)'; ?>
+ </td></tr>
+ <tr><td width="35%" align=right></td>
+ <td width="65%">
+<?php echo ini_get('session.gc_maxlifetime').'s of session expiration and ' . ini_get('session.cookie_lifetime') . ' as cookie lifetime (0 means unlimited)'; ?>
+ </td></tr>
+ <tr>
+ <td width="35%" align=right>Main site URL (IP/bocafolder):</td>
+ <td width="65%">
+ <input type="text" name="mainsiteurl" value="<?php echo $ct["contestmainsiteurl"]; ?>" size="40" maxlength="200" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Unlock password (only use it within a <b>secure network</b>):</td>
+ <td width="65%">
+ <input type="password" name="unlockkey" value="" size="40" maxlength="200" />
+ <?php if(strlen($ct["contestunlockkey"]) > 1) echo "<b><= has been set</b>"; ?>
+ </td>
+ </tr>
+<?php if($main) { ?>
+ <tr>
+ <td width="35%" align=right>Keys (only use it within a <b>secure network</b>):</td>
+ <td width="65%">
+ <input type="file" name="keyfile" size="40">
+ <?php if(strlen($ct["contestkeys"]) > 32) echo "<b><= has been set</b>"; ?>
+ </td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <td width="35%" align=right>Contest main site number:</td>
+ <td width="65%">
+ <input type="text" name="mainsite" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestmainsite"]; ?>" size="4" maxlength="4" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Contest local site number:</td>
+ <td width="65%">
+ <input type="text" name="localsite" <?php if(!$main) echo "readonly"; ?> value="<?php echo $ct["contestlocalsite"]; ?>" size="4" maxlength="4" />
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+<?php if($main) { ?>
+ <input type="submit" name="Submit3" value="Update" onClick="conf()">
+ <input type="submit" name="Submit3" value="Update Contest and All Sites" onClick="conf2()">
+ <input type="reset" name="Submit4" value="Clear">
+<?php } else { ?>
+ <input type="submit" name="Submit3" value="Update" onClick="conf()">
+ <input type="submit" name="Submit3" value="Become Main Site" onClick="conf3()">
+<?php } ?>
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/export.php b/boca-1.5.0/src/admin/export.php
new file mode 100644
index 0000000..2682c94
--- /dev/null
+++ b/boca-1.5.0/src/admin/export.php
@@ -0,0 +1,121 @@
+<?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
+//Change list
+// 15/June/2011 by cassio@ime.usp.br: created based on import.php
+require('header.php');
+
+if(isset($_POST["Submit"]) || isset($_POST['Submit1'])) {
+ if ($_POST["confirmation"] == "confirm" && isset($_POST['localsite']) && is_numeric($_POST['localsite']) &&
+ isset($_POST['challenge']) && isset($_POST['password'])) {
+ $localsite=$_POST['localsite'];
+
+ header ("Content-transfer-encoding: binary\n");
+ header ("Content-type: application/force-download");
+//header ("Content-type: application/octet-stream");
+//if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))
+// header("Content-Disposition: filename=" .$_GET["filename"]); // For IE
+//else
+ header ("Content-Disposition: attachment; filename=export.dat");
+ ob_end_flush();
+ $reduced = false;
+ if(isset($_POST["Submit"]) && $_POST['Submit']=="Reduced Export") {
+ $reduced = true;
+ }
+
+ $fromsite = $localsite;
+ $siteinfo = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$fromsite);
+ $scores = explode(",", $siteinfo['siteglobalscore']);
+ if(count($scores)==0 || (count($scores)==1 && !is_numeric($scores[0]))) $scores=array($fromsite);
+ $judges = explode(",", $siteinfo['sitejudging']);
+ if(count($judges)==0 || (count($judges)==1 && !is_numeric($judges[0]))) $judges=array($fromsite);
+ $scores = array_unique(array_merge($scores,$judges));
+ if(in_array(0,$scores)) $scores=null;
+
+ $xml = generateXML($_SESSION["usertable"]["contestnumber"],$localsite,$scores,$reduced);
+ if(isset($_POST['nopassword']) && $_POST['nopassword']=='true')
+ echo $xml;
+ else
+ echo rawurlencode($_POST['challenge']) . " " . encryptData($xml,($_POST['password']));
+ exit;
+ }
+}
+ob_end_flush();
+?>
+<br>
+<body onload="document.form1.name.focus()">
+<script language="JavaScript" src="../sha256.js"></script>
+<script language="JavaScript">
+function computeHASH()
+{
+ var passHASH;
+ if(document.form1.password.value == '') {
+ document.form1.nopassword.value = 'true';
+ } else {
+ passHASH = js_myhash(js_myhash(document.form1.password.value)+document.form1.challenge.value);
+ document.form1.password.value = passHASH;
+ }
+}
+</script>
+
+<form name="form1" enctype="multipart/form-data" method="post" action="export.php">
+ <input type="hidden" name="confirmation" value="noconfirm" />
+ <input type="hidden" name="noflush" value="noflush" />
+ <input type="hidden" name="nopassword" value="false" />
+ <center>
+ <table border="0">
+ <tr>
+ <td width="50%" align=right>Local site number:</td>
+ <td width="50%">
+ <input type="text" name="localsite" size="10">
+ </td>
+ </tr>
+ <tr><td width="50%" align=right>Challenge string:</td><td width="50%"><input type="text" name="challenge" size="20"></td></tr>
+<!--
+ <tr>
+ <td width="50%" align=right>Import file:</td>
+ <td width="50%">
+ <input type="file" name="importfile" size="40">
+ </td>
+ </tr>
+-->
+ <tr>
+ <td width="50%" align=right>Encryption key:</td>
+ <td width="50%">
+ <input type="password" name="password">
+ </td>
+ </tr>
+ </table>
+ </center>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ computeHASH();
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Reduced Export" onClick="conf()">
+ <input type="submit" name="Submit1" value="Full Export" onClick="conf()">
+ <input type="reset" name="Submit2" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/files.php b/boca-1.5.0/src/admin/files.php
new file mode 100644
index 0000000..16f0f2d
--- /dev/null
+++ b/boca-1.5.0/src/admin/files.php
@@ -0,0 +1,78 @@
+<?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(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("$loc/index.php");
+if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("$loc/index.php");
+
+if (isset($_GET["delete"]) && is_numeric($_GET["delete"])) {
+ DBBkpDelete($_GET["delete"],$_GET["usersitenumber"],$_SESSION["usertable"]["contestnumber"], $_GET["usernumber"],$_SESSION["usertable"]["username"]);
+ ForceLoad("files.php");
+}
+?>
+<br>
+ <script language="javascript">
+ function conf2(url) {
+ if (confirm("Confirm DELETION of file?")) {
+ document.location=url;
+ } else {
+ document.location='files.php';
+ }
+ }
+ </script>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Bkp #</b></td>
+ <td><b>Time</b></td>
+ <td><b>User(Site)</b></td>
+ <td><b>File</b></td>
+ <td><b>Status</b></td>
+ </tr>
+<?php
+$run = DBUserBkps($_SESSION["usertable"]["contestnumber"], -1, -1);
+
+for ($i=0; $i<count($run); $i++) {
+ echo " <tr>\n";
+ if(strpos($run[$i]["status"],"deleted")!==false)
+ echo " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ else
+ echo " <td nowrap><a href=\"javascript:conf2('files.php?delete=" . $run[$i]["number"] .
+ "&usernumber=" .$run[$i]["usernumber"]. "&usersitenumber=" .$run[$i]["usersitenumber"]. "')\">" . $run[$i]["number"] . "</a></td>\n";
+
+ echo " <td nowrap>" . dateconvsimple($run[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["usernumber"] . " (" . $run[$i]["usersitenumber"] . ")</td>\n";
+ $if = rawurlencode($run[$i]["filename"]);
+ if($run[$i]["status"]=="active") {
+ echo "<td nowrap><a href=\"../filedownload.php?". filedownload($run[$i]["oid"],$run[$i]["filename"]) . "\">";
+ echo $run[$i]["filename"] . "</a>";
+ } else echo "<td>" . $run[$i]["filename"];
+ echo " (" . $run[$i]["size"] . " bytes)";
+ echo "</td>\n";
+ echo "<td>" . $run[$i]["status"] . "</td>\n";
+ echo " </tr>\n";
+
+}
+echo "</table>";
+if (count($run) == 0) echo "<br><center><b><font color=\"#ff0000\">NO BACKUPS AVAILABLE</font></b></center>";
+
+?>
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/header.php b/boca-1.5.0/src/admin/header.php
new file mode 100644
index 0000000..c308059
--- /dev/null
+++ b/boca-1.5.0/src/admin/header.php
@@ -0,0 +1,88 @@
+<?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();
+if(!isset($_POST['noflush']))
+ ob_end_flush();
+//$loc = $_SESSION['loc'];
+//$locr = $_SESSION['locr'];
+$loc = $locr = "..";
+$runphp = "run.php";
+$runeditphp = "runedit.php";
+
+require_once("$locr/globals.php");
+require_once("$locr/db.php");
+
+if(!isset($_POST['noflush'])) {
+ require_once("$locr/version.php");
+ echo "<html><head><title>Admin's Page</title>\n";
+ echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
+ echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n";
+}
+
+//echo "<meta http-equiv=\"refresh\" content=\"60\" />";
+if(!ValidSession()) {
+ InvalidSession("admin/index.php");
+ ForceLoad("$loc/index.php");
+}
+if($_SESSION["usertable"]["usertype"] != "admin") {
+ IntrusionNotify("admin/index.php");
+ ForceLoad("$loc/index.php");
+}
+
+if(!isset($_POST['noflush'])) {
+ echo "</head><body><table border=1 width=\"100%\">\n";
+ echo "<tr><td nowrap bgcolor=\"eeee00\" align=center>";
+ echo "<img src=\"../images/smallballoontransp.png\" alt=\"\">";
+ echo "<font color=\"#000000\">BOCA</font>";
+ echo "</td><td bgcolor=\"#eeee00\" width=\"99%\">\n";
+ echo "Username: " . $_SESSION["usertable"]["userfullname"] . " (site=".$_SESSION["usertable"]["usersitenumber"].")<br>\n";
+ list($clockstr,$clocktype)=siteclock();
+ echo "</td><td bgcolor=\"#eeee00\" align=center nowrap>&nbsp;".$clockstr."&nbsp;</td></tr>\n";
+ echo "</table>\n";
+ echo "<table border=0 width=\"100%\" align=center>\n";
+ echo " <tr>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=run.php>Runs</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=score.php>Score</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=clar.php>Clarifications</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=user.php>Users</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=problem.php>Problems</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=language.php>Languages</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=answer.php>Answers</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=export.php>Export</a></td>\n";
+//echo " </tr></table><hr><table border=0 width=\"100%\" align=center><tr>\n";
+ echo " </tr><tr>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=task.php>Tasks</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=site.php>Site</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=contest.php>Contest</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=log.php>Logs</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=report.php>Reports</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=files.php>Backups</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n";
+ echo " <td align=center><a class=menu style=\"font-weight:bold\" href=$loc/index.php>Logout</a></td>\n";
+ echo " </tr>\n";
+ echo "</table>\n";
+}
+?>
diff --git a/boca-1.5.0/src/admin/index.php b/boca-1.5.0/src/admin/index.php
new file mode 100644
index 0000000..1b35a4c
--- /dev/null
+++ b/boca-1.5.0/src/admin/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_once('header.php');
+?>
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/language.php b/boca-1.5.0/src/admin/language.php
new file mode 100644
index 0000000..b2a7481
--- /dev/null
+++ b/boca-1.5.0/src/admin/language.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(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+
+if (isset($_GET["delete"]) && is_numeric($_GET["delete"])) {
+ $param["number"] = $_GET["delete"];
+ DBDeleteLanguage ($_SESSION["usertable"]["contestnumber"],$param);
+ ForceLoad("language.php");
+}
+
+if (isset($_POST["Submit3"]) && isset($_POST["langnumber"]) && is_numeric($_POST["langnumber"]) &&
+ isset($_POST["langname"]) && $_POST["langname"] != "") {
+ if ($_POST["confirmation"] == "confirm") {
+ $param = array();
+ $param['number'] = $_POST['langnumber'];
+ $param['name'] = $_POST['langname'];
+ $param['extension'] = $_POST['langextension'];
+ DBNewLanguage ($_SESSION["usertable"]["contestnumber"], $param);
+ }
+ ForceLoad("language.php");
+}
+?>
+<br>
+ <script language="javascript">
+ function conf2(url) {
+ if (confirm("Confirm the DELETION of the LANGUAGE and ALL data associated to it (including the SUBMISSIONS)?")) {
+ if (confirm("Are you REALLY sure about what you are doing? DATA CANNOT BE RECOVERED!")) {
+ document.location=url;
+ } else {
+ document.location='language.php';
+ }
+ } else {
+ document.location='language.php';
+ }
+ }
+ </script>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Language #</b></td>
+ <td><b>Name</b></td>
+ <td><b>Extension</b></td>
+ </tr>
+<?php
+$lang = DBGetLanguages($_SESSION["usertable"]["contestnumber"]);
+$cf = globalconf();
+for ($i=0; $i<count($lang); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap><a href=\"javascript: conf2('language.php?delete=" . $lang[$i]["number"] . "')\">" .
+ $lang[$i]["number"] . "</a></td>\n";
+ echo " <td nowrap>" . $lang[$i]["name"] . "</td>\n";
+ echo " <td nowrap>" . $lang[$i]["extension"] . "</td>\n";
+ echo " </tr>\n";
+}
+echo "</table>";
+if (count($lang) == 0) echo "<br><center><b><font color=\"#ff0000\">NO LANGUAGES DEFINED</font></b></center>";
+
+?>
+
+<br><br><center><b>Clicking on a language number will DELETE it.<br>
+WARNING: deleting a language will remove EVERYTHING related to it.<br>
+It is NOT recommended to change anything while the contest is running.<br>
+</b></center>
+
+<form name="form1" enctype="multipart/form-data" method="post" action="language.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+<b>To insert/edit a language, enter the data below.<br>
+Note that any changes will overwrite the already defined data.<br><br>
+</b>
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>Number:</td>
+ <td width="65%">
+ <input type="text" name="langnumber" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Name:</td>
+ <td width="65%">
+ <input type="text" name="langname" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Extension:</td>
+ <td width="65%">
+ <input type="text" name="langextension" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+ <input type="submit" name="Submit3" value="Send" onClick="conf()">
+ <input type="reset" name="Submit4" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/log.php b/boca-1.5.0/src/admin/log.php
new file mode 100644
index 0000000..ff915ea
--- /dev/null
+++ b/boca-1.5.0/src/admin/log.php
@@ -0,0 +1,76 @@
+<?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"]))
+$order = myhtmlspecialchars($_GET["order"]);
+else $order='';
+if(isset($_GET["user"]))
+$user = myhtmlspecialchars($_GET["user"]);
+else $user='';
+if(isset($_GET["site"]))
+$site = myhtmlspecialchars($_GET["site"]);
+else $site='';
+if(isset($_GET["type"]))
+$type = myhtmlspecialchars($_GET["type"]);
+else $type='';
+if(isset($_GET["ip"]))
+$ip = myhtmlspecialchars($_GET["ip"]);
+else $ip='';
+$get="&order=${order}&user=${user}&site=${site}&type=${type}&ip=${ip}";
+if (isset($_GET["limit"]) && $_GET["limit"]>0)
+ $limit = myhtmlspecialchars($_GET["limit"]);
+else $limit = 50;
+$log = DBGetLogs($order, $_SESSION["usertable"]["contestnumber"],
+ $site, $user, $type, $ip, $limit);
+?>
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td><b><a href="log.php?order=site&limit=<?php echo $limit; ?>">Site</a></b></td>
+ <td nowrap><b><a href="log.php?order=user&limit=<?php echo $limit; ?>">User #</a></b></td>
+ <td><b><a href="log.php?order=ip&limit=<?php echo $limit; ?>">IP</a></b></td>
+ <td><b><a href="log.php?order=type&limit=<?php echo $limit; ?>">Type</a></b></td>
+ <td><b>Date</b></td>
+ <td><b>Description</b></td>
+ <td><b>Status</b></td>
+ </tr>
+<?php
+for ($i=0; $i<count($log); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap><a href=\"log.php?site=" . $log[$i]["site"] . "&limit=$limit\">" . $log[$i]["site"] . "</a></td>\n";
+ echo " <td nowrap><a href=\"log.php?user=" . $log[$i]["user"] . "&limit=$limit\">" . $log[$i]["user"] . "</a></td>\n";
+ echo " <td nowrap><a href=\"log.php?ip=" . $log[$i]["ip"] . "&limit=$limit\">" . $log[$i]["ip"] . "</a></td>\n";
+ echo " <td nowrap><a href=\"log.php?type=" . $log[$i]["type"] . "&limit=$limit\">" . $log[$i]["type"] . "</a></td>\n";
+ echo " <td nowrap>" . dateconv($log[$i]["date"]) . "</td>\n";
+ echo " <td nowrap>" . $log[$i]["data"] . "</td>\n";
+ echo " <td nowrap>" . $log[$i]["status"] . "</td>\n";
+ echo "</tr>\n";
+}
+echo "</table>\n";
+
+?>
+<br>
+<center>
+<a href="log.php?limit=50<?php echo $get; ?>">50</a>
+<a href="log.php?limit=200<?php echo $get; ?>">200</a>
+<a href="log.php?limit=1000<?php echo $get; ?>">1000</a>
+<a href="log.php?limit=1000000<?php echo $get; ?>">no limit</a>
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/option.php b/boca-1.5.0/src/admin/option.php
new file mode 100644
index 0000000..81e5879
--- /dev/null
+++ b/boca-1.5.0/src/admin/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/boca-1.5.0/src/admin/problem.php b/boca-1.5.0/src/admin/problem.php
new file mode 100644
index 0000000..d55ff63
--- /dev/null
+++ b/boca-1.5.0/src/admin/problem.php
@@ -0,0 +1,262 @@
+<?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(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+
+if (isset($_GET["delete"]) && is_numeric($_GET["delete"]) && isset($_GET["input"])) {
+ $param = array();
+ $param['number']=$_GET["delete"];
+ $param['inputfilename']=$_GET["input"];
+ if(!DBDeleteProblem ($_SESSION["usertable"]["contestnumber"], $param)) {
+ MSGError('Error deleting problem');
+ LogError('Error deleting problem');
+ }
+ ForceLoad("problem.php");
+}
+
+if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_POST["problemnumber"]) &&
+ isset($_POST["problemname"]) && $_POST["problemname"] != "") {
+ if ($_POST["confirmation"] == "confirm") {
+ if ($_FILES["probleminput"]["name"] != "") {
+ $type=myhtmlspecialchars($_FILES["probleminput"]["type"]);
+ $size=myhtmlspecialchars($_FILES["probleminput"]["size"]);
+ $name=myhtmlspecialchars($_FILES["probleminput"]["name"]);
+ $temp=myhtmlspecialchars($_FILES["probleminput"]["tmp_name"]);
+ if (!is_uploaded_file($temp)) {
+ IntrusionNotify("file upload problem.");
+ ForceLoad("../index.php");
+ }
+ } else $name = "";
+
+ $param = array();
+ $param['number'] = $_POST["problemnumber"];
+ $param['name'] = $_POST["problemname"];
+ $param['inputfilename'] = $name;
+ $param['inputfilepath'] = $temp;
+ $param['fake'] = 'f';
+ $param['colorname'] = $_POST["colorname"];
+ $param['color'] = $_POST["color"];
+ if($param['color']=='') $param['color']=-1;
+ DBNewProblem ($_SESSION["usertable"]["contestnumber"], $param);
+ }
+ ForceLoad("problem.php");
+}
+?>
+<br>
+ <script language="javascript">
+ function conf2(url) {
+ if (confirm("Confirm the DELETION of the PROBLEM and ALL data associated to it (including the SUBMISSIONS)?")) {
+ if (confirm("Are you REALLY sure about what you are doing? DATA CANNOT BE RECOVERED!")) {
+ document.location=url;
+ } else {
+ document.location='problem.php';
+ }
+ } else {
+ document.location='problem.php';
+ }
+ }
+ </script>
+<table width="100%" border=1>
+ <tr>
+ <td><b>Problem #</b></td>
+ <td><b>Short Name</b></td>
+ <td><b>Fullname</b></td>
+ <td><b>Basename</b></td>
+ <td><b>Descfile</b></td>
+ <td><b>Package file</b></td>
+<!-- <td><b>Compare file</b></td>
+ <td><b>Timelimit</b></td>-->
+ <td><b>Color</b></td>
+ </tr>
+<?php
+ $prob = DBGetFullProblemData($_SESSION["usertable"]["contestnumber"],true);
+for ($i=0; $i<count($prob); $i++) {
+ echo " <tr>\n";
+ if($prob[$i]["fake"]!='t') {
+ echo " <td nowrap><a href=\"javascript: conf2('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) .
+ "')\">" . $prob[$i]["number"] . "</a></td>\n";
+ } else {
+ echo " <td nowrap>" . $prob[$i]["number"] . " (fake)</td>\n";
+ }
+ echo " <td nowrap>" . $prob[$i]["name"] . "</td>\n";
+ echo " <td nowrap>" . $prob[$i]["fullname"] . "&nbsp;</td>\n";
+ echo " <td nowrap>" . $prob[$i]["basefilename"] . "&nbsp;</td>\n";
+ if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null) {
+ echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["descoid"], $prob[$i]["descfilename"]) . "\">" .
+ basename($prob[$i]["descfilename"]) . "</td>\n";
+ }
+ else
+ echo " <td>&nbsp;</td>\n";
+ if ($prob[$i]["inputoid"] != null) {
+ $tx = $prob[$i]["inputhash"];
+ echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["inputoid"] ,$prob[$i]["inputfilename"]) ."\">" .
+ $prob[$i]["inputfilename"] . "</a> " .
+ "<img title=\"hash: $tx\" alt=\"$tx\" width=\"25\" src=\"../images/bigballoontransp-hash.png\" />" .
+ "</td>\n";
+ }
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+/*
+ if ($prob[$i]["soloid"] != null) {
+ $tx = $prob[$i]["solhash"];
+ echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["soloid"],$prob[$i]["solfilename"]) ."\">" .
+ $prob[$i]["solfilename"] . "</a> ".
+ "<img title=\"hash: $tx\" alt=\"$tx\" width=\"25\" src=\"../images/bigballoontransp-hash.png\" />" .
+ "</td>\n";
+ }
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+ if ($prob[$i]["timelimit"]!="")
+ echo " <td nowrap>" . $prob[$i]["timelimit"] . "</td>\n";
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+*/
+ if ($prob[$i]["color"]!="") {
+ echo " <td nowrap>" . $prob[$i]["colorname"] .
+ "<img title=\"".$prob[$i]["color"]."\" alt=\"".$prob[$i]["colorname"]."\" width=\"25\" src=\"" .
+ balloonurl($prob[$i]["color"]) . "\" /></td>\n";
+ } else
+ echo " <td nowrap>&nbsp;</td>\n";
+ echo " </tr>\n";
+}
+echo "</table>";
+if (count($prob) == 0) echo "<br><center><b><font color=\"#ff0000\">NO PROBLEMS DEFINED</font></b></center>";
+
+?>
+
+<br><br><center><b>Clicking on a problem number will delete it.<br>
+WARNING: deleting a problem will remove EVERYTHING related to it.<br>
+It is NOT recommended to change anything while the contest is running.<br>
+To import a problem, fill in the following fields.<br>
+To replace the data of a problem, proceed as if it did not exist (data will be replaced without removing it).</b></center>
+
+<form name="form1" enctype="multipart/form-data" method="post" action="problem.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <script language="javascript">
+ function conf() {
+ if(document.form1.problemname.value=="") {
+ alert('Sorry, mandatory fields are empty');
+ } else {
+/*
+ var s1 = String(document.form1.problemdesc.value);
+ var l = s1.length;
+ if(l >= 3 && (s1.substr(l-3,3).toUpperCase()==".IN" ||
+ s1.substr(l-4,4).toUpperCase()==".OUT" ||
+ s1.substr(l-4,4).toUpperCase()==".SOL" ||
+ s1.substr(l-2,2).toUpperCase()==".C" ||
+ s1.substr(l-2,2).toUpperCase()==".H" ||
+ s1.substr(l-3,3).toUpperCase()==".CC" ||
+ s1.substr(l-3,3).toUpperCase()==".GZ" ||
+ s1.substr(l-4,4).toUpperCase()==".CPP" ||
+ s1.substr(l-4,4).toUpperCase()==".HPP" ||
+ s1.substr(l-4,4).toUpperCase()==".ZIP" ||
+ s1.substr(l-4,4).toUpperCase()==".TGZ" ||
+ s1.substr(l-5,5).toUpperCase()==".JAVA")) {
+ alert('Description file has invalid extension: ...'+s1.substr(l-3,3));
+ } else {
+*/
+ var s2 = String(document.form1.probleminput.value);
+ if(s2.length > 4) {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ } else {
+ alert('File package must be given');
+ }
+ }
+ }
+ </script>
+ <center>
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>Number:</td>
+ <td width="65%">
+ <input type="text" name="problemnumber" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Short Name (usually a letter):</td>
+ <td width="65%">
+ <input type="text" name="problemname" value="" size="20" maxlength="20" />
+ </td>
+ </tr>
+<!--
+ <tr>
+ <td width="35%" align=right>Problem Fullname:</td>
+ <td width="65%">
+ <input type="text" name="fullname" value="" size="50" maxlength="100" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Problem Basename (a.k.a. name of class expected to have the main):</td>
+ <td width="65%">
+ <input type="text" name="basename" value="" size="50" maxlength="100" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Description file (PDF, txt, ...):</td>
+ <td width="65%">
+ <input type="file" name="problemdesc" value="" size="40" />
+ </td>
+ </tr>
+-->
+ <tr>
+ <td width="35%" align=right>Problem package (ZIP):</td>
+ <td width="65%">
+ <input type="file" name="probleminput" value="" size="40" />
+ </td>
+ </tr>
+<!--
+ <tr>
+ <td width="35%" align=right>Compare file archive (ZIP):</td>
+ <td width="65%">
+ <input type="file" name="problemsol" value="" size="40" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Timelimit (in sec):</td>
+ <td width="65%">
+ <input type="text" name="timelimit" value="" size="10" />
+(optional: use a , followed by the number of repetitions to run)
+ </td>
+ </tr>
+-->
+ <tr>
+ <td width="35%" align=right>Color name:</td>
+ <td width="65%">
+ <input type="text" name="colorname" value="" size="40" maxlength="100" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Color (RGB HTML format):</td>
+ <td width="65%">
+ <input type="text" name="color" value="" size="6" maxlength="6" />
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+ <input type="submit" name="Submit3" value="Send" onClick="conf()">
+ <input type="reset" name="Submit4" value="Clear">
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/report.php b/boca-1.5.0/src/admin/report.php
new file mode 100644
index 0000000..bb1fc34
--- /dev/null
+++ b/boca-1.5.0/src/admin/report.php
@@ -0,0 +1,89 @@
+<?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)) {
+}
+?>
+<br><br>
+ <center>
+<?php
+// echo "<b>Logs</b><br /><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/score.php?p=2', ".
+ "'Complete Scoreboard','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Scoreboard</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/score.php?p=0', ".
+ "'Complete Scoreboard','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Detailed Scoreboard</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/score.php?p=0&hor=0', ".
+ "'Complete Scoreboard','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Interactive Scoreboard</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/score.php?p=1', ".
+ "'Public Scoreboard','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Delayed Scoreboard</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/run.php', ".
+ "'Run List','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Run List</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/clar.php', ".
+ "'Clarification List','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Clarification List</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/task.php', ".
+ "'Task List','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Task List</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/site.php', ".
+ "'Start/Stop Logs','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Site Start/Stop Logs</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/icpc.php', ".
+ "'ICPC File','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">ICPC File</a><br />\n";
+
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/stat.php', ".
+ "'Problem Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Statistics</a><br />\n";
+
+/*
+ echo "<br /><br />\n";
+ echo "<b>Statistics</b><br /><br />\n";
+
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statproblem.php', ".
+ "'Problem Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Problems</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statanswer.php', ".
+ "'Answer Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Answers</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statuser.php', ".
+ "'User Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Users</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statlanguage.php', ".
+ "'Language Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Languages</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statrun.php', ".
+ "'Run Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Runs</a><br />\n";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('report/statclar.php', ".
+ "'Clarification Statistics','width=800,height=600,scrollbars=yes,toolbar=yes,menubar=yes,".
+ "resizable=yes')\">Clarifications</a><br />\n";
+*/
+?>
+ </center>
+</form>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/report/clar.php b/boca-1.5.0/src/admin/report/clar.php
new file mode 100644
index 0000000..66bd4cd
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/clar.php
@@ -0,0 +1,82 @@
+<?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');
+?>
+<br>
+<center><h2>Clarification List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Site</b></td>
+ <td><b>User</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Status</b></td>
+ <td><b>Judge (Site)</b></td>
+ <td><b>Question</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$s = $st;
+
+// forca aparecer as clars do proprio site
+if (trim($s["sitejudging"])!="") $s["sitejudging"].=",".$_SESSION["usertable"]["usersitenumber"];
+else $s["sitejudging"]=$_SESSION["usertable"]["usersitenumber"];
+
+$clar = DBAllClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], 'normal');
+
+for ($i=0; $i<count($clar); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap>" . $clar[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["site"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["user"] . "</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]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $clar[$i]["judgesite"], $clar[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $clar[$i]["judgesite"] . ")</td>\n";
+ }
+ else
+ echo " <td>&nbsp;</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";
+ 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>";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/header.php b/boca-1.5.0/src/admin/report/header.php
new file mode 100644
index 0000000..1d191de
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/header.php
@@ -0,0 +1,65 @@
+<?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
+
+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();
+//$locr = $_SESSION['locr'];
+//$loc = $_SESSION['loc'];
+$loc = $locr = "../..";
+
+require $locr.'/version.php';
+require_once($locr . "/globals.php");
+if(!ValidSession()) {
+ InvalidSession($_SERVER['PHP_SELF']);
+ ForceLoad($loc."/index.php");
+}
+if($_SESSION["usertable"]["usertype"] != "admin") {
+ IntrusionNotify($_SERVER['PHP_SELF']);
+ ForceLoad($loc."/index.php");
+}
+
+require_once($locr."/db.php");
+require_once($locr."/freport.php");
+
+echo "<html><head><title>Report Page</title>\n";
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
+
+echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n";
+
+$contest=$_SESSION["usertable"]["contestnumber"];
+if(($ct = DBContestInfo($contest)) == null)
+ ForceLoad($loc."/index.php");
+$site=$_SESSION["usertable"]["usersitenumber"];
+if(($st = DBSiteInfo($contest,$site)) == null)
+ ForceLoad($loc."/index.php");
+
+echo "</head><body><table border=1 width=\"100%\">\n";
+echo "<tr><td bgcolor=\"eeee00\" nowrap align=center>";
+echo "<img src=\"$loc/images/smallballoontransp.png\" alt=\"\">";
+echo "<font color=\"#ffffff\"><a href=\"http://www.ime.usp.br/~cassio/boca/\">BOCA</a></font>";
+echo "</td><td bgcolor=\"#eeee00\" width=\"99%\">\n";
+echo $ct["contestname"] . " - " . $st["sitename"] . "</td>\n";
+echo "</tr></table>\n";
+?>
diff --git a/boca-1.5.0/src/admin/report/icpc.php b/boca-1.5.0/src/admin/report/icpc.php
new file mode 100644
index 0000000..1bf2b86
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/icpc.php
@@ -0,0 +1,46 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA System (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 updated 10/jul/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$score = DBScore($_SESSION["usertable"]["contestnumber"], false, -1, $st["siteglobalscore"]);
+
+echo "<h2>ICPC Output</h2>";
+echo "<pre>";
+$n=0;
+$class=1;
+while(list($e, $c) = each($score)) {
+ if(isset($score[$e]["site"]) && isset($score[$e]["user"])) {
+ $r = DBUserInfo($_SESSION["usertable"]["contestnumber"],
+ $score[$e]["site"], $score[$e]["user"]);
+ echo $r["usericpcid"] . ",";
+ echo $class++ . ",";
+ echo $score[$e]["totalcount"] . ",";
+ echo $score[$e]["totaltime"] . ",";
+
+ if($score[$e]["first"])
+ echo $score[$e]["first"] . "\n";
+ else echo "0\n";
+ $n++;
+ }
+}
+echo "</pre>";
+?>
+<?php include("$locr/footnote.php"); ?>
+
diff --git a/boca-1.5.0/src/admin/report/linechart.php b/boca-1.5.0/src/admin/report/linechart.php
new file mode 100644
index 0000000..fa47b17
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/linechart.php
@@ -0,0 +1,45 @@
+<?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
+
+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");
+session_start();
+$locr = $_SESSION['locr'];
+$loc = $_SESSION['loc'];
+
+require_once($locr . "/libchart/libchart.php");
+header ("Content-type: image/png");
+ob_end_flush();
+
+$v = explode(chr(1),rawurldecode($_GET['dados']),100);
+
+$chart = new VerticalChart(1000, 300);
+
+$chart->setUpperBound($v[1]);
+
+for($i=2;$i<count($v); $i+=2)
+ $chart->addPoint(new Point($v[$i], $v[$i+1]));
+
+$chart->setTitle($v[0]);
+$chart->setLogo($locr. "/images/poweredbyboca.png");
+$chart->render();
+?>
diff --git a/boca-1.5.0/src/admin/report/piechart.php b/boca-1.5.0/src/admin/report/piechart.php
new file mode 100644
index 0000000..18d8d04
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/piechart.php
@@ -0,0 +1,60 @@
+<?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
+
+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");
+session_start();
+$locr = $_SESSION['locr'];
+$loc = $_SESSION['loc'];
+
+require_once($locr . "/libchart/libchart.php");
+header("Content-type: image/png");
+ob_end_flush();
+
+$v = explode(chr(1),rawurldecode($_GET['dados']),100);
+$cor = null;
+if(isset($_GET['color']))
+ $cor = explode("-",rawurldecode($_GET['color']),100);
+
+if(count($v)/2 > 8)
+ $chart = new PieChart(450, 300);
+else
+ $chart = new PieChart(400, 250);
+
+if(isset($_GET['order'])) $chart->order=true;
+
+for($i=1;$i<count($v); $i+=2) {
+ $color = null;
+ if($cor != null) {
+ $r = hexdec( substr($cor[($i-1)/2], 0, 2) );
+ $g = hexdec( substr($cor[($i-1)/2], 2, 2) );
+ $b = hexdec( substr($cor[($i-1)/2], 4, 2) );
+ $color = array($r, $g, $b);
+ }
+ $chart->addPoint(new Point($v[$i], $v[$i+1], $color));
+}
+
+$chart->setTitle($v[0]);
+$chart->setLogo($locr. "/images/poweredbyboca.png");
+$chart->render();
+
+?>
diff --git a/boca-1.5.0/src/admin/report/run.php b/boca-1.5.0/src/admin/report/run.php
new file mode 100644
index 0000000..422200d
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/run.php
@@ -0,0 +1,93 @@
+<?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');
+?>
+<br>
+<center><h2>Run List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Site</b></td>
+ <td><b>User</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>Judge (Site)</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$s = $st;
+// 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"], 'normal');
+
+for ($i=0; $i<count($run); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["site"] . "</td>\n";
+ if ($run[$i]["user"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["site"], $run[$i]["user"]);
+ echo " <td nowrap>" . $u["userfullname"] . "</td>\n";
+ }
+ echo " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+
+ if($run[$i]["status"] == "deleted") {
+ echo "<td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo " <td nowrap>" . $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"] . ")</td>\n";
+ } else
+ echo " <td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo "</tr>";
+ continue;
+ }
+
+ echo " <td nowrap>" . $run[$i]["problem"];
+ if($run[$i]["colorname"] != "")
+ echo "(".$run[$i]["colorname"].")";
+ echo "</td>\n";
+ echo " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["filename"] . "</td>\n";
+
+ echo " <td nowrap>" . $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"] . ")</td>\n";
+ } else
+ echo " <td>&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>";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/score.php b/boca-1.5.0/src/admin/report/score.php
new file mode 100644
index 0000000..0196b3a
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/score.php
@@ -0,0 +1,43 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA System (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 updated 10/jul/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$final = true;
+$s = $st;
+$des = true;
+$detail=true;
+if($_GET["p"] == "0") $ver = false;
+else if($_GET["p"] == "2") $detail=false;
+else {
+ $ver = true;
+ $des = false;
+}
+if(isset($_GET["hor"])) $hor = $_GET["hor"];
+else $hor = -1;
+
+if ($s["currenttime"] >= $s["sitelastmilescore"] && $ver) {
+ $togo = (int) (($s['siteduration'] - $s["sitelastmilescore"])/60);
+ echo"<br /><center><h2>Scoreboard (as of $togo minutes to go)</h2></center>\n";
+} else
+ echo"<br /><center><h2>Final Scoreboard</h2></center>\n";
+
+require("$locr/scoretable.php");
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/site.php b/boca-1.5.0/src/admin/report/site.php
new file mode 100644
index 0000000..001d48e
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/site.php
@@ -0,0 +1,128 @@
+<?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');
+
+$sitetime = DBAllSiteTime($_SESSION["usertable"]["contestnumber"], $site);
+?>
+<br />
+<center><h2>Site Start/Stop Logs</h2></center>
+
+ <table border="0">
+<?php
+echo " <td nowrap width=\"50%\" align=right>Start date (contest=" . dateconv($ct["conteststartdate"]) . "):</td>";
+echo "<td width=\"50%\"><b>" . dateconv($st["sitestartdate"]) . "</b></td>\n";
+echo "<tr>";
+if (!$st["siterunning"]) {
+ echo " <tr>\n";
+ echo " <td nowrap width=\"50%\" align=right><b>Finished at:</b></td>\n";
+ echo " <td width=\"50%\"><b>" . dateconv($st["siteendeddate"]);
+ if($st["siteautoended"]) echo " (auto)";
+ echo "</b></td>\n";
+ echo " </tr>\n";
+ if($st["siteautoended"]) {
+ $w = (int) ($st["siteduration"]/60);
+ $ww = $st["siteduration"] % 60;
+ }
+ else {
+ $w = (int) ($st["currenttime"]/60);
+ $ww = $st["currenttime"] % 60;
+ }
+ echo " <tr>\n";
+ echo " <td nowrap width=\"50%\" align=right><b>Real duration:</b></td>\n";
+ echo " <td width=\"50%\"><b>$w minutes";
+ if($ww != 0) echo " plus $ww seconds";
+ echo "</b></td>\n";
+ echo " </tr>\n";
+}
+echo "<tr>\n";
+echo " <td width=\"50%\" align=right>Planned Duration (contest=";
+echo $ct["contestduration"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["siteduration"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"50%\" align=right>Stop answering (contest=";
+echo $ct["contestlastmileanswer"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["sitelastmileanswer"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"50%\" align=right>Stop scoreboard (contest=";
+echo $ct["contestlastmilescore"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["sitelastmilescore"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Clars:</td>
+ <td width="50%"><?php echo $st["sitenextclar"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Runs:</td>
+ <td width="50%"><?php echo $st["sitenextrun"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Tasks:</td>
+ <td width="50%"><?php echo $st["sitenexttask"]; ?>
+ </td>
+ </tr>
+ </table>
+ </center>
+<center>
+<br />
+<table border=1>
+<tr>
+<td nowrap width=\"50%\" align=right>Starting at</td><td nowrap width=\"50%\" align=left>Ending at</td>
+</tr>
+<?php
+$n = count($sitetime);
+for ($i=0; $i< $n; $i++) {
+ echo "<tr>";
+ echo "<td nowrap align=right>";
+ echo dateconv($sitetime[$i]["sitestartdate"]);
+ echo "</td>";
+ echo "<td nowrap align=left>";
+ if($sitetime[$i]["siteenddate"] == 0) {
+ if($st["siterunning"])
+ echo "still open";
+ else echo "auto-ended";
+ }
+ else
+ echo dateconv($sitetime[$i]["siteenddate"]);
+ echo "</td>";
+ echo "</tr>";
+}
+?>
+</table>
+</center>
+
+<?php include("$locr/footnote.php"); ?>
diff --git a/boca-1.5.0/src/admin/report/stat.php b/boca-1.5.0/src/admin/report/stat.php
new file mode 100644
index 0000000..7d99cb3
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/stat.php
@@ -0,0 +1,337 @@
+<?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');
+
+$d = DBRunReport($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"]);
+
+echo "<center><h2>Statistics</h2></center>\n";
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems</u></b></td>";
+
+echo "<td>Total</td><td>Accepted</td>";
+echo "</tr>\n";
+
+$str="All Runs by Problem";
+$str2="Accepted Runs by Problem";
+reset($d['problem']);
+$cor = "";
+while (list($keya, $val) = each($d['problem'])) {
+ $val = $d['problemyes'][$keya]; if($val=="") $val=0;
+ $str2 .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ $cor .= "-" . $d['color'][$keya];
+}
+$cor = substr($cor,1);
+
+reset($d['problem']);
+while (list($keya, $val) = each($d['problem'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ echo "<td>$val</td>";
+ if(isset($d['problemyes'][$keya])) {
+ echo "<td nowrap>".$d['problemyes'][$keya];
+ if($val != 0) {
+ $p = round(100*$d['problemyes'][$keya] / $val);
+ echo " (".$p."%)";
+ }
+ echo "</td>";
+ }
+ else
+ echo "<td nowrap>0 (0%)</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "<center><table><tr>";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str)."&color=".rawurlencode($cor)."\" /></td>\n";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str2)."&color=".rawurlencode($cor)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem and Answer</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems x Answers</u></b></td>";
+reset($d['answer']);
+while (list($key, $val) = each($d['answer']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['problem']);
+while (list($keya, $vala) = each($d['problem'])) {
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ reset($d['answer']);
+ while (list($key, $val) = each($d['answer'])) {
+ if(!isset($d['pa'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['pa'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['pa'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem and Language</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems x Languages</u></b></td>";
+reset($d['language']);
+while (list($key, $val) = each($d['language']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['problem']);
+while (list($keya, $vala) = each($d['problem'])) {
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ reset($d['language']);
+ while (list($key, $val) = each($d['language'])) {
+ if(!isset($d['pl'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['pl'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['pl'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Language</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Languages</u></b></td>";
+
+echo "<td>Total</td><td>Accepted</td>";
+echo "</tr>\n";
+
+$str="All Runs by Language";
+$str2="Accepted Runs by Language";
+reset($d['language']);
+while (list($keya, $val) = each($d['language'])) {
+ $val = $d['languageyes'][$keya]; if($val=="") $val=0;
+ $str2 .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+}
+
+reset($d['language']);
+while (list($keya, $val) = each($d['language'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya</td>";
+ echo "<td>$val</td>";
+ if(isset($d['languageyes'][$keya])) {
+ $p = round(100*$d['languageyes'][$keya] / $val);
+ echo "<td nowrap>".$d['languageyes'][$keya]." (".$p."%)</td>";
+ }
+ else
+ echo "<td nowrap>0 (0%)</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "<center><table><tr>";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str)."\" /></td>\n";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str2)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Language and Answer</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Languages x Answers</u></b></td>";
+reset($d['answer']);
+while (list($key, $val) = each($d['answer']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['language']);
+while (list($keya, $vala) = each($d['language'])) {
+ echo "<tr><td>$keya</td>";
+ reset($d['answer']);
+ while (list($key, $val) = each($d['answer'])) {
+ if(!isset($d['la'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['la'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['la'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Answer</h3></center>\n";
+
+echo "<center><table><tr>";
+echo "<td>";
+
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Answers</u></b></td>";
+
+echo "<td>Answers</td>";
+echo "</tr>\n";
+
+$str="All Runs by Answer";
+reset($d['answer']);
+while (list($keya, $val) = each($d['answer'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya</td>";
+ echo "<td>$val</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "</td>";
+echo "<td><img alt=\"\" src=\"piechart.php?order=1&dados=".rawurlencode($str)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by User and Problem</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Users x Problems</u></b></td>";
+reset($d['problem']);
+while (list($key, $val) = each($d['problem'])) {
+ echo "<td>$key ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$key]) ."\" />\n";
+ echo "</td>";
+}
+echo "<td>Total</td><td>Accepted</td></tr>\n";
+
+reset($d['username']);
+while (list($keya, $vala) = each($d['username'])) {
+ $keya = $d['username'][$keya];
+ $vala = $d['user'][$keya];
+ echo "<tr><td>".$d['userfull'][$keya]."</td>";
+ reset($d['problem']);
+ while (list($key, $val) = each($d['problem'])) {
+ if(!isset($d['up'][$keya][$key]))
+ echo "<td bgcolor=\"ffff88\">0</td>";
+ else {
+ $q = $d['up'][$keya][$key];
+ $color = "ff5555";
+ if($q < 0) {
+ $q = - $q;
+ $color = "22ee22";
+ }
+ echo "<td nowrap bgcolor=\"$color\">".$q;
+ if($vala != 0) {
+ $p = round(100*$q / $vala);
+ echo " (".$p."%)";
+ }
+ echo "</td>";
+ }
+ }
+ if($vala != "")
+ echo "<td>$vala</td>";
+ else
+ echo "<td>0</td>";
+ if(isset($d['useryes'][$keya])) {
+ if($vala != 0) {
+ $p = round(100*$d['useryes'][$keya] / $vala);
+ echo "<td nowrap>".$d['useryes'][$keya]." (".$p."%)</td>";
+ } else
+ echo "<td>".$d['useryes'][$keya]."</td>";
+ } else
+ echo "<td>0</td>";
+
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Time Period</h3></center>\n";
+
+$vezes = 30;
+$passo = $st['siteduration']/$vezes;
+$atual = 0;
+$pos = 0;
+$res = array();
+$m = 0;
+sort($d['timestamp']);
+reset($d['timestamp']);
+while (list($keya, $val) = each($d['timestamp'])) {
+ while($atual+$passo < $val) {
+ $atual += $passo;
+ $pos++;
+ }
+ $res[$pos]++;
+ if($res[$pos] > $m) $m=$res[$pos];
+}
+
+$str="Runs by Time Period" . chr(1) . $m;
+$atual=0;
+for($pos=0; $pos<$vezes; $pos++) {
+ if($res[$pos]=="") $res[$pos] = 0;
+ $q = (int) ($atual/60);
+ $atual += $passo;
+ $qq = (int) ($atual/60);
+ $str .= chr(1) . $q . "-" .$qq . chr(1) . $res[$pos];
+}
+
+echo "<center><img alt=\"\" src=\"linechart.php?dados=".rawurlencode($str)."\" /></center>\n";
+
+//------------------------------------------------
+$vezes = 30;
+$passo = $st['siteduration']/$vezes;
+$atual = 0;
+$pos = 0;
+$res = array();
+sort($d['timestampyes']);
+reset($d['timestampyes']);
+while (list($keya, $val) = each($d['timestampyes'])) {
+ while($atual+$passo < $val) {
+ $atual += $passo;
+ $pos++;
+ }
+ $res[$pos]++;
+}
+
+$str="Accepted Runs by Time Period" . chr(1) . $m;
+$atual=0;
+for($pos=0; $pos<$vezes; $pos++) {
+ if($res[$pos]=="") $res[$pos] = 0;
+ $q = (int) ($atual/60);
+ $atual += $passo;
+ $qq = (int) ($atual/60);
+ $str .= chr(1) . $q . "-" .$qq . chr(1) . $res[$pos];
+}
+
+echo "<center><img alt=\"\" src=\"linechart.php?dados=".rawurlencode($str)."\" /></center>\n";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/task.php b/boca-1.5.0/src/admin/report/task.php
new file mode 100644
index 0000000..59ca0e2
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/task.php
@@ -0,0 +1,68 @@
+<?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');
+
+?>
+<br>
+<center><h2>Task List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Time</b></td>
+ <td><b>User / Site</b></td>
+ <td><b>Description</b></td>
+ <td><b>File</b></td>
+ <td><b>Staff / Site</b></td>
+ <td><b>Status</b></td>
+ </tr>
+<?php
+$s = $st;
+$task = DBAllTasksInSites($_SESSION["usertable"]["contestnumber"], $s["sitetasking"], 'normal');
+$cf = globalconf();
+for ($i=0; $i<count($task); $i++) {
+ $st = $task[$i]["status"];
+
+ if($st == "processing" && $task[$i]["staff"]==$_SESSION["usertable"]["usernumber"] &&
+ $task[$i]["staffsite"]==$_SESSION["usertable"]["usersitenumber"]) $mine=1;
+ else $mine=0;
+
+ echo " <tr>\n";
+ echo " <td nowrap>" . $task[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($task[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>".$task[$i]["username"]." / ".$task[$i]["site"]."</td>\n";
+ echo " <td>" . $task[$i]["description"] . "</td>\n";
+ if ($task[$i]["oid"] != null) {
+ echo " <td nowrap>" . $task[$i]["filename"];
+ echo "</td>\n";
+
+ }
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+ if($st != "opentask")
+ echo " <td nowrap>". $task[$i]["staffname"] . "(" . $task[$i]["staff"] .") / ".$task[$i]["staffsite"]."</td>\n";
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+
+ echo " <td nowrap>$st</td>\n";
+}
+echo "</table>";
+if (count($task) == 0) echo "<br><center><b><font color=\"#ff0000\">NO TASKS FOUND</font></b></center>";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/run.php b/boca-1.5.0/src/admin/run.php
new file mode 100644
index 0000000..4ec0eca
--- /dev/null
+++ b/boca-1.5.0/src/admin/run.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/boca-1.5.0/src/admin/runedit.php b/boca-1.5.0/src/admin/runedit.php
new file mode 100644
index 0000000..c0090f9
--- /dev/null
+++ b/boca-1.5.0/src/admin/runedit.php
@@ -0,0 +1,331 @@
+<?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"]);
+$c = DBGetLanguageData($_SESSION["usertable"]["contestnumber"], $a["langnumber"], $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>Problem package:</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><i> <?php echo $a["language"]; ?></i>:</td>
+ <td width="83%">
+<?php
+ if (isset($c["compilation"]) && $c["compilation"]!="") echo "<b>Compilation Line:</b> ".$c["compilation"]. "<br>";
+ if (isset($c["execution"]) && $c["execution"]!="") echo "<b>Execution Line:</b> ".$c["execution"]. "<br>";
+ if (isset($c["showoutput"]) && $c["showoutput"]!="") echo "<b>Showing Output Line:</b> ". $c["showoutput"]. "<br>";
+
+ if (isset($c["scriptname"]) && $c["scriptname"]!="") {
+ echo "<b>Script for judging:</b> <a href=\"../filedownload.php?". filedownload($c["scriptoid"],$c["scriptname"]) ."\">";
+ echo $c["scriptname"] . "</a>";
+ }
+?>
+ &nbsp;</td>
+ </tr>
+ <tr>
+ <td width="27%" align=right><b>Team's 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/boca-1.5.0/src/admin/score.php b/boca-1.5.0/src/admin/score.php
new file mode 100644
index 0000000..ef9675d
--- /dev/null
+++ b/boca-1.5.0/src/admin/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 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+require('../scorelower.php');
+?>
diff --git a/boca-1.5.0/src/admin/site.php b/boca-1.5.0/src/admin/site.php
new file mode 100644
index 0000000..67a9ebe
--- /dev/null
+++ b/boca-1.5.0/src/admin/site.php
@@ -0,0 +1,605 @@
+<?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(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+if($ct["contestlocalsite"]==$ct["contestmainsite"]) $main=true; else $main=false;
+
+if ($main) {
+ if(isset($_GET["new"]) && $_GET["new"]=="1") {
+ $n = DBNewSite($_SESSION["usertable"]["contestnumber"]);
+ ForceLoad("site.php?site=$n");
+ }
+}
+if (isset($_GET["site"]) && is_numeric($_GET["site"]))
+ $site=$_GET["site"];
+else if (isset($_POST["site"]) && is_numeric($_POST["site"]))
+ $site=$_POST["site"];
+else
+ $site=$ct["contestlocalsite"];
+
+if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"], $site)) == null)
+ ForceLoad("../index.php");
+$sitetime = DBAllSiteTime($_SESSION["usertable"]["contestnumber"], $site);
+
+if (isset($_POST["Logoff"]) && $_POST["Logoff"] == "Logoff all users") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteLogoffAll ($_SESSION["usertable"]["contestnumber"], $site);
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["Logins"]) && $_POST["Logins"] == "Enable logins") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteLogins ($_SESSION["usertable"]["contestnumber"], $site, "t");
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["Logins"]) && $_POST["Logins"] == "Disable logins") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteLogins ($_SESSION["usertable"]["contestnumber"], $site, "f");
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["Submit2"]) && $_POST["Submit2"] == "Start Now") {
+ if ($_POST["confirmation"] == "confirm") {
+ if(!DBSiteStartNow ($_SESSION["usertable"]["contestnumber"], $site))
+ MSGError("Site is already running");
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["SubmitDC"]) && $_POST["SubmitDC"] == "Delete ALL site clars") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteDeleteAllClars ($_SESSION["usertable"]["contestnumber"], $site,
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["SubmitDR"]) && $_POST["SubmitDR"] == "Delete ALL site runs") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteDeleteAllRuns ($_SESSION["usertable"]["contestnumber"], $site,
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["SubmitDT"]) && $_POST["SubmitDT"] == "Delete ALL site tasks") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteDeleteAllTasks ($_SESSION["usertable"]["contestnumber"], $site,
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["SubmitDB"]) && $_POST["SubmitDB"] == "Delete ALL site bkps") {
+ if ($_POST["confirmation"] == "confirm") {
+ DBSiteDeleteAllBkps ($_SESSION["usertable"]["contestnumber"], $site,
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["Submit3"]) && $_POST["Submit3"] == "Stop Now") {
+ if ($_POST["confirmation"] == "confirm") {
+ if(DBSiteEndNow ($_SESSION["usertable"]["contestnumber"], $site))
+ MSGError("Site has been finished");
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["endat"]) && $_POST["endat"] == "Stop At") {
+ if ($_POST["confirmation"] == "confirm" &&
+ isset($_POST["enddateh"]) && $_POST["enddateh"] >= 0 && $_POST["enddateh"] <= 23 &&
+ isset($_POST["enddatemin"]) && $_POST["enddatemin"] >= 0 && $_POST["enddatemin"] <= 59 &&
+ isset($_POST["enddated"]) && isset($_POST["enddatem"]) && isset($_POST["enddatey"]) &&
+ checkdate($_POST["enddatem"], $_POST["enddated"], $_POST["enddatey"])) {
+ $te = mktime ($_POST["enddateh"], $_POST["enddatemin"], 0, $_POST["enddatem"], $_POST["enddated"], $_POST["enddatey"]);
+ if($te > time())
+ MSGError("Impossible to stop at a future time. Still running");
+ else {
+ if(DBSiteEndNow ($_SESSION["usertable"]["contestnumber"], $site, $te))
+ MSGError("Site has been finished");
+ }
+ }
+ ForceLoad("site.php?site=$site");
+}
+if (isset($_POST["Submit1"]) && $_POST["Submit1"] == "Send" && isset($_POST["name"]) && isset($_POST["site"]) && is_numeric($_POST["site"]) &&
+ $_POST["name"] != "" && isset($_POST["lastmileanswer"]) && isset($_POST["scorelevel"]) &&
+ is_numeric($_POST["lastmileanswer"]) && isset($_POST["lastmilescore"]) &&
+ is_numeric($_POST["lastmilescore"]) && is_numeric($_POST["scorelevel"]) &&
+ isset($_POST["chiefname"]) &&
+ isset($_POST["startdateh"]) && $_POST["startdateh"] >= 0 && $_POST["startdateh"] <= 23 &&
+ isset($_POST["startdatemin"]) && $_POST["startdatemin"] >= 0 && $_POST["startdatemin"] <= 59 &&
+ isset($_POST["startdated"]) && isset($_POST["startdatem"]) && isset($_POST["startdatey"]) &&
+
+ checkdate($_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"])) {
+ if ($_POST["confirmation"] == "confirm") {
+ $t = mktime ($_POST["startdateh"], $_POST["startdatemin"], 0, $_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"]);
+
+ $param['contestnumber']=$_SESSION["usertable"]["contestnumber"];
+ $param['sitenumber']=$_POST["site"];
+ $param['sitename']=$_POST["name"];
+ $param['siteip']=$_POST["ip"];
+ $param['siteduration']=$_POST["duration"]*60;
+ $param['sitelastmileanswer']= $_POST["lastmileanswer"]*60;
+ $param['sitelastmilescore']= $_POST["lastmilescore"]*60;
+ $param['sitejudging']= $_POST["judging"];
+ $param['sitetasking']= $_POST["tasking"];
+ if(isset($_POST["autoend"]))
+ $param['siteautoend']= $_POST["autoend"];
+ if(isset($_POST["globalscore"]))
+ $param['siteglobalscore']= $_POST["globalscore"];
+ if(isset($_POST["active"]))
+ $param['siteactive']=$_POST["active"];
+ $param['sitescorelevel']=$_POST["scorelevel"];
+ $param['sitepermitlogins']='';
+ if(isset($_POST["autojudge"]))
+ $param['siteautojudge']=$_POST["autojudge"];
+ $param['sitechiefname']=$_POST["chiefname"];
+ DBUpdateSite ($param);
+ $st1 = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_POST["site"]);
+ if($t != $st1["sitestartdate"]) {
+ $param = array('contest'=>$_SESSION["usertable"]["contestnumber"],
+ 'site'=>$_POST["site"],
+ 'start'=>$t);
+ DBRenewSiteTime($param);
+ }
+ }
+ ForceLoad("site.php?site=".$_POST["site"]);
+}
+
+
+if ($main && isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_POST["Submit"]=='Import' && $_FILES["importfile"]["name"]!="") {
+ if ($_POST["confirmation"] == "confirm") {
+ $type=myhtmlspecialchars($_FILES["importfile"]["type"]);
+ $size=myhtmlspecialchars($_FILES["importfile"]["size"]);
+ $name=myhtmlspecialchars($_FILES["importfile"]["name"]);
+ $temp=myhtmlspecialchars($_FILES["importfile"]["tmp_name"]);
+ if (!is_uploaded_file($temp)) {
+ IntrusionNotify("file upload problem.");
+ ForceLoad("../index.php");
+ }
+
+ if (($ar = file($temp)) === false) {
+ IntrusionNotify("Unable to open the uploaded file.");
+ ForceLoad("site.php");
+ }
+ $userlist=array();
+ if(strtolower(substr($name,-4))==".tsv") {
+ for ($i=0; $i<count($ar) && strpos($ar[$i], "File_Version\t1") === false; $i++) ;
+ if($i >= $count($ar)) MSGError('File format not recognized');
+ $oklines=0;
+ for ($i++; $i<count($ar); $i++) {
+ $x = explode("\t",trim($ar[$i]));
+ if(count($x)==2) {
+ $param=array();
+ $param['sitenumber']=trim($x[0]);
+ $param['sitename']=trim($x[1]);
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ if($_SESSION["usertable"]["usersitenumber"] == $param['sitenumber'] || $main)
+ if(DBNewSite($param['contest'],null,$param)) {
+ $oklines++;
+ $param=array();
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ $param['site']=$ct["contestmainsite"];
+ $param['username']='site' . trim($x[0]);
+ $param['usericpcid']=trim($x[0]);
+ $param['usernumber']=trim($x[0]);
+ $param['userfull']='Site connection';
+ $param['userdesc']='';
+ $param['type']='site';
+ $param['enabled']='t';
+ $param['multilogin']='t';
+ $userlist[$param['username']] = randstr(10);
+ $param['pass']=myhash($userlist[$param['username']]);
+ DBNewUser($param);
+ }
+ }
+ }
+ MSGError($oklines . ' sites included/updated successfully');
+ } else if(strtolower(substr($name,-4))==".tab") {
+ $oklines=0;
+ for ($i=0; $i<count($ar); $i++) {
+ $x = explode("\t",trim($ar[$i]));
+ if(count($x)==8) {
+ $param=array();
+ $param['sitenumber']=trim($x[0]);
+ $param['sitename']=trim($x[2]);
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ if($_SESSION["usertable"]["usersitenumber"] == $param['sitenumber'] || $main)
+ if(DBNewSite($param['contest'],null,$param)) {
+ $oklines++;
+ $param=array();
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ $param['site']=$ct["contestmainsite"];
+ $param['username']='site' . trim($x[0]);
+ $param['usericpcid']=trim($x[0]);
+ $param['usernumber']=trim($x[0]);
+ $param['userfull']='Site connection';
+ $param['userdesc']='';
+ $param['type']='site';
+ $param['enabled']='t';
+ $param['multilogin']='t';
+ $userlist[$param['username']] = randstr(10);
+ $param['pass']=myhash($userlist[$param['username']]);
+ DBNewUser($param);
+ }
+ }
+ }
+ MSGError($oklines . ' sites included/updated successfully');
+ if(count($userlist) > 0) {
+?>
+<center>
+<br><u><b>TAKE NOTE OF THE USERS AND PASSWORDS AND KEEP THEM SECRET</b></u><br><br>
+<table border=1>
+ <tr>
+ <td><b>Username</b></td>
+ <td><b>Password</b></td>
+ </tr>
+<?php
+ foreach($userlist as $user => $pass) {
+ echo "<tr><td>$user</td><td>$pass</td></tr>\n";
+ }
+?>
+</table><br><br><u><b>TAKE NOTE OF THE USERS AND PASSWORDS AND KEEP THEM SECRET</b></u></center></body></html>
+<?php
+ exit;
+ }
+ } else {
+ MSGError('File format not recognized');
+ }
+ }
+ ForceLoad("site.php");
+}
+
+?>
+<br>
+<form name="form1" enctype="multipart/form-data" method="post" action="site.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <script language="javascript" type="text/javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ function conf2() {
+ if (confirm("Confirm DELETING EVERYTHING?")) {
+ if (confirm("This operation has no come back. DATA WILL BE LOST. Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ }
+ function newsite() {
+ document.location='site.php?new=1';
+ }
+ function sitech(n) {
+ if(n==null) {
+ k=document.form1.site[document.form1.site.selectedIndex].value;
+ if(k=='new') newsite();
+ else document.location='site.php?site='+k;
+ } else {
+ document.location='site.php?site='+n;
+ }
+ }
+ </script>
+ <center>
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>Site number:</td>
+ <td width="65%">
+<?php
+echo "<select onChange=\"sitech()\" name=\"site\">\n";
+$cs = DBAllSiteInfo($_SESSION["usertable"]["contestnumber"]);
+for ($i=0; $i<count($cs); $i++) {
+ echo "<option value=\"" . $cs[$i]["sitenumber"] . "\" ";
+ if ($site == $cs[$i]["sitenumber"])
+ echo "selected";
+ echo ">" . $cs[$i]["sitenumber"] . "</option>\n";
+}
+if($main) {
+ echo "<option value=\"new\">new</option>\n";
+}
+echo "</select>\n";
+
+//else
+// echo "<input type=\"text\" readonly name=\"site\" value=\"$site\" size=\"2\" maxlength=\"2\" />\n";
+
+if($ct["contestlocalsite"]==$site) echo "(local site)";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Name:</td>
+ <td width="65%">
+ <input type="text" name="name" value="<?php echo $st["sitename"]; ?>" size="50" maxlength="50" />
+ </td>
+ </tr>
+<?php
+ if(0) {
+ if($main) {
+?>
+ <tr>
+<td width="35%" align=right>IP (plus boca path):</td>
+ <td width="65%">
+ <input type="text" name="ip" value="<?php echo $st["siteip"]; ?>" size="50" maxlength="200" />
+ </td>
+ </tr>
+<?php
+ } else {
+?>
+ <tr>
+<td width="35%" align=right>IP (plus boca path):</td>
+ <td width="65%">
+ <?php echo $st["siteip"]; ?>
+ </td>
+ </tr>
+<?php
+ }
+ }
+?>
+ <tr>
+<?php
+echo " <td nowrap width=\"35%\" align=right>Start date (contest=" . dateconv($ct["conteststartdate"]) . "):</td>";
+?>
+ <td width="65%"> hh:mm
+ <input type="text" name="startdateh" value="<?php echo date("H", $st["sitestartdate"]); ?>" size="2" maxlength="2" />
+ :
+ <input type="text" name="startdatemin" value="<?php echo date("i", $st["sitestartdate"]); ?>" size="2" maxlength="2" />
+ dd/mm/yyyy
+ <input type="text" name="startdated" value="<?php echo date("d", $st["sitestartdate"]); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" name="startdatem" value="<?php echo date("m", $st["sitestartdate"]); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" name="startdatey" value="<?php echo date("Y", $st["sitestartdate"]); ?>" size="4" maxlength="4" />
+ </td>
+ </tr>
+ <tr>
+<?php
+if (!$st["siterunning"]) {
+ echo " <tr>\n";
+ echo " <td nowrap width=\"35%\" align=right><b>Site finished at:</b></td>\n";
+ echo " <td width=\"65%\"><b>" . dateconv($st["siteendeddate"]) . "</b></td>\n";
+ echo " </tr>\n";
+ if($st["siteautoended"])
+ $w = (int) ($st["siteduration"]/60);
+ else
+ $w = (int) ($st["currenttime"]/60);
+ echo " <tr>\n";
+ echo " <td nowrap width=\"35%\" align=right><b>Real duration:</b></td>\n";
+ echo " <td width=\"65%\"><b>" . $w . " minutes</b></td>\n";
+ echo " </tr>\n";
+}
+?>
+ <tr>
+<?php
+echo " <td width=\"35%\" align=right>Duration (contest=";
+echo $ct["contestduration"]/60;
+echo "):</td>";
+?>
+ <td width="65%">
+ <input type="text" name="duration" value="<?php echo $st["siteduration"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"35%\" align=right>Stop answering (contest=";
+echo $ct["contestlastmileanswer"]/60;
+echo "):</td>";
+?>
+ <td width="65%">
+ <input type="text" name="lastmileanswer" value="<?php echo $st["sitelastmileanswer"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"35%\" align=right>Stop scoreboard (contest=";
+echo $ct["contestlastmilescore"]/60;
+echo "):</td>";
+?>
+ <td width="65%">
+ <input type="text" name="lastmilescore" value="<?php echo $st["sitelastmilescore"]/60; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Runs/clars that will be judged here (comma sep):</td>
+ <td width="65%">
+ <input type="text" name="judging" value="<?php echo $st["sitejudging"]; ?>" size="20" maxlength="200" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Tasks that will be treated here (comma sep):</td>
+ <td width="65%">
+ <input type="text" name="tasking" value="<?php echo $st["sitetasking"]; ?>" size="20" maxlength="200" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Username of the chief judge (if any):</td>
+ <td width="65%">
+ <input type="text" name="chiefname" value="<?php echo $st["sitechiefname"]; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Active:</td>
+ <td width="65%">
+<?php
+ if ($st["siteactive"] == "t")
+ echo "<input class=checkbox type=\"checkbox\" name=\"active\" checked value=\"t\" />";
+ else
+ echo "<input class=checkbox type=\"checkbox\" name=\"active\" value=\"t\" />";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Autoend:</td>
+ <td width="65%">
+<?php
+ if ($st["siteautoend"] == "t")
+ echo "<input class=checkbox type=\"checkbox\" name=\"autoend\" checked value=\"t\" />";
+ else
+ echo "<input class=checkbox type=\"checkbox\" name=\"autoend\" value=\"t\" />";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Global score:</td>
+ <td width="65%">
+ <input type="text" name="globalscore" value="<?php echo $st["siteglobalscore"]; ?>" size="20" maxlength="50" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Autojudge (without human interaction):</td>
+ <td width="65%">
+<?php
+ if ($st["siteautojudge"] == "t")
+ echo "<input class=checkbox type=\"checkbox\" name=\"autojudge\" checked value=\"t\" />";
+ else
+ echo "<input class=checkbox type=\"checkbox\" name=\"autojudge\" value=\"t\" />";
+ echo " &lt;- experimental";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Logins are:</td>
+ <td width="65%">
+<?php
+ if ($st["sitepermitlogins"] == "t")
+ echo "enabled";
+ else
+ echo "disabled";
+?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"35%\" align=right>Score level:</td>
+ <td width="65%">
+ <input type="text" name="scorelevel" value="<?php echo $st["sitescorelevel"]; ?>" size="2" maxlength="2" />
+ </td>
+ </tr>
+ <tr>
+ <td width=\"35%\" align=right>Number of Clars:</td>
+ <td width="65%"><?php echo $st["sitenextclar"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"35%\" align=right>Number of Runs:</td>
+ <td width="65%"><?php echo $st["sitenextrun"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"35%\" align=right>Number of Tasks:</td>
+ <td width="65%"><?php echo $st["sitenexttask"]; ?>
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+<?php
+ if($main || $site == $ct["contestlocalsite"]) {
+?>
+ <input type="submit" name="Submit1" value="Send" onClick="conf()">
+ <input type="submit" name="Submit2" value="Start Now" onClick="conf()">
+ <input type="submit" name="Submit3" value="Stop Now" onClick="conf()">
+ <input type="reset" name="Submit4" value="Restore fields">
+<br>
+ <input type="submit" name="Logoff" value="Logoff all users" onClick="conf()">
+ <input type="submit" name="Logins" value="Disable logins" onClick="conf()">
+ <input type="submit" name="Logins" value="Enable logins" onClick="conf()">
+<br><br><br>
+
+ <input type="submit" name="SubmitDC" value="Delete ALL site clars" onClick="conf2()">
+ <input type="submit" name="SubmitDR" value="Delete ALL site runs" onClick="conf2()">
+ <input type="submit" name="SubmitDT" value="Delete ALL site tasks" onClick="conf2()">
+ <input type="submit" name="SubmitDB" value="Delete ALL site bkps" onClick="conf2()">
+<?php
+ }
+?>
+ </center>
+<center>
+<br />
+<table border=1>
+<tr>
+<td nowrap width=\"50%\" align=right>Starting at</td><td nowrap width=\"50%\" align=left>Ending at</td>
+</tr>
+<?php
+$n = count($sitetime);
+for ($i=0; $i< $n; $i++) {
+ echo "<tr>";
+ echo "<td nowrap align=right>";
+ echo dateconv($sitetime[$i]["sitestartdate"]);
+ echo "</td>";
+ echo "<td nowrap align=left>";
+ if($sitetime[$i]["siteenddate"] == 0) {
+ if($st["siterunning"])
+ echo "still open";
+ else echo "auto-ended";
+ }
+ else
+ echo dateconv($sitetime[$i]["siteenddate"]);
+ echo "</td>";
+ echo "</tr>";
+}
+?>
+</table>
+</center>
+
+<?php
+ if($main || $site == $ct["contestlocalsite"]) {
+?>
+ <center>
+ <table border="0">
+ <tr>
+<td nowrap width="50%" align=right>
+(Do not use this button unless really necessary)
+ <input type="submit" name="endat" value="Stop At" onClick="conf()">:
+</td>
+<?php
+$w = $st["siteendeddate"];
+?>
+ <td width="50%"> hh:mm
+ <input type="text" name="enddateh" value="<?php echo date("H", $w); ?>" size="2" maxlength="2" />
+ :
+ <input type="text" name="enddatemin" value="<?php echo date("i", $w); ?>" size="2" maxlength="2" />
+ dd/mm/yyyy
+ <input type="text" name="enddated" value="<?php echo date("d", $w); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" name="enddatem" value="<?php echo date("m", $w); ?>" size="2" maxlength="2" />
+ /
+ <input type="text" name="enddatey" value="<?php echo date("Y", $w); ?>" size="4" maxlength="4" />
+ </td>
+ </tr>
+ </table>
+ </center>
+<?php
+ }
+if($main) {
+?>
+<br><br>
+ <center>
+ <table border="0">
+ <tr>
+ <td width="25%" align=right>Import file:</td>
+ <td width="75%">
+ <input type="file" name="importfile" size="40">
+ </td>
+ </tr>
+ </table>
+ <input type="submit" name="Submit" value="Import" onClick="conf()">
+ </center>
+ <?php } ?>
+</form>
+
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/task.php b/boca-1.5.0/src/admin/task.php
new file mode 100644
index 0000000..95aca10
--- /dev/null
+++ b/boca-1.5.0/src/admin/task.php
@@ -0,0 +1,147 @@
+<?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_once('header.php');
+if(isset($_GET["order"]) && $_GET["order"] != "") {
+$order = myhtmlspecialchars($_GET["order"]);
+ $_SESSION["taskline"] = $order;
+} else {
+ if(isset($_SESSION["taskline"]))
+ $order = $_SESSION["taskline"];
+ else
+ $order='';
+}
+
+if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+
+if (isset($_GET["delete"]) && is_numeric($_GET["delete"]) && isset($_GET["site"]) && is_numeric($_GET["site"])) {
+ DBTaskDelete ($_GET["delete"], $_GET["site"], $_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ ForceLoad("task.php");
+}
+
+if (isset($_GET["return"]) && is_numeric($_GET["return"]) && isset($_GET["site"]) && is_numeric($_GET["site"])) {
+ DBTaskGiveUp ($_GET["return"], $_GET["site"], $_SESSION["usertable"]["contestnumber"], -1, -1);
+// $_SESSION["usertable"]["usernumber"], $_SESSION["usertable"]["usersitenumber"]);
+ ForceLoad("task.php");
+}
+
+if (isset($_GET["get"]) && is_numeric($_GET["get"]) && isset($_GET["site"]) && is_numeric($_GET["site"])) {
+ DBGetTaskToAnswer($_GET["get"], $_GET["site"], $_SESSION["usertable"]["contestnumber"]);
+ ForceLoad("task.php");
+}
+
+if (isset($_GET["done"]) && is_numeric($_GET["done"]) && isset($_GET["site"]) && is_numeric($_GET["site"])) {
+ DBChiefUpdateTask( $_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"], $_GET["site"], $_GET["done"], 'done');
+ ForceLoad("task.php");
+}
+
+
+
+?>
+<br>
+ <script language="javascript">
+ function conf2(url) {
+// if (confirm("Confirm?")) {
+ document.location=url;
+// } else {
+// document.location='task.php';
+// }
+ }
+ </script>
+<table width="100%" border=1>
+ <tr>
+ <td><b><a href="task.php?order=task">Task #</a></b></td>
+ <td><b>Time</b></td>
+ <td><b><a href="task.php?order=user">User / Site</a></b></td>
+ <td><b><a href="task.php?order=description">Description</a></b></td>
+ <td><b>File</b></td>
+ <td><b><a href="task.php?order=staff">Staff / Site</a></b></td>
+ <td><b><a href="task.php?order=status">Status</a></b></td>
+ <td><b>Actions</b></td>
+ </tr>
+<?php
+if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("../index.php");
+
+$task = DBAllTasksInSites($_SESSION["usertable"]["contestnumber"], $s["sitetasking"], $order);
+for ($i=0; $i<count($task); $i++) {
+ $st = $task[$i]["status"];
+
+ if($st == "processing" && $task[$i]["staff"]==$_SESSION["usertable"]["usernumber"] &&
+ $task[$i]["staffsite"]==$_SESSION["usertable"]["usersitenumber"]) $mine=1;
+ else $mine=0;
+
+ echo " <tr>\n";
+ echo " <td nowrap>" . $task[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($task[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>".$task[$i]["username"]."(" . $task[$i]["user"] . ") / ".$task[$i]["site"]."</td>\n";
+ echo " <td>" . $task[$i]["description"];
+ if($task[$i]["color"] != "") {
+ echo " <img alt=\"".$task[$i]["colorname"]."\" width=\"10\" ".
+ "src=\"" . balloonurl($task[$i]["color"]) ."\" />";
+
+ }
+ echo "</td>\n";
+ if ($task[$i]["oid"] != null) {
+ $msg = $task[$i]["username"]." ".$task[$i]["username"]." ".$task[$i]["username"]." ".
+ $task[$i]["username"]." ".$task[$i]["username"]." ".$task[$i]["username"];
+ echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($task[$i]["oid"], $task[$i]["filename"]) . "\">" . $task[$i]["filename"] . "</a>";
+ echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
+ filedownload($task[$i]["oid"], $task[$i]["filename"], $msg) . "', 'Viewx$i','width=680,height=600,scrollbars=yes,".
+ "resizable=yes')\">view</a>";
+ echo "</td>\n";
+ }
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+ if($st != "opentask")
+ echo " <td nowrap>". $task[$i]["staffname"] . "(" . $task[$i]["staff"] .") / ".$task[$i]["staffsite"]."</td>\n";
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+
+ if ($mine) $color="ff7777";
+ else if ($st == "done") $color="bbbbff";
+ else if ($st == "processing") $color="77ff77";
+ else if ($st == "opentask") $color="ffff88";
+ else $color="ffffff";
+
+ echo " <td nowrap bgcolor=\"#$color\">$st</td>\n <td nowrap>";
+
+ if($st != "deleted")
+ echo " <a href=\"javascript: conf2('task.php?delete=" . $task[$i]["number"] . "&site=" .
+ $task[$i]["site"] . "')\">delete</a>\n";
+ if($st == "opentask")
+ echo " <a href=\"javascript: conf2('task.php?get=" . $task[$i]["number"] . "&site=" .
+ $task[$i]["site"] . "')\">get</a>\n";
+ if($st != "opentask")
+ echo " <a href=\"javascript: conf2('task.php?return=" . $task[$i]["number"] . "&site=" .
+ $task[$i]["site"] . "')\">return</a>\n";
+ if($st == "processing")
+ echo " <a href=\"javascript: conf2('task.php?done=" . $task[$i]["number"] . "&site=" .
+ $task[$i]["site"] . "')\">done</a>\n";
+ echo "</td>\n";
+}
+echo "</table>";
+if (count($task) == 0) echo "<br><center><b><font color=\"#ff0000\">NO TASKS FOUND</font></b></center>";
+
+?>
+
+</body>
+</html>
diff --git a/boca-1.5.0/src/admin/user.php b/boca-1.5.0/src/admin/user.php
new file mode 100644
index 0000000..88cc148
--- /dev/null
+++ b/boca-1.5.0/src/admin/user.php
@@ -0,0 +1,444 @@
+<?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["site"]) && isset($_GET["user"]) && is_numeric($_GET["site"]) && is_numeric($_GET["user"]) &&
+ isset($_GET["logout"]) && $_GET["logout"] == 1) {
+ DBLogOut($_SESSION["usertable"]["contestnumber"], $_GET["site"], $_GET["user"]);
+ ForceLoad("user.php");
+}
+if (isset($_POST["usersitenumber"]) && isset($_POST["usernumber"]) && is_numeric($_POST["usersitenumber"]) &&
+ is_numeric($_POST["usernumber"]) && isset($_POST["confirmation"]) && $_POST["confirmation"] == "delete") {
+ if (!DBDeleteUser($_SESSION["usertable"]["contestnumber"], $_POST["usersitenumber"], $_POST["usernumber"]))
+ MSGError("User could not be removed.");
+ ForceLoad("user.php");
+}
+
+if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
+ ForceLoad("../index.php");
+if($ct["contestlocalsite"]==$ct["contestmainsite"]) $main=true; else $main=false;
+
+if (isset($_POST["username"]) && isset($_POST["userfullname"]) && isset($_POST["userdesc"]) && isset($_POST["userip"]) &&
+ isset($_POST["usernumber"]) && isset($_POST["usersitenumber"]) && isset($_POST["userenabled"]) && isset($_POST["usericpcid"]) &&
+ isset($_POST["usermultilogin"]) && isset($_POST["usertype"]) && isset($_POST["confirmation"]) &&
+ isset($_POST["passwordn1"]) && isset($_POST["passwordn2"]) && $_POST["confirmation"] == "confirm") {
+ $param['user'] = htmlspecialchars($_POST["usernumber"]);
+ $param['site'] = htmlspecialchars($_POST["usersitenumber"]);
+ $param['username'] = htmlspecialchars($_POST["username"]);
+ $param['usericpcid'] = htmlspecialchars($_POST["usericpcid"]);
+ $param['enabled'] = htmlspecialchars($_POST["userenabled"]);
+ $param['multilogin'] = htmlspecialchars($_POST["usermultilogin"]);
+ $param['userfull'] = htmlspecialchars($_POST["userfullname"]);
+ $param['userdesc'] = htmlspecialchars($_POST["userdesc"]);
+ $param['type'] = htmlspecialchars($_POST["usertype"]);
+ $param['pass'] = htmlspecialchars($_POST["passwordn1"]);
+ $param['permitip'] = htmlspecialchars($_POST["userip"]);
+ $param['contest'] = $_SESSION["usertable"]["contestnumber"];
+ if ($_POST["passwordn1"] == $_POST["passwordn2"]) {
+ DBNewUser($param);
+ }
+ else MSGError ("Passwords don't match.");
+ ForceLoad("user.php");
+}
+else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["importfile"]["name"]!="") {
+ if ($_POST["confirmation"] == "confirm") {
+ $type=myhtmlspecialchars($_FILES["importfile"]["type"]);
+ $size=myhtmlspecialchars($_FILES["importfile"]["size"]);
+ $name=myhtmlspecialchars($_FILES["importfile"]["name"]);
+ $temp=myhtmlspecialchars($_FILES["importfile"]["tmp_name"]);
+ if (!is_uploaded_file($temp)) {
+ IntrusionNotify("file upload problem.");
+ ForceLoad("../index.php");
+ }
+
+ if (($ar = file($temp)) === false) {
+ IntrusionNotify("Unable to open the uploaded file.");
+ ForceLoad("user.php");
+ }
+ $userlist=array();
+ if(strtolower(substr($name,-4))==".tsv") {
+ for ($i=0; $i<count($ar) && strpos($ar[$i], "File_Version\t1") === false; $i++) ;
+ if($i >= $count($ar)) MSGError('File format not recognized');
+ $oklines=0;
+ for ($i++; $i<count($ar); $i++) {
+ $x = explode("\t",trim($ar[$i]));
+ if(count($x)==7) {
+ $param['site']=trim($x[2]);
+ $param['username']=trim($x[1]);
+ $param['usericpcid']=trim($x[1]);
+ $param['usernumber']=trim($x[1]);
+ if(trim($x[5])!='')
+ $param['userfull']=trim($x[3]) . ' - ' . trim($x[5]);
+ else
+ $param['userfull']=trim($x[3]);
+ $param['userdesc']=trim($x[4]);
+ $param['type']='team';
+ $param['enabled']='t';
+ $param['multilogin']='f';
+ $userlist[$param['site'] . '-' . $param['usernumber']] = randstr(6,'0123456789');
+ $param['pass']=myhash($userlist[$param['site'] . '-' . $param['usernumber']]);
+
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ if($_SESSION["usertable"]["usersitenumber"] == $param['site'] || $main)
+ if(DBNewUser($param))
+ $oklines++;
+ }
+ }
+ MSGError($oklines . ' users included/updated successfully');
+ } else if(strtolower(substr($name,-4))==".tab") {
+ $oklines=0;
+ for ($i=0; $i<count($ar); $i++) {
+ $x = explode("\t",trim($ar[$i]));
+ if(count($x)==9) {
+ $param=array();
+ $param['site']=trim($x[1]);
+ $param['username']=trim($x[0]);
+ $param['usericpcid']=trim($x[0]);
+ $param['usernumber']=trim($x[0]);
+ if(trim($x[5])!='')
+ $param['userfull']=trim($x[3]) . ' - ' . trim($x[5]);
+ else
+ $param['userfull']=trim($x[3]);
+ $param['userdesc']=trim($x[4]);
+ $param['type']='team';
+ $param['enabled']='t';
+ $param['multilogin']='f';
+ $userlist[$param['site'] . '-' . $param['usernumber']] = randstr(6,'0123456789');
+ $param['pass']=myhash($userlist[$param['site'] . '-' . $param['usernumber']]);
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ if($_SESSION["usertable"]["usersitenumber"] == $param['site'] || $main)
+ if(DBNewUser($param))
+ $oklines++;
+ }
+ }
+ MSGError($oklines . ' users included/updated successfully');
+ } else {
+ for ($i=0; $i<count($ar) && strpos($ar[$i], "[user]") === false; $i++) ;
+ if($i >= $count($ar)) MSGError('File format not recognized');
+ for ($i++; $i<count($ar) && $ar[$i][0] != "["; $i++) {
+ $x = trim($ar[$i]);
+ if (strpos($x, "user") !== false && strpos($x, "user") == 0) {
+ $param = array();
+ while (strpos($x, "user") !== false && strpos($x, "user") == 0) {
+ $tmp = explode ("=", $x, 2);
+ switch (trim($tmp[0])) {
+ case "usersitenumber": $param['site']=trim($tmp[1]); break;
+ case "username": $param['username']=trim($tmp[1]); break;
+ case "usericpcid": $param['usericpcid']=trim($tmp[1]); break;
+ case "usernumber": $param['usernumber']=trim($tmp[1]); break;
+ case "userfullname": $param['userfull']=trim($tmp[1]); break;
+ case "userdesc": $param['userdesc']=trim($tmp[1]); break;
+ case "usertype": $param['type']=trim($tmp[1]); break;
+ case "userenabled": $param['enabled']=trim($tmp[1]); break;
+ case "usermultilogin": $param['multilogin']=trim($tmp[1]); break;
+ case "userpassword": $param['pass']=myhash(trim($tmp[1])); break;
+ case "userip": $param['permitip']=trim($tmp[1]); break;
+ }
+ $i++;
+ if ($i>=count($ar)) break;
+ $x = trim($ar[$i]);
+ }
+ $param['contest']=$_SESSION["usertable"]["contestnumber"];
+ if($_SESSION["usertable"]["usersitenumber"] == $param['site'] || $main)
+ DBNewUser($param);
+ }
+ }
+ }
+ if(count($userlist) > 0) {
+?>
+<center>
+<br><u><b>TAKE NOTE OF THE USERS AND PASSWORDS AND KEEP THEM SECRET</b></u><br><br>
+<table border=1>
+ <tr>
+ <td nowrap><b>Site</b></td><td><b>User #</b></td>
+ <td><b>Password</b></td>
+ </tr>
+<?php
+ foreach($userlist as $user => $pass) {
+ $x = explode('-',$user);
+ echo "<tr><td>" . $x[0] . "</td><td>" . $x[1] . "</td><td>$pass</td></tr>\n";
+ }
+?>
+</table><br><br><u><b>TAKE NOTE OF THE USERS AND PASSWORDS AND KEEP THEM SECRET</b></u></center></body></html>
+<?php
+ exit;
+ }
+ }
+ ForceLoad("user.php");
+}
+
+if($main)
+ $usr = DBAllUserInfo($_SESSION["usertable"]["contestnumber"]);
+else
+ $usr = DBAllUserInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"]);
+?>
+
+ <script language="javascript">
+ function conf2(url) {
+ if (confirm("Are you sure?")) {
+ document.location=url;
+ } else {
+ document.location='user.php';
+ }
+ }
+ </script>
+<br>
+<table width="100%" border=1>
+ <tr>
+ <td nowrap><b>User #</b></td>
+ <td><b>Site</b></td>
+ <td><b>Username</b></td>
+ <td><b>ICPC ID</b></td>
+ <td><b>Type</b></td>
+ <td><b>IP</b></td>
+ <td><b>LastLogin</b></td>
+ <td><b>LastLogout</b></td>
+ <td><b>Enabled</b></td>
+ <td><b>Multi</b></td>
+ <td><b>Fullname</b></td>
+ <td><b>Description</b></td>
+ </tr>
+<?php
+for ($i=0; $i<count($usr); $i++) {
+ echo " <tr>\n";
+ if(($usr[$i]["usersitenumber"] == $_SESSION["usertable"]["usersitenumber"] || $main==true) &&
+ //$usr[$i]["usertype"] != 'site' &&
+ ($usr[$i]["usernumber"] != $_SESSION["usertable"]["usernumber"] ||
+ $usr[$i]["usersitenumber"] != $_SESSION["usertable"]["usersitenumber"]))
+ echo " <td nowrap><a href=\"user.php?site=" . $usr[$i]["usersitenumber"] . "&user=" .
+ $usr[$i]["usernumber"] . "\">" . $usr[$i]["usernumber"] . "</a></td>\n";
+ else
+ echo " <td nowrap>" . $usr[$i]["usernumber"] . "</td>\n";
+
+ echo " <td nowrap>" . $usr[$i]["usersitenumber"] . "</td>\n";
+ echo " <td nowrap>" . $usr[$i]["username"] . "&nbsp;</td>\n";
+ echo " <td nowrap>" . $usr[$i]["usericpcid"] . "&nbsp;</td>\n";
+ echo " <td nowrap>" . $usr[$i]["usertype"] . "&nbsp;</td>\n";
+ if ($usr[$i]["userpermitip"]!="")
+ echo " <td nowrap>" . $usr[$i]["userpermitip"] . "*&nbsp;</td>\n";
+ else
+ echo " <td nowrap>" . $usr[$i]["userip"] . "&nbsp;</td>\n";
+ if ($usr[$i]["userlastlogin"] < 1)
+ echo " <td nowrap>never</td>\n";
+ else
+ echo " <td nowrap>" . dateconv($usr[$i]["userlastlogin"]) . "</td>\n";
+ if ($usr[$i]["usersession"] != "")
+ echo " <td nowrap><a href=\"javascript: conf2('user.php?logout=1&site=" . $usr[$i]["usersitenumber"] . "&user=" .
+ $usr[$i]["usernumber"] . "')\">Force Logout</a></td>\n";
+ else {
+ if ($usr[$i]["userlastlogout"] < 1)
+ echo " <td nowrap>never</td>\n";
+ else
+ echo " <td nowrap>" . dateconv($usr[$i]["userlastlogout"]) . "</td>\n";
+ }
+ if ($usr[$i]["userenabled"] == "t")
+ echo " <td nowrap>Yes</td>\n";
+ else
+ echo " <td nowrap>No</td>\n";
+ if ($usr[$i]["usermultilogin"] == "t")
+ echo " <td nowrap>Yes</td>\n";
+ else
+ echo " <td nowrap>No</td>\n";
+ echo " <td nowrap>" . $usr[$i]["userfullname"] . "&nbsp;</td>\n";
+ echo " <td nowrap>" . $usr[$i]["userdesc"] . "&nbsp;</td>\n";
+ echo "</tr>";
+}
+echo "</table>\n";
+
+unset($u);
+if (isset($_GET["site"]) && isset($_GET["user"]) && is_numeric($_GET["site"]) && is_numeric($_GET["user"]))
+ $u = DBUserInfo($_SESSION["usertable"]["contestnumber"], $_GET["site"], $_GET["user"]);
+
+?>
+<script language="JavaScript" src="../sha256.js"></script>
+<script language="JavaScript" src="../hex.js"></script>
+<script language="JavaScript">
+function computeHASH()
+{
+ document.form3.passwordn1.value = js_myhash(document.form3.passwordn1.value);
+ document.form3.passwordn2.value = js_myhash(document.form3.passwordn2.value);
+}
+</script>
+
+<br><br><center><b>Clicking on a user number will bring the user data for edition.<br>
+To import the users, just fill in the import file field.<br>
+The file must be in the format defined in the admin's manual.</b></center>
+
+<form name="form1" enctype="multipart/form-data" method="post" action="user.php">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <center>
+ <table border="0">
+ <tr>
+ <td width="25%" align=right>Import file:</td>
+ <td width="75%">
+ <input type="file" name="importfile" size="40">
+ </td>
+ </tr>
+ </table>
+ </center>
+ <script language="javascript">
+ function conf() {
+ if (confirm("Confirm?")) {
+ document.form1.confirmation.value='confirm';
+ }
+ }
+ </script>
+ <center>
+ <input type="submit" name="Submit" value="Import" onClick="conf()">
+ <input type="reset" name="Submit2" value="Clear">
+ </center>
+</form>
+
+ <br><br>
+ <center>
+<b>To create/edit one user, enter the data below.<br>
+Note that any changes will overwrite the already defined data.<br>
+(Specially care if you use a user number that is already existent.)<br>
+<br>
+</b>
+ <table border="0">
+<form name="form3" action="user.php" method="post">
+ <input type=hidden name="confirmation" value="noconfirm" />
+ <script language="javascript">
+ function conf3() {
+ computeHASH();
+ if (confirm("Confirm?")) {
+ document.form3.confirmation.value='confirm';
+ }
+ }
+<?php
+if (isset($u)) {
+ echo " function conf4() {\n";
+ echo " if (confirm('Confirm the deletion?')) {\n";
+ echo " document.form3.confirmation.value='delete';\n";
+ echo " }\n";
+ echo " }\n";
+ $usite = $u['usersitenumber'];
+} else
+ $usite = $ct['contestlocalsite'];
+?>
+ function conf5() {
+ document.form3.confirmation.value='noconfirm';
+ }
+ </script>
+ <center>
+ <table border="0">
+ <tr>
+ <td width="35%" align=right>User Site Number:</td>
+ <td width="65%">
+ <input type="text" name="usersitenumber" <?php if(!$main) echo "readonly "; echo "value=\"" . $usite . "\""; ?> size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>User Number:</td>
+ <td width="65%">
+ <input type="text" name="usernumber" value="<?php if(isset($u)) echo $u["usernumber"]; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Username:</td>
+ <td width="65%">
+ <input type="text" name="username" value="<?php if(isset($u)) echo $u["username"]; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>ICPC ID:</td>
+ <td width="65%">
+ <input type="text" name="usericpcid" value="<?php if(isset($u)) echo $u["usericpcid"]; ?>" size="20" maxlength="50" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Type:</td>
+ <td width="65%">
+ <select name="usertype">
+ <option <?php if(!isset($u) || $u["usertype"] == "team") echo "selected"; ?> value="team">Team</option>
+ <option <?php if(isset($u)) if($u["usertype"] == "judge") echo "selected"; ?> value="judge">Judge</option>
+ <option <?php if(isset($u)) if($u["usertype"] == "admin") echo "selected"; ?> value="admin">Admin</option>
+ <option <?php if(isset($u)) if($u["usertype"] == "staff") echo "selected"; ?> value="staff">Staff</option>
+ <option <?php if(isset($u)) if($u["usertype"] == "score") echo "selected"; ?> value="score">Score</option>
+ <?php if(1 || $main) { ?>
+ <option <?php if(isset($u)) if($u["usertype"] == "site") echo "selected"; ?> value="site">Site</option>
+ <?php } ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Enabled:</td>
+ <td width="65%">
+ <select name="userenabled">
+ <option <?php if(!isset($u) || $u["userenabled"] != "f") echo "selected"; ?> value="t">Yes</option>
+ <option <?php if(isset($u) && $u["userenabled"] == "f") echo "selected"; ?> value="f">No</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>MultiLogins (local teams should be set to <b>No</b>):</td>
+ <td width="65%">
+ <select name="usermultilogin">
+ <option <?php if(isset($u) && $u["usermultilogin"] == "t") echo "selected"; ?> value="t">Yes</option>
+ <option <?php if(!isset($u) || $u["usermultilogin"] != "t") echo "selected"; ?> value="f">No</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>User Full Name:</td>
+ <td width="65%">
+ <input type="text" name="userfullname" value="<?php if(isset($u)) echo $u["userfullname"]; ?>" size="50" maxlength="200" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>User Description:</td>
+ <td width="65%">
+ <input type="text" name="userdesc" value="<?php if(isset($u)) echo $u["userdesc"]; ?>" size="50" maxlength="300" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>User IP:</td>
+ <td width="65%">
+ <input type="text" name="userip" value="<?php if(isset($u)) echo $u["userpermitip"]; ?>" size="20" maxlength="20" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Password:</td>
+ <td width="65%">
+ <input type="password" name="passwordn1" value="" size="20" maxlength="200" />
+ </td>
+ </tr>
+ <tr>
+ <td width="35%" align=right>Retype Password:</td>
+ <td width="65%">
+ <input type="password" name="passwordn2" value="" size="20" maxlength="200" />
+ </td>
+ </tr>
+ </table>
+ </center>
+ <center>
+ <input type="submit" name="Submit" value="Send" onClick="conf3()">
+<?php if(isset($u)) { ?>
+ <input type="submit" name="Delete" value="Delete" onClick="conf4()">
+<?php } ?>
+ <input type="submit" name="Cancel" value="Cancel" onClick="conf5()">
+<?php if(isset($u)) { ?>
+<br><br><b>WARNING: deleting a user will completely remove EVERYTHING related to it (including runs, clarifications, etc).<b><br>
+<?php } ?>
+ </center>
+</form>
+
+</body>
+</html>