From f8c7c32e3ea6417ccf04309ec521b39a0c20414d Mon Sep 17 00:00:00 2001 From: cassiopc Date: Mon, 6 Aug 2012 19:59:23 +0200 Subject: fix some concurrency issues when judging a run; update scripts to look for /etc/boca.conf if it exists --- boca-1.5.0/src/team/clar.php | 6 +----- boca-1.5.0/src/team/header.php | 43 ++++++++++++++++++++++++++++++++++-------- boca-1.5.0/src/team/run.php | 6 +----- 3 files changed, 37 insertions(+), 18 deletions(-) (limited to 'boca-1.5.0/src/team') diff --git a/boca-1.5.0/src/team/clar.php b/boca-1.5.0/src/team/clar.php index 7b391b9..a1e3972 100644 --- a/boca-1.5.0/src/team/clar.php +++ b/boca-1.5.0/src/team/clar.php @@ -29,6 +29,7 @@ if (isset($_POST["message"]) && isset($_POST["problem"]) && isset($_POST["Submit } ForceLoad("clar.php"); } +$_SESSION["popuptime"] = time(); ?>
@@ -58,11 +59,6 @@ for ($i=0; $i".$clar[$i]["question"]."\n"; echo "\n"; - if ($clar[$i]["timestamp"]>$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && $clar[$i]["timestamp"] < $st['siteduration'] && - trim($clar[$i]["answer"])!='' && !isset($_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["timestamp"]])) { - $_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["timestamp"]] = "Clarification for problem ".$clar[$i]["problem"]." answered
"; - } - if (trim($clar[$i]["answer"]) == "") $clar[$i]["answer"] = "Not answered yet"; echo "
\n"; $strtmp .= " \n"; - - if ($run[$i]["anstime"]>$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && $run[$i]["anstime"] < $st['sitelastmileanswer'] && - $run[$i]["ansfake"]!="t" && !isset($_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]])) { - $_SESSION["popups"]['run' . $i . '-' . $run[$i]["anstime"]] = "Run ".$run[$i]["number"]." result: ".$run[$i]["answer"]. "
"; - } } $strtmp .= "
"; // echo "
" . $clar[$i]["answer"] . "
"; diff --git a/boca-1.5.0/src/team/header.php b/boca-1.5.0/src/team/header.php index 862f284..23c6d98 100644 --- a/boca-1.5.0/src/team/header.php +++ b/boca-1.5.0/src/team/header.php @@ -85,15 +85,42 @@ if($doslow) { } } -$str = ''; -foreach($_SESSION["popups"] as $key => $value) { - if($value != null) { - $str .= $value; - $_SESSION["popups"][$key] = null; +if(!isset($_SESSION["popuptime"]) || $_SESSION["popuptime"] < time()-120) { + $_SESSION["popuptime"] = time(); + + if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) != null) { + $clar = DBUserClars($_SESSION["usertable"]["contestnumber"], + $_SESSION["usertable"]["usersitenumber"], + $_SESSION["usertable"]["usernumber"]); + for ($i=0; $i$_SESSION["usertable"]["userlastlogin"]-$st["sitestartdate"] && + $clar[$i]["timestamp"] < $st['siteduration'] && + trim($clar[$i]["answer"])!='' && !isset($_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["timestamp"]])) { + $_SESSION["popups"]['clar' . $i . '-' . $clar[$i]["timestamp"]] = "Clarification for problem ".$clar[$i]["problem"]." answered\n"; + } + } + $run = DBUserRuns($_SESSION["usertable"]["contestnumber"], + $_SESSION["usertable"]["usersitenumber"], + $_SESSION["usertable"]["usernumber"]); + for ($i=0; $i$_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'; + } + } + } + + $str = ''; + foreach($_SESSION["popups"] as $key => $value) { + if($value != '') { + $str .= $value; + $_SESSION["popups"][$key] = ''; + } + } + if($str != '') { + MSGError('YOU GOT NEWS:\n' . $str . '\n'); } -} -if($str != '') { - MSGError('YOU GOT NEWS:
' . $str); } list($clockstr,$clocktype)=siteclock(); diff --git a/boca-1.5.0/src/team/run.php b/boca-1.5.0/src/team/run.php index f00adac..51afc75 100644 --- a/boca-1.5.0/src/team/run.php +++ b/boca-1.5.0/src/team/run.php @@ -82,6 +82,7 @@ if(!isset($_SESSION['forceredo']) || $_SESSION['forceredo']==false) { } } if($redo) { + $_SESSION["popuptime"] = time(); $_SESSION['forceredo']=false; if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) ForceLoad("../index.php"); @@ -117,11 +118,6 @@ if($redo) { $strtmp .= "
"; if (count($run) == 0) $strtmp .= "
NO RUNS AVAILABLE
"; -- cgit v1.2.3