diff options
Diffstat (limited to 'boca-1.5.0/src')
| -rw-r--r-- | boca-1.5.0/src/admin/problem.php | 20 | ||||
| -rw-r--r-- | boca-1.5.0/src/admin/report/piechart.php | 10 | ||||
| -rw-r--r-- | boca-1.5.0/src/admin/report/stat.php | 12 | ||||
| -rw-r--r-- | boca-1.5.0/src/admin/task.php | 2 | ||||
| -rw-r--r-- | boca-1.5.0/src/admin/user.php | 44 | ||||
| -rw-r--r-- | boca-1.5.0/src/db.php | 8 | ||||
| -rw-r--r-- | boca-1.5.0/src/fcontest.php | 67 | ||||
| -rw-r--r-- | boca-1.5.0/src/fproblem.php | 52 | ||||
| -rw-r--r-- | boca-1.5.0/src/freport.php | 39 | ||||
| -rw-r--r-- | boca-1.5.0/src/frun.php | 4 | ||||
| -rw-r--r-- | boca-1.5.0/src/ftask.php | 5 | ||||
| -rw-r--r-- | boca-1.5.0/src/hex.php | 49 | ||||
| -rw-r--r-- | boca-1.5.0/src/judge/team.php | 1 | ||||
| -rw-r--r-- | boca-1.5.0/src/optionlower.php | 20 | ||||
| -rwxr-xr-x | boca-1.5.0/src/private/autojudging.php | 44 | ||||
| -rwxr-xr-x | boca-1.5.0/src/private/createproblemzip.php | 15 | ||||
| -rw-r--r-- | boca-1.5.0/src/scoretable.php | 8 | ||||
| -rw-r--r-- | boca-1.5.0/src/staff/task.php | 2 | ||||
| -rw-r--r-- | boca-1.5.0/src/team/header.php | 4 | ||||
| -rw-r--r-- | boca-1.5.0/src/webcast.zip | bin | 2813 -> 0 bytes | |||
| -rw-r--r-- | boca-1.5.0/src/webcast/contest/index.php | 15 |
21 files changed, 302 insertions, 119 deletions
diff --git a/boca-1.5.0/src/admin/problem.php b/boca-1.5.0/src/admin/problem.php index 0b055b6..365d059 100644 --- a/boca-1.5.0/src/admin/problem.php +++ b/boca-1.5.0/src/admin/problem.php @@ -61,7 +61,7 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P <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("Confirm the DELETION of the PROBLEM and ALL data associated to it?")) { if (confirm("Are you REALLY sure about what you are doing? DATA CANNOT BE RECOVERED!")) { document.location=url; } else { @@ -71,6 +71,13 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P document.location='problem.php'; } } + function conf3(url) { + if (confirm("Confirm the UNDELETION of the PROBLEM?")) { + document.location=url; + } else { + document.location='problem.php'; + } + } </script> <table width="100%" border=1> <tr> @@ -89,8 +96,15 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P 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"; + if(strpos($prob[$i]["fullname"],"(DEL)") !== false) { + echo " <td nowrap><a href=\"javascript: conf3('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) . + "')\">" . $prob[$i]["number"]; + echo "(deleted)"; + } else { + echo " <td nowrap><a href=\"javascript: conf2('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) . + "')\">" . $prob[$i]["number"]; + } + echo "</a></td>\n"; } else { echo " <td nowrap>" . $prob[$i]["number"] . " (fake)</td>\n"; } diff --git a/boca-1.5.0/src/admin/report/piechart.php b/boca-1.5.0/src/admin/report/piechart.php index 18d8d04..e6dbf95 100644 --- a/boca-1.5.0/src/admin/report/piechart.php +++ b/boca-1.5.0/src/admin/report/piechart.php @@ -41,7 +41,12 @@ else $chart = new PieChart(400, 250); if(isset($_GET['order'])) $chart->order=true; +else $chart->order=false; +$tot=0; +for($i=1;$i<count($v); $i+=2) { + $tot += $v[$i+1]; +} for($i=1;$i<count($v); $i+=2) { $color = null; if($cor != null) { @@ -50,7 +55,10 @@ for($i=1;$i<count($v); $i+=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)); + if($v[$i+1] > $tot/100) + $chart->addPoint(new Point($v[$i], $v[$i+1], $color)); + else + $chart->addPoint(new Point($v[$i], $tot/100, $color)); } $chart->setTitle($v[0]); diff --git a/boca-1.5.0/src/admin/report/stat.php b/boca-1.5.0/src/admin/report/stat.php index 7d99cb3..1abfa71 100644 --- a/boca-1.5.0/src/admin/report/stat.php +++ b/boca-1.5.0/src/admin/report/stat.php @@ -233,7 +233,9 @@ 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]; + if(isset($d['user'][$keya])) + $vala = $d['user'][$keya]; + else $vala=0; echo "<tr><td>".$d['userfull'][$keya]."</td>"; reset($d['problem']); while (list($key, $val) = each($d['problem'])) { @@ -289,7 +291,9 @@ while (list($keya, $val) = each($d['timestamp'])) { $atual += $passo; $pos++; } - $res[$pos]++; + if(isset($res[$pos])) + $res[$pos]++; + else $res[$pos]=1; if($res[$pos] > $m) $m=$res[$pos]; } @@ -318,7 +322,9 @@ while (list($keya, $val) = each($d['timestampyes'])) { $atual += $passo; $pos++; } - $res[$pos]++; + if(isset($res[$pos])) + $res[$pos]++; + else $res[$pos]=1; } $str="Accepted Runs by Time Period" . chr(1) . $m; diff --git a/boca-1.5.0/src/admin/task.php b/boca-1.5.0/src/admin/task.php index 95aca10..a7a5339 100644 --- a/boca-1.5.0/src/admin/task.php +++ b/boca-1.5.0/src/admin/task.php @@ -101,7 +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"]." ". + $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?". diff --git a/boca-1.5.0/src/admin/user.php b/boca-1.5.0/src/admin/user.php index 88cc148..5e07930 100644 --- a/boca-1.5.0/src/admin/user.php +++ b/boca-1.5.0/src/admin/user.php @@ -37,7 +37,7 @@ 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") { + isset($_POST["passwordn1"]) && isset($_POST["passwordn2"]) && isset($_POST["passwordo"]) && $_POST["confirmation"] == "confirm") { $param['user'] = htmlspecialchars($_POST["usernumber"]); $param['site'] = htmlspecialchars($_POST["usersitenumber"]); $param['username'] = htmlspecialchars($_POST["username"]); @@ -47,13 +47,20 @@ if (isset($_POST["username"]) && isset($_POST["userfullname"]) && isset($_POST[" $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); + + $passcheck = htmlspecialchars($_POST["passwordo"]); + $a = DBUserInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"], null, false); + if(myhash($a['userpassword'] . session_id()) != $passcheck) { + MSGError('Admin password is incorrect'); + } else { + if ($_POST["passwordn1"] == $_POST["passwordn2"]) { + $param['pass'] = bighexsub(htmlspecialchars($_POST["passwordn1"]),$a['userpassword']); + DBNewUser($param); + } + else MSGError ("Passwords don't match."); } - else MSGError ("Passwords don't match."); ForceLoad("user.php"); } else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["importfile"]["name"]!="") { @@ -73,10 +80,10 @@ else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["imp } $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'); + 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++) { + for ($i++; $i < count($ar); $i++) { $x = explode("\t",trim($ar[$i])); if(count($x)==7) { $param['site']=trim($x[2]); @@ -129,9 +136,9 @@ else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["imp } 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++) { + 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(); @@ -215,7 +222,7 @@ else <td><b>Description</b></td> </tr> <?php -for ($i=0; $i<count($usr); $i++) { +for ($i=0; $i < count($usr); $i++) { echo " <tr>\n"; if(($usr[$i]["usersitenumber"] == $_SESSION["usertable"]["usersitenumber"] || $main==true) && //$usr[$i]["usertype"] != 'site' && @@ -271,8 +278,11 @@ if (isset($_GET["site"]) && isset($_GET["user"]) && is_numeric($_GET["site"]) && <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); + document.form3.passwordn1.value = bighexsoma(js_myhash(document.form3.passwordn1.value),js_myhash(document.form3.passwordo.value)); + document.form3.passwordn2.value = bighexsoma(js_myhash(document.form3.passwordn2.value),js_myhash(document.form3.passwordo.value)); + document.form3.passwordo.value = js_myhash(js_myhash(document.form3.passwordo.value)+'<?php echo session_id(); ?>'); +// document.form3.passwordn1.value = js_myhash(document.form3.passwordn1.value); +// document.form3.passwordn2.value = js_myhash(document.form3.passwordn2.value); } </script> @@ -426,6 +436,12 @@ if (isset($u)) { <input type="password" name="passwordn2" value="" size="20" maxlength="200" /> </td> </tr> + <tr> + <td width="35%" align=right>Admin (this user) Password:</td> + <td width="65%"> + <input type="password" name="passwordo" value="" size="20" maxlength="200" /> + </td> + </tr> </table> </center> <center> diff --git a/boca-1.5.0/src/db.php b/boca-1.5.0/src/db.php index da83707..6d437dc 100644 --- a/boca-1.5.0/src/db.php +++ b/boca-1.5.0/src/db.php @@ -163,7 +163,8 @@ function DBConnect($forcenew=false) { "Is it running? Is the DB password in conf.php correct?"); exit; } - DBExecNonStop($conn,"SET NAMES '${conf["dbclientenc"]}'","set client encoding"); + if(isset($conf["dbclientenc"])) + DBExecNonStop($conn,"SET NAMES '${conf["dbclientenc"]}'","set client encoding"); return $conn; } //fecha a conexao com o banco (isso nao eh realmente necessario, ja que o php/apache cuidam do servico) @@ -267,7 +268,10 @@ function DBCreateDatabase() { MSGError("Unable to connect to template1 as ".$conf["dbsuperuser"]); exit; } - $r = DBExec($conn, "create database ${conf["dbname"]} with encoding = '${conf["dbencoding"]}'", "DBCreateDatabase(create)"); + if(isset($conf["dbencoding"])) + $r = DBExec($conn, "create database ${conf["dbname"]} with encoding = '${conf["dbencoding"]}'", "DBCreateDatabase(create)"); + else + $r = DBExec($conn, "create database ${conf["dbname"]} with encoding = 'UTF8'", "DBCreateDatabase(create)"); } function DBcrc($contest,$id, $c=null) { diff --git a/boca-1.5.0/src/fcontest.php b/boca-1.5.0/src/fcontest.php index 9390a31..23ce241 100644 --- a/boca-1.5.0/src/fcontest.php +++ b/boca-1.5.0/src/fcontest.php @@ -139,7 +139,7 @@ CREATE TABLE \"usertable\" ( \"usersitenumber\" int4 NOT NULL, -- (id do local do time) \"usernumber\" int4 NOT NULL, -- (id do usuario) \"username\" varchar(20) NOT NULL, -- (nome do usuario) - \"userfullname\" varchar(200) NOT NULL, -- (nome completo do usuario) + \"userfullname\" varchar(200) NOT NULL, -- (nome completo do usuario) \"userdesc\" varchar(300), -- (descricao: escola ou integrantes ou etc) \"usertype\" varchar(20) NOT NULL, -- (judge, team, admin, system) \"userenabled\" bool DEFAULT 't' NOT NULL, -- (usuario ativo) @@ -216,6 +216,11 @@ function DBAllUserInfo($contest,$site=-1) { $a = array(); for ($i=0;$i<$n;$i++) { $a[$i] = DBRow($r,$i); + $a[$i]['changepassword']=true; + if(substr($a[$i]['userpassword'],0,1)=='!') { + $a[$i]['userpassword'] = substr($a[$i]['userpassword'],1); + $a[$i]['changepassword']=false; + } $a[$i]['userpassword'] = myhash($a[$i]['userpassword'] . $a[$i]['usersessionextra']); } return $a; @@ -245,8 +250,35 @@ function DBUserInfo($contest, $site, $user, $c=null,$hashpass=true) { LOGError("Unable to find the user in the database. SQL=(" . $sql . ")"); MSGError("Unable to find the user in the database. Contact an admin now!"); } + $a['changepassword']=true; + if(substr($a['userpassword'],0,1)=='!') { + $a['userpassword'] = substr($a['userpassword'],1); + $a['changepassword']=false; + } if($hashpass) $a['userpassword'] = myhash($a['userpassword'] . $a['usersessionextra']); + $inst = explode(']',$a['userfullname']); + if(isset($inst[1])) { + $a['userfullname'] = trim($inst[1]); + $inst = explode('[',$inst[0]); + if(isset($inst[1])) + $a['usershortname'] = trim($inst[1]); + } + $inst = explode(']',$a['userdesc']); + if(isset($inst[1])) { + $inst2 = explode('[',$inst[0]); + if(isset($inst2[1])) + $a['usershortinstitution'] = trim($inst2[0]); + if(isset($inst[2])) { + $a['userdesc']=trim($inst[2]); + $inst = explode('[',$inst[1]); + if(isset($inst[1])) { + $a['userinstitution'] = trim($inst[1]); + } + } else { + $a['userdesc']=trim($inst[1]); + } + } return $a; } function DBDeleteUser($contest, $site, $user) { @@ -322,9 +354,10 @@ function DBSiteLogoffAll($contest, $site) { LOGLevel("Logoff all (contest=$contest,site=$site).",2); } -function DBAllSiteInfo($contest) { +function DBAllSiteInfo($contest, $c=null) { $sql = "select * from sitetable where contestnumber=$contest"; - $c = DBConnect(); + if($c==null) + $c = DBConnect(); $r = DBExec ($c, $sql); $n = DBnlines($r); if ($n == 0) { @@ -415,6 +448,7 @@ function DBSiteLogins ($contest, $site, $logins) { $param['contestnumber']=$contest; $param['sitenumber']=$site; $param['sitepermitlogins']=$logins; + unset($param['updatetime']); DBUpdateSite ($param); LOGLevel("Site logins=$logins (contest=$contest)",2); } @@ -634,10 +668,11 @@ function DBUpdateSite ($param,$c=null) { $sql .= " sitescorelevel=$sitescorelevel where contestnumber=$contestnumber and sitenumber=$sitenumber " . "and updatetime < $updatetime"; DBExec($c,$sql, "DBUpdateSite(update site)"); - if($docommit) + if($docommit) { DBExec($c, "commit work", "DBUpdateSite(commit-update)"); - LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] . - " changed the site $sitenumber (contest=$contestnumber) settings.",2); + LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] . + " changed the site $sitenumber (contest=$contestnumber) settings.",2); + } } else { if($docommit) DBExec($c, "commit work", "DBUpdateSite(commit-noupdate)"); @@ -648,7 +683,7 @@ function DBUpdateContest ($param, $c=null) { if(isset($param['contestnumber']) && !isset($param['number'])) $param['number']=$param['contestnumber']; $ac=array('number'); - $ac1=array('updatetime','atualizasites','scorelevel','mainsite','localsite','mainsiteurl','keys','unlockkey', + $ac1=array('updatetime','atualizasites','scorelevel','mainsite','localsite','mainsiteurl','keys','unlockkey','name', 'active','lastmileanswer','lastmilescore','penalty','startdate', 'duration', 'maxfilesize'); $type['number']=1; $type['scorelevel']=1; @@ -721,6 +756,7 @@ function DBUpdateContest ($param, $c=null) { "DBUpdateContest(active)"); LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] . " activated contest $number.",2); } + $chd=false; if($updatetime > $a['updatetime']) { $ret=2; $sql = "update contesttable set updatetime=".$updatetime; @@ -769,7 +805,7 @@ function DBUpdateContest ($param, $c=null) { } if($atualizasites) { - $s = DBAllSiteInfo($number); + $s = DBAllSiteInfo($number,$c); for($i=0; $i<count($s); $i++) { $param = $s[$i]; $param['contestnumber']=$number; @@ -781,7 +817,7 @@ function DBUpdateContest ($param, $c=null) { $param['sitelastmileanswer']=$lastmileanswer; if($lastmilescore > 0) $param['sitelastmilescore']=$lastmilescore; - + unset($param['updatetime']); DBUpdateSite ($param,$c); if($startdate > 0) { @@ -793,11 +829,13 @@ function DBUpdateContest ($param, $c=null) { } } } - LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] . " changed the contest $number settings.",2); + $chd=true; } if($cw) { DBExec($c, "commit work", "DBUpdateContest(commit)"); } + if($chd) + LOGLevel("User " . $_SESSION["usertable"]["username"]."/". $_SESSION["usertable"]["usersitenumber"] . " changed the contest $number settings.",2); return $ret; } function DBRenewSiteTime($param, $c=null) { @@ -1042,11 +1080,15 @@ function DBUserUpdate($contest, $site, $user, $username, $userfull, $userdesc, $ "tried to change settings, but password was incorrect.",2); MSGError ("Incorrect password."); } - else { + else { + if(!$a['changepassword']) { + MSGError('Password change is DISABLED'); return; + } if ($a["userpassword"] == "") $temp = myhash(""); else $temp = $a["userpassword"]; + $lentmp = strlen($temp); $temp = bighexsub($passn, $temp); - $newpass = substr($temp, strlen($temp)-strlen($myhash), strlen($myhash)); + $newpass = substr($temp, strlen($temp)-$lentmp); $c = DBConnect(); DBExec($c, "begin work"); @@ -1163,6 +1205,7 @@ function DBNewUser($param, $c=null) { MSGError("Site $site does not exist"); return false; } + if($type=='team') $pass='!'.$pass; $sql = "insert into usertable (contestnumber, usersitenumber, usernumber, username, usericpcid, userfullname, " . "userdesc, usertype, userenabled, usermultilogin, userpassword, userpermitip) values " . "($contest, $site, $user, '$username', '$usericpcid', '$userfull', '$userdesc', '$type', '$enabled', " . diff --git a/boca-1.5.0/src/fproblem.php b/boca-1.5.0/src/fproblem.php index 42346cb..bbf5758 100644 --- a/boca-1.5.0/src/fproblem.php +++ b/boca-1.5.0/src/fproblem.php @@ -111,8 +111,9 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { "p.problemcolor as color, p.problemcolorname as colorname, " . "p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " . " from problemtable as p " . - "where p.contestnumber=$contestnumber and p.problemfullname !~ '(DEL)' order by p.problemnumber", + "where p.contestnumber=$contestnumber order by p.problemnumber", "DBGetFullProblemData(get problem)"); + // and p.problemfullname !~ '(DEL)' $n = DBnlines($r); if ($n == 0) { LOGLevel("No problems defined in the database ($contestnumber)",1); @@ -122,7 +123,10 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { $ds = DIRECTORY_SEPARATOR; if($ds=="") $ds = "/"; for ($i=0;$i<$n;$i++) { - $a[$i] = array_merge(array(),DBRow($r,$i)); + $a[$i] = array_merge(array(),DBRow($r,$i)); + + if(strpos($a[$i]['fullname'],'(DEL)') !== false) continue; + $nn=$a[$i]['number']; $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contestnumber ."-problem" . $nn; $ck = myshorthash(''); @@ -161,7 +165,9 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { $failed=2; } if(!$failed) { - $descfile=trim(sanitizeText($info['descfile'])); + $descfile=''; + if(isset($info['descfile'])) + $descfile=trim(sanitizeText($info['descfile'])); $basename=trim(sanitizeText($info['basename'])); $fullname=trim(sanitizeText($info['fullname'])); if($basename=='' || $fullname=='') @@ -170,17 +176,23 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { } else $failed=4; if(!$failed) { @mkdir($ptmp); - if($descfile != '') + if($descfile != '') { if(file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile),$cf['key']),LOCK_EX)===FALSE) $failed=5; - if(!$failed) { - file_put_contents($ptmp . ".name",$ptmp . $ds . $descfile); - file_put_contents($ptmp . ".hash",$a[$i]['inputhash']); - if(is_readable($ptmp . ".name")) { - $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); - if($a[$i]['descfilename'] != '') - $a[$i]['descoid']=-1; + if(!$failed) { + file_put_contents($ptmp . ".name",$ptmp . $ds . $descfile); + file_put_contents($ptmp . ".hash",$a[$i]['inputhash']); + if(is_readable($ptmp . ".name")) { + $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); + if($a[$i]['descfilename'] != '') + $a[$i]['descoid']=-1; + } } + } else { + @unlink($ptmp . ".name"); + @unlink($ptmp . ".hash"); + } + if(!$failed) { DBExec($c,"update problemtable set problemfullname='$fullname', problembasefilename='$basename' where problemnumber=$nn and contestnumber=$contestnumber", "DBGetFullProblemData(free problem)"); $a[$i]['basefilename']=$basename; @@ -233,11 +245,15 @@ function DBDeleteProblem($contestnumber, $param, $c=null) { $r = DBExec($c, $sql . " for update", "DBDeleteProblem(get for update)"); if(DBnlines($r)>0) { $a = DBRow($r,0); - $sql="update problemtable set problemfullname='".$a["problemfullname"] ."(DEL)', updatetime=".time(). - " where contestnumber=$contestnumber and problemnumber=$number "; + if(($pos=strpos($a["problemfullname"],"(DEL)")) !== false) { + $sql="update problemtable set problemfullname='".substr($a["problemfullname"],0,$pos) ."', updatetime=".time(). + " where contestnumber=$contestnumber and problemnumber=$number "; + } else { + $sql="update problemtable set problemfullname='".$a["problemfullname"] ."(DEL)', updatetime=".time(). + " where contestnumber=$contestnumber and problemnumber=$number "; + } if ($inputfilename != "") $sql .= " and probleminputfilename='$inputfilename'"; - $r = DBExec($c, $sql, "DBDeleteLanguage(update)"); $r = DBExec($c,"select runnumber as number, runsitenumber as site from runtable where contestnumber=$contestnumber and runproblem=$number for update"); $n = DBnlines($r); @@ -248,7 +264,13 @@ function DBDeleteProblem($contestnumber, $param, $c=null) { } if($cw) DBExec($c, "commit", "DBDeleteProblem(commit)"); + $ds = DIRECTORY_SEPARATOR; + if($ds=="") $ds = "/"; + $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contestnumber ."-problem" . $number; + @unlink($ptmp . ".name"); + @unlink($ptmp . ".hash"); + LOGLevel("Problem $number (inputfile=$inputfilename) deleted (user=". $_SESSION["usertable"]["username"]."/".$_SESSION["usertable"]["usersitenumber"] . ")",2); return true; @@ -438,7 +460,7 @@ function DBGetProblems($contest,$showanyway=false) { $ds = DIRECTORY_SEPARATOR; if($ds=="") $ds = "/"; $nn = $a[$i]['number']; - $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contestnumber ."-problem" . $nn; + $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "contest" . $contest ."-problem" . $nn; if(is_readable($ptmp . ".name")) { $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); if($a[$i]['descfilename'] != '') diff --git a/boca-1.5.0/src/freport.php b/boca-1.5.0/src/freport.php index e25bd16..6182d42 100644 --- a/boca-1.5.0/src/freport.php +++ b/boca-1.5.0/src/freport.php @@ -69,32 +69,53 @@ function DBRunReport($contest,$site) { $a = DBRow($r,$i); $xdados[$i] = $a; // # of runs by team - $xuser[$a['user']]++; + if(isset($xuser[$a['user']])) + $xuser[$a['user']]++; + else $xuser[$a['user']]=1; // # of runs by problem - $xproblem[$a['problem']]++; + if(isset($xproblem[$a['problem']])) + $xproblem[$a['problem']]++; + else $xproblem[$a['problem']]=1; if($a['yes'] == 't') { + if(isset($xuseryes[$a['user']])) $xuseryes[$a['user']]++; + else $xuseryes[$a['user']]=1; $xproblemyes[$a['problem']]++; } // # of runs by language - $xlanguage[$a['language']]++; - if($a['yes'] == 't') - $xlanguageyes[$a['language']]++; + if(isset($xlanguage[$a['language']])) + $xlanguage[$a['language']]++; + else $xlanguage[$a['language']]=1; + if($a['yes'] == 't') { + if(isset($xlanguageyes[$a['language']])) + $xlanguageyes[$a['language']]++; + else $xlanguageyes[$a['language']]=1; + } // # of runs by answer - $xanswer[$a['answer']]++; + if(isset( $xanswer[$a['answer']])) + $xanswer[$a['answer']]++; + else $xanswer[$a['answer']]=1; // time of the runs array_push($xtimestamp, $a['timestamp']); if($a['yes'] == 't') array_push($xtimestampyes, $a['timestamp']); // # of runs by answer by problem - $xpa[$a['problem']][$a['answer']]++; + if(isset($xpa[$a['problem']][$a['answer']])) + $xpa[$a['problem']][$a['answer']]++; + else $xpa[$a['problem']][$a['answer']]=1; // # of runs by language by problem - $xpl[$a['problem']][$a['language']]++; + if(isset($xpl[$a['problem']][$a['language']])) + $xpl[$a['problem']][$a['language']]++; + else $xpl[$a['problem']][$a['language']]=1; // # of runs by answer by language - $xla[$a['language']][$a['answer']]++; + if(isset($xla[$a['language']][$a['answer']])) + $xla[$a['language']][$a['answer']]++; + else $xla[$a['language']][$a['answer']]=1; // # of runs by problem by user // negative sign means team got an yes for the problem + if(!isset($xup[$a['user']][$a['problem']])) + $xup[$a['user']][$a['problem']]=0; if($xup[$a['user']][$a['problem']] < 0) $xup[$a['user']][$a['problem']]--; else { diff --git a/boca-1.5.0/src/frun.php b/boca-1.5.0/src/frun.php index 3ea398a..97abd1d 100644 --- a/boca-1.5.0/src/frun.php +++ b/boca-1.5.0/src/frun.php @@ -727,12 +727,12 @@ function DBNewRun($param,$c=null) { $b = DBSiteInfo($contest, $site, $c); $dif = $b["currenttime"]; $rundatediff = $dif; - if ($dif < 0) { + if ($dif < 0) { if(!isset($param['allowneg'])) { DBExec($c, "rollback work", "DBNewRun(rollback-started)"); LOGError("Tried to submit a run but the contest is not started. SQL=(" . $sql . ")"); MSGError("The contest is not started yet!"); return false; - } + } } if (!$b["siterunning"]) { DBExec($c, "rollback work", "DBNewRun(rollback-over)"); LOGError("Tried to submit a run but the contest is over. SQL=(" . $sql . ")"); diff --git a/boca-1.5.0/src/ftask.php b/boca-1.5.0/src/ftask.php index 8265cc4..86417b2 100644 --- a/boca-1.5.0/src/ftask.php +++ b/boca-1.5.0/src/ftask.php @@ -419,13 +419,14 @@ function DBNewTask($param, $c=null) { "VALUES ($contest, $site, $tasknumber, $user, $taskdate, $taskdatediff, $taskdatediffans, '$filename', $oid, '$status', " . "'$desc', '$sys', '$color', '$colorname', $updatetime)", "DBNewTask(insert task)"); + if($sys=="t") $u="System"; + else $u = "User $user"; + if($cw) { DBExec($c, "commit work", "DBNewTask(commit-insert)"); LOGLevel("$u submitted a task (#$tasknumber) on site #$site " . "(filename=$filename, contest=$contest).",2); } - if($sys=="t") $u="System"; - else $u = "User $user"; $ret=2; } else { if($updatetime > $t) { diff --git a/boca-1.5.0/src/hex.php b/boca-1.5.0/src/hex.php index ec80230..0d80b1d 100644 --- a/boca-1.5.0/src/hex.php +++ b/boca-1.5.0/src/hex.php @@ -104,40 +104,39 @@ function bighexsoma ($hex1, $hex2){ return $resultado; } //hex1 e hex2 sao strings hexa -//devolve a string que representa hex2 - hex1 +//devolve a string que representa hex1 - hex2 function bighexsub ($hex1, $hex2) { - if (strlen($hex1) == strlen($hex2)) { - $i=0; - while ($hex1[$i] == $hex2[$i] && $i<strlen($hex1)) $i++; - - if ($i>=strlen($hex1)) return 0; - if ($hex1[$i] > $hex2[$i]) { - $sinal=''; - $a = $hex2; - $hex2 = $hex1; - $hex1 = $a; - } else $sinal = '-'; + $h1 = strlen($hex1); + $h2 = strlen($hex2); + while ($h1 < $h2) { + $hex1 = '0' . $hex1; + $h1++; + } + while ($h2 < $h1) { + $hex2 = '0' . $hex2; + $h2++; } - else { - if (strlen($hex1) < strlen($hex2)) $sinal='-'; - else { - $sinal=''; - $a = $hex2; - $hex2 = $hex1; - $hex1 = $a; - } - while (strlen($hex1) < strlen($hex2)) - $hex1 = '0' . $hex1; + + $i=0; + while ($hex1[$i] == $hex2[$i] && $i<$h1) $i++; + if ($i>=$h1) return '0'; + + if ($hex1[$i] > $hex2[$i]) { + $sinal=''; + } else { + $sinal = '-'; + $a = $hex2; + $hex2 = $hex1; + $hex1 = $a; } $sobra = 0; $resultado = ''; - for($x = strlen($hex1)-1; $x>=0; $x--){ - + for($x = $h1-1; $x>=0; $x--) { $op1 = (int) hexdec(substr($hex1,$x,1)); $op2 = (int) hexdec(substr($hex2,$x,1)); - $r = $op2 - $op1 - $sobra; + $r = $op1 - $op2 - $sobra; if ($r < 0) { $r += 16; $sobra = 1; diff --git a/boca-1.5.0/src/judge/team.php b/boca-1.5.0/src/judge/team.php index f00adac..7c204f0 100644 --- a/boca-1.5.0/src/judge/team.php +++ b/boca-1.5.0/src/judge/team.php @@ -55,6 +55,7 @@ if (isset($_FILES["sourcefile"]) && isset($_POST["problem"]) && isset($_POST["Su 'lang'=>$lang, 'filename'=>$name, 'filepath'=>$temp); + if($runteam=='team.php') $param['allowneg']=1; DBNewRun ($param); $_SESSION['forceredo']=true; } diff --git a/boca-1.5.0/src/optionlower.php b/boca-1.5.0/src/optionlower.php index 9c997e3..3bca5f9 100644 --- a/boca-1.5.0/src/optionlower.php +++ b/boca-1.5.0/src/optionlower.php @@ -35,13 +35,13 @@ if (isset($_GET["username"]) && isset($_GET["userfullname"]) && isset($_GET["use $passwordo = myhtmlspecialchars($_GET["passwordo"]); $passwordn = myhtmlspecialchars($_GET["passwordn"]); DBUserUpdate($_SESSION["usertable"]["contestnumber"], - $_SESSION["usertable"]["usersitenumber"], - $_SESSION["usertable"]["usernumber"], - $username, - $userfullname, - $userdesc, - $passwordo, - $passwordn); + $_SESSION["usertable"]["usersitenumber"], + $_SESSION["usertable"]["usernumber"], + $username, + $userfullname, + $userdesc, + $passwordo, + $passwordn); ForceLoad("option.php"); } @@ -64,9 +64,9 @@ function computeHASH() passMDo = js_myhash(js_myhash(document.form1.passwordo.value)+'<?php echo session_id(); ?>'); passMDn = bighexsoma(js_myhash(document.form1.passwordn2.value),js_myhash(document.form1.passwordo.value)); - document.form1.passwordo.value = ''; - document.form1.passwordn1.value = ''; - document.form1.passwordn2.value = ''; + document.form1.passwordo.value = ' '; + document.form1.passwordn1.value = ' '; + document.form1.passwordn2.value = ' '; document.location='option.php?username='+username+'&userdesc='+userdesc+'&userfullname='+userfull+'&passwordo='+passMDo+'&passwordn='+passMDn; } </script> diff --git a/boca-1.5.0/src/private/autojudging.php b/boca-1.5.0/src/private/autojudging.php index d5c49df..79c7079 100755 --- a/boca-1.5.0/src/private/autojudging.php +++ b/boca-1.5.0/src/private/autojudging.php @@ -82,12 +82,8 @@ $cf = globalconf(); $ip = $cf["ip"]; $activecontest=DBGetActiveContest(); $prevsleep=0; -$dodebug=1; +//$dodebug=1; while(42) { -if(!isset($dodebug)) { - if(isset($dir)) cleardir($dir); - if(isset($name)) unlink($name); -} if(($run = DBGetRunToAutojudging($activecontest["contestnumber"], $ip)) === false) { if($prevsleep==0) @@ -99,6 +95,10 @@ if(($run = DBGetRunToAutojudging($activecontest["contestnumber"], $ip)) === fals $prevsleep=1; continue; } +if(!isset($dodebug)) { + if(isset($dir)) cleardir($dir); + if(isset($name)) unlink($name); +} echo "\n"; flush(); $prevsleep=0; @@ -162,6 +162,7 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) { echo "Getting problem package file from local cache: " . $cache . $ds . $run["inputoid"] . "." . $run["inputname"] . "\n"; $s = file_get_contents($cache . $ds . $run["inputoid"] . "." . $run["inputname"]); file_put_contents($dir . $ds . $run["inputname"], decryptData($s,$key)); + $basename=$basenames[$run['inputoid']. "." . $run["inputname"]]; } else { echo "Downloading problem package file from db into: " . $dir . $ds . $run["inputname"] . "\n"; if(DB_lo_export($contest,$c, $run["inputoid"], $dir . $ds . $run["inputname"]) === false) { @@ -200,6 +201,7 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) { cleardir($dir . $ds . "problemdata"); continue; } + $basenames[$run['inputoid']. "." . $run["inputname"]]=$basename; if(!is_dir($dir . $ds . "problemdata" . $ds . "limits")) { echo "Problem content missing (limits) -- please check the problem package\n"; DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid"); @@ -247,7 +249,8 @@ if(is_readable($cache . $ds . $run["inputoid"] . "." . $run["inputname"])) { if(!isset($limits[$basename][$run["extension"]][0]) || !is_numeric($limits[$basename][$run["extension"]][0]) || !isset($limits[$basename][$run["extension"]][1]) || !is_numeric($limits[$basename][$run["extension"]][1]) || - !isset($limits[$basename][$run["extension"]][2]) || !is_numeric($limits[$basename][$run["extension"]][2]) ) { + !isset($limits[$basename][$run["extension"]][2]) || !is_numeric($limits[$basename][$run["extension"]][2]) || + !isset($limits[$basename][$run["extension"]][3]) || !is_numeric($limits[$basename][$run["extension"]][3]) ) { echo "Failed to find proper limits information for the problem -- please check the problem package\n"; DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid"); continue; @@ -311,7 +314,8 @@ if($retval != 0) { //# $2 input_file //# $3 timelimit (limit to run all the repetitions, by default only one repetition) //# $4 number_of_repetitions_to_run (optional, can be used for better tuning the timelimit) -//# $5 maximum allowed memory (in KBytes) +//# $5 maximum allowed memory (in MBytes) +//# $6 maximum allowed output size (in KBytes) $zip = new ZipArchive; $inputlist = array(); @@ -324,7 +328,7 @@ if($retval != 0) { $pos = strrpos(dirname($filename),"input"); if($pos !== false && $pos==strlen(dirname($filename))-5) { $inputlist[$ninputlist++] = 'input' . $ds . basename($filename); - $outputlist[$noutputlist++] = 'output' . $ds . basename($filename); + $outputlist[$noutputlist++] = 'output' . $ds . basename($filename,'.link'); } } $zip->extractTo($dir, array_merge(array("run" . $ds . $run["extension"]),$inputlist)); @@ -348,15 +352,32 @@ if($retval != 0) { DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid"); continue; } else { + $errp=0; foreach($inputlist as $file) { $file = basename($file); if(is_file($dir . $ds . "input" . $ds . $file)) { + $file1=basename($file,'.link'); + if($file != $file1) { + $fnam = trim(file_get_contents($dir . $ds . "input" . $ds . $file)); + echo "Input file $file is a link. Trying to read the linked file: ($fnam)\n"; + if(is_readable($fnam)) { + @unlink($dir . $ds . "input" . $ds . $file); + $file = basename($file,".link"); + @copy($fnam,$dir . $ds . "input" . $ds . $file); + } else { + echo "Failed to read input files from link indicated in the ZIP -- please check the problem package\n"; + DBGiveUpRunAutojudging($contest, $site, $number, $ip, "Autojuging error: problem package file is invalid or missing files on the autojudge"); + $errp=1; break; + } + } + $ex = escapeshellcmd($script) ." ". escapeshellarg($basename) . " ". escapeshellarg($dir . $ds . "input" . $ds . $file)." ". escapeshellarg(trim($limits[$basename][$run["extension"]][0]))." ". escapeshellarg(trim($limits[$basename][$run["extension"]][1]))." ". - escapeshellarg(trim($limits[$basename][$run["extension"]][2])); + escapeshellarg(trim($limits[$basename][$run["extension"]][2]))." ". + escapeshellarg(trim($limits[$basename][$run["extension"]][3])); $ex .= " >stdout 2>stderr"; echo "Executing " . $ex . " at " . getcwd() . " for input " . $file . "\n"; if(system($ex, $retval)===false) $retval=-1; @@ -380,6 +401,7 @@ if($retval != 0) { echo "==> ERROR reading input file " . $dir . $ds . "input" . $ds . $file . " - skipping it!\n"; } } + if($errp==1) continue; } if($retval==0) { echo "Processing results\n"; @@ -458,8 +480,8 @@ if($retval > 9) { } echo "Sending results to server...\n"; -echo "out==> "; system("tail -n1 ". $dir.$ds.'allout'); -echo "err==> "; system("tail -n1 ". $dir.$ds.'allerr'); +//echo "out==> "; system("tail -n1 ". $dir.$ds.'allout'); +//echo "err==> "; system("tail -n1 ". $dir.$ds.'allerr'); DBUpdateRunAutojudging($contest, $site, $number, $ip, $answer, $dir.$ds.'allout', $dir.$ds.'allerr', $retval); LogLevel("Autojudging: answered '$answer' (run=$number, site=$site, contest=$contest)",3); echo "Autojudging answered '$answer' (contest=$contest, site=$site, run=$number)\n"; diff --git a/boca-1.5.0/src/private/createproblemzip.php b/boca-1.5.0/src/private/createproblemzip.php index bbcacf9..a78c30f 100755 --- a/boca-1.5.0/src/private/createproblemzip.php +++ b/boca-1.5.0/src/private/createproblemzip.php @@ -24,6 +24,11 @@ if(is_readable('/etc/boca.conf')) { $pif=parse_ini_file('/etc/boca.conf'); $bocadir = trim($pif['bocadir']) . $ds . 'src'; } else { + if(is_readable('boca.conf')) { + $pif=parse_ini_file('boca.conf'); + $bocadir = trim($pif['bocadir']) . $ds . 'src'; + } + else $bocadir = getcwd(); } @@ -44,11 +49,12 @@ ini_set('memory_limit','600M'); ini_set('output_buffering','off'); ini_set('implicit_flush','on'); @ob_end_flush(); - +/* if(system('test "`id -u`" -eq "0"',$retval)===false || $retval!=0) { echo "Must be run as root\n"; exit; } +*/ if(count($argv) < 3 || !is_readable($argv[1])) { echo "Usage: createproblemzip.php <problem_directory> <problem_zipfile> [<password>]\n"; exit; @@ -85,8 +91,13 @@ if(is_dir(trim($argv[1]))) { else echo "ZIP Error $ret\n"; $encdata=encryptData(file_get_contents(trim($argv[2])),'#####'.$password1,false); -} else + if($encdata=='') + $encdata=file_get_contents(trim($argv[2])); +} else { $encdata=encryptData(file_get_contents(trim($argv[1])),'#####'.$password1,true); + if($encdata=='') + $encdata=file_get_contents(trim($argv[1])); +} file_put_contents(trim($argv[2]),$encdata); echo "Output file generated in " . $argv[2] . "\n"; diff --git a/boca-1.5.0/src/scoretable.php b/boca-1.5.0/src/scoretable.php index 05b9280..0233e99 100644 --- a/boca-1.5.0/src/scoretable.php +++ b/boca-1.5.0/src/scoretable.php @@ -223,6 +223,14 @@ if($redo) { $score[$e]['classingroup'][$rfi]=$class; $class++; } + else if(strpos($grname[$k],'/') >= 1) { + $u1 = explode('/',$grname[$k]); + if(isset($u1[1]) && $score[$e]['user'] >= $u1[0] && $score[$e]['user'] <= $u1[1]) { + $score[$e]['classingroup'][$rfi]=$class; + $class++; + } + } + } } if($class>1) diff --git a/boca-1.5.0/src/staff/task.php b/boca-1.5.0/src/staff/task.php index 283b9bb..640eae1 100644 --- a/boca-1.5.0/src/staff/task.php +++ b/boca-1.5.0/src/staff/task.php @@ -86,7 +86,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"]." ". + $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>"; diff --git a/boca-1.5.0/src/team/header.php b/boca-1.5.0/src/team/header.php index 2690766..ec7352a 100644 --- a/boca-1.5.0/src/team/header.php +++ b/boca-1.5.0/src/team/header.php @@ -96,7 +96,7 @@ if(!isset($_SESSION["popuptime"]) || $_SESSION["popuptime"] < time()-120) { if ($clar[$i]["anstime"]>$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && $clar[$i]["anstime"] < $st['siteduration'] && trim($clar[$i]["answer"])!='' && !isset($_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["anstime"]])) { - $_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["anstime"]] = "Clarification for problem ".$clar[$i]["problem"]." answered\n"; + $_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["anstime"]] = "(Clar for problem ".$clar[$i]["problem"]." answered)\n"; } } $run = DBUserRuns($_SESSION["usertable"]["contestnumber"], @@ -106,7 +106,7 @@ if(!isset($_SESSION["popuptime"]) || $_SESSION["popuptime"] < time()-120) { if ($run[$i]["anstime"]>$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && $run[$i]["anstime"] < $st['sitelastmileanswer'] && $run[$i]["ansfake"]!="t" && !isset($_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]])) { - $_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]] = "Run ".$run[$i]["number"]." result: ".$run[$i]["answer"] . '\n'; + $_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]] = "(Run ".$run[$i]["number"]." result: ".$run[$i]["answer"] . ')\n'; } } } diff --git a/boca-1.5.0/src/webcast.zip b/boca-1.5.0/src/webcast.zip Binary files differdeleted file mode 100644 index 577ba23..0000000 --- a/boca-1.5.0/src/webcast.zip +++ /dev/null diff --git a/boca-1.5.0/src/webcast/contest/index.php b/boca-1.5.0/src/webcast/contest/index.php index 8d68f34..3efc719 100644 --- a/boca-1.5.0/src/webcast/contest/index.php +++ b/boca-1.5.0/src/webcast/contest/index.php @@ -40,10 +40,14 @@ echo for ($i = 0; $i < $numTeams; $i++) { $a = DBRow($r, $i); $teamID = $a['username']; - $pieces = explode('</b>', $a['userfullname']); - $teamName = trim($pieces[1]); - $pieces = explode('<b>', $pieces[0]); - $teamUni = trim($pieces[1]); + if(isset($a['usershortname'])) + $teamName = $a['usershortname']; + else + $teamName = $a['userfullname']; + if(isset($a['usershortinstitution'])) + $teamUni = $a['usershortinstitution']; + else + $teamUni = $teamName; echo $teamID . '' . @@ -51,4 +55,7 @@ for ($i = 0; $i < $numTeams; $i++) { $teamName . "\n"; } +echo '1' . '' . '1' . "\n"; +echo $numProblems . '' . 'Y' . "\n"; + ?> |