aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/src/team/header.php
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-08-06 17:59:23 +0000
committercassiopc <cassiopc@gmail.com>2012-08-06 17:59:23 +0000
commitf8c7c32e3ea6417ccf04309ec521b39a0c20414d (patch)
tree86befe96e554f00d25e1f3717d456ef6da470405 /boca-1.5.0/src/team/header.php
parentd75956684f9599b8daf705b11d67c75186ea7e3f (diff)
downloadboca-f8c7c32e3ea6417ccf04309ec521b39a0c20414d.tar.gz
boca-f8c7c32e3ea6417ccf04309ec521b39a0c20414d.zip
fix some concurrency issues when judging a run; update scripts to look for /etc/boca.conf if it exists
Diffstat (limited to 'boca-1.5.0/src/team/header.php')
-rw-r--r--boca-1.5.0/src/team/header.php43
1 files changed, 35 insertions, 8 deletions
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<count($clar); $i++) {
+ 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\n";
+ }
+ }
+ $run = DBUserRuns($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"]);
+ for ($i=0; $i<count($run); $i++) {
+ 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';
+ }
+ }
+ }
+
+ $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:<br>' . $str);
}
list($clockstr,$clocktype)=siteclock();