diff options
| -rw-r--r-- | src/admin/task.php | 3 | ||||
| -rw-r--r-- | src/frun.php | 20 | ||||
| -rw-r--r-- | src/ftask.php | 2 | ||||
| -rw-r--r-- | src/optionlower.php | 6 | ||||
| -rwxr-xr-x | src/private/autojudging.php | 1 | ||||
| -rw-r--r-- | src/scoretable.php | 13 | ||||
| -rw-r--r-- | src/staff/header.php | 5 | ||||
| -rwxr-xr-x | src/staff/run.php | 199 | ||||
| -rw-r--r-- | src/staff/task.php | 3 | ||||
| -rw-r--r-- | tools/tst.php (renamed from src/images/tst.php) | 0 |
10 files changed, 236 insertions, 16 deletions
diff --git a/src/admin/task.php b/src/admin/task.php index ae142cb..a1446ce 100644 --- a/src/admin/task.php +++ b/src/admin/task.php @@ -101,8 +101,7 @@ for ($i=0; $i<count($task); $i++) { } 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"]; + $msg = "///// " . $task[$i]["username"]." -- ". substr($task[$i]["fullname"],0,60) ." -- ".$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,". diff --git a/src/frun.php b/src/frun.php index 3694f21..3624456 100644 --- a/src/frun.php +++ b/src/frun.php @@ -481,10 +481,28 @@ function DBUpdateRunAutojudging($contest, $site, $number, $ip, $answer, $stdout, $b = DBSiteInfo($contest, $site, $c); - if($b["siteautojudge"]!="t") { // && $retval != 1 && $retval != 6) { //cassiopc incluir automatic judging of some codes 1:YES WA:6 + if( true || + $a["runproblem"] == 1 || + $a["runproblem"] == 2 || + $a["runproblem"] == 3 || + $a["runproblem"] == 4 || + $a["runproblem"] == 5 || + $a["runproblem"] == 6 || + $a["runproblem"] == 7 || + $a["runproblem"] == 8 || + $a["runproblem"] == 9 || + $a["runproblem"] == 10 || + $a["runproblem"] == 11 || + $a["runproblem"] == 12 || + $a["runproblem"] == 13 || + ($retval != 1 && $retval != 6)) { + + if($b["siteautojudge"]!="t") { + // && (($retval != 1 && $retval != 6) || $a["runproblem"] == 1 || $a["runproblem"] == 2) ) { //cassiopc incluir automatic judging of some codes 1:YES WA:6 DBExec($c, "commit work", "DBUpdateRunAutojudging(commit)"); LOGLevel("Autojudging answered a run (run=$number, site=$site, contest=$contest, answer='$answer', retval=$retval)", 3); return true; + } } //echo "DEBUG: $contest, $site, " .$a["usernumber"].", $site, $number, $retval\n"; diff --git a/src/ftask.php b/src/ftask.php index 8280109..73336c3 100644 --- a/src/ftask.php +++ b/src/ftask.php @@ -216,7 +216,7 @@ function DBOpenTasksInSites($contest,$site) { function DBOpenTasksSNS($contest,$site,$st,$order='task',$adm=false) { $c = DBConnect(); $sql = "select distinct t.tasknumber as number, t.taskdatediff as timestamp, t.usernumber as user, ". - "u.username as username, t.color as color, t.colorname as colorname, " . + "u.username as username, u.userfullname as fullname, t.color as color, t.colorname as colorname, " . "t.taskstatus as status, t.sitenumber as site, t.taskstaffnumber as staff, " . "t.taskstaffsite as staffsite, t.taskdesc as description, tasksystem as system, " . "t.taskfilename as filename, t.taskdata as oid, uu.username as staffname " . diff --git a/src/optionlower.php b/src/optionlower.php index 8fba3c9..b3f6055 100644 --- a/src/optionlower.php +++ b/src/optionlower.php @@ -96,19 +96,19 @@ function computeHASH() <tr> <td width="35%" align=right>Old Password:</td> <td width="65%"> - <input type="password" name="passwordo" size="20" maxlength="20" /> + <input type="password" name="passwordo" size="20" maxlength="200" /> </td> </tr> <tr> <td width="35%" align=right>New Password:</td> <td width="65%"> - <input type="password" name="passwordn1" size="20" maxlength="20" /> + <input type="password" name="passwordn1" size="20" maxlength="200" /> </td> </tr> <tr> <td width="35%" align=right>Retype New Password:</td> <td width="65%"> - <input type="password" name="passwordn2" size="20" maxlength="20" /> + <input type="password" name="passwordn2" size="20" maxlength="200" /> </td> </tr> </table> diff --git a/src/private/autojudging.php b/src/private/autojudging.php index 06d7006..dcb7398 100755 --- a/src/private/autojudging.php +++ b/src/private/autojudging.php @@ -395,6 +395,7 @@ while(42) { continue; } else { $errp=0; $ncor=0; $showcor=false; + sort($inputlist); foreach($inputlist as $file) { $file = basename($file); if(is_file($dir . $ds . "input" . $ds . $file)) { diff --git a/src/scoretable.php b/src/scoretable.php index 855b66c..850ee9a 100644 --- a/src/scoretable.php +++ b/src/scoretable.php @@ -175,10 +175,11 @@ if(isset($_GET["remote"])) { } exit; } - if(!$redo) { $conf=globalconf(); - $strtmp = decryptData(substr($strtmp,strpos($strtmp,"\n")),$conf["key"],'score'); + if($conf['doenc']) + $strtmp = decryptData(substr($strtmp,strpos($strtmp,"\n")),$conf["key"],'score'); + else $strtmp = substr($strtmp,strpos($strtmp,"\n")); if($strtmp=="") $redo=TRUE; } if($redo) { @@ -396,7 +397,9 @@ if($redo) { } $conf=globalconf(); - $strtmp = "<!-- " . time() . " --> <?php exit; ?>\n" . encryptData($strtmp,$conf["key"],false); + if($conf['doenc']) + $strtmp = "<!-- " . time() . " --> <?php exit; ?>\n" . encryptData($strtmp,$conf["key"],false); + else $strtmp = "<!-- " . time() . " --> <?php exit; ?>\n" . $strtmp; if(file_put_contents($scoretmp, $strtmp,LOCK_EX)===FALSE) { if($_SESSION["usertable"]["usertype"] == 'admin') { MSGError("Cannot write to the score cache file -- performance might be compromised"); @@ -404,7 +407,9 @@ if($redo) { LOGError("Cannot write to the ".$_SESSION["usertable"]["usertype"]."-score cache file -- performance might be compromised"); } $conf=globalconf(); - $strtmp = decryptData(substr($strtmp,strpos($strtmp,"\n")),$conf["key"]); + if($conf['doenc']) + $strtmp = decryptData(substr($strtmp,strpos($strtmp,"\n")),$conf["key"]); + else $strtmp = substr($strtmp,strpos($strtmp,"\n")); } echo $strtmp; ?> diff --git a/src/staff/header.php b/src/staff/header.php index 650489c..21f93f9 100644 --- a/src/staff/header.php +++ b/src/staff/header.php @@ -67,14 +67,13 @@ echo " <tr>\n"; echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=task.php>Tasks</a></td>\n"; //echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=task.php>Tasks ($nr)</a></td>\n"; echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=score.php>Score</a></td>\n"; -//echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=run.php>Runs</a></td>\n"; -echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n"; +echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=run.php>Runs</a></td>\n"; echo " <td align=center width=\"20%\"><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></td>\n"; -//echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n"; +echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n"; echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=../index.php>Logout</a></td>\n"; echo " </tr>\n"; echo "</table>\n"; diff --git a/src/staff/run.php b/src/staff/run.php new file mode 100755 index 0000000..0774fc7 --- /dev/null +++ b/src/staff/run.php @@ -0,0 +1,199 @@ +<?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["order"]) && $_POST["order"] != "") { +$order = myhtmlspecialchars($_POST["order"]); + $_SESSION["runline"] = $order; +} else { + if(isset($_SESSION["runline"])) + $order = $_SESSION["runline"]; +else + $order = ''; +} +$ds = DIRECTORY_SEPARATOR; +if($ds=="") $ds = "/"; + +$runphp="run.php"; +?> +<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=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); + + +$limittasks=false; +if(is_readable($_SESSION["locr"] . $ds . 'private' . $ds . 'score.sep')) { + $limittasks=true; + $rf=file($_SESSION["locr"] . $ds . 'private' . $ds . 'score.sep'); + for($rfi=1;$rfi<=count($rf);$rfi++) { + $lin = explode('#',trim($rf[$rfi-1])); + if(isset($lin[1]) && $_SESSION["usertable"]["usertype"]!='admin') { + $arr=explode(' ',trim($lin[1])); + for($arri=0;$arri<count($arr);$arri++) + if($arr[$arri] != '' && preg_match($arr[$arri],$_SESSION["usertable"]["username"])) break; + if($arri>=count($arr)) continue; + } + $lin = trim($lin[0]); + if($lin=='') continue; + $grname=explode(' ',$lin); + + for ($i=0; $i<count($run); $i++) { + for($k=1;$k<count($grname);$k++) { + if($run[$i]["site"]==$grname[$k]) { + $run[$i]["okk"]=true; + break; + } + else if(strpos($grname[$k],'/') >= 1) { + $u1 = explode('/',$grname[$k]); + if(isset($u1[1]) && $run[$i]["user"] >= $u1[0] && $run[$i]["user"] <= $u1[1]) { + if(!isset($u1[2]) || $u1[2]==$run[$i]["site"]) { + $run[$i]["okk"]=true; + break; + } + } + } + } + } + } +} else $run = array(); + +$anyprinted=false; + + +for ($i=0; $i<count($run); $i++) { +if($limittasks && (!isset($run[$i]["okk"]) || $run[$i]["okk"]!=true)) continue; + $anyprinted=true; + + 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 $run[$i]["number"] . "</td>"; + + 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> "; + + 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\"> </td>\n"; +*/ + if ($run[$i]["answer"] == "") { + echo " <td> </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 (!$anyprinted) 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> + </form> +<?php +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"; +} +?> +</body> +</html> diff --git a/src/staff/task.php b/src/staff/task.php index 52d9665..741ff97 100644 --- a/src/staff/task.php +++ b/src/staff/task.php @@ -128,8 +128,7 @@ for ($i=0; $i<count($task); $i++) { } 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"]; + $msg = "///// " . $task[$i]["username"]." -- ". substr($task[$i]["fullname"],0,60) ." -- ".$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?". diff --git a/src/images/tst.php b/tools/tst.php index 38f5fd0..38f5fd0 100644 --- a/src/images/tst.php +++ b/tools/tst.php |