aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fcontest.php2
-rw-r--r--src/frun.php15
-rw-r--r--src/judge/clar.php2
-rw-r--r--src/judge/team.php2
-rw-r--r--src/scoretable.php7
-rw-r--r--src/team/header.php2
-rw-r--r--src/team/run.php2
7 files changed, 18 insertions, 14 deletions
diff --git a/src/fcontest.php b/src/fcontest.php
index e61631b..9989931 100644
--- a/src/fcontest.php
+++ b/src/fcontest.php
@@ -125,7 +125,7 @@ CREATE TABLE \"sitetimetable\" (
$r = DBexec($c, "CREATE INDEX \"sitetimesite_index\" ON \"sitetimetable\" USING btree ".
"(\"contestnumber\" int4_ops, \"sitenumber\" int4_ops)", "DBCreateSiteTimeTable(create site_index)");
}
-// begin; update answertable set updatetime=EXTRACT(EPOCH FROM now());
+// begin; update answertable set updatetime=EXTRACT(EPOCH FROM now()); select * from answertable;
// begin; update langtable set updatetime=EXTRACT(EPOCH FROM now()); select * from langtable;
// begin; update problemtable set updatetime=EXTRACT(EPOCH FROM now()); select * from problemtable;
diff --git a/src/frun.php b/src/frun.php
index 473c4a5..bc9dc2f 100644
--- a/src/frun.php
+++ b/src/frun.php
@@ -359,13 +359,14 @@ function DBGetRunToAnswerC($number,$site,$contest,$chief) {
"r.runnumber=$number";
if ($chief != 1) {
$sql .= " and (r.runstatus='openrun' or " .
- "(r.runstatus='judged+' and r.runjudge is NULL) or " .
- "((r.runstatus='judging' or r.runstatus='judged+') and " .
- " (r.runjudge1 is null or r.runjudge2 is null or " .
- " ((r.runjudge1=" . $_SESSION["usertable"]["usernumber"] . " and " .
- " r.runjudgesite1=" . $_SESSION["usertable"]["usersitenumber"] . ") or " .
- " (r.runjudge2=" . $_SESSION["usertable"]["usernumber"] . " and " .
- " r.runjudgesite2=" . $_SESSION["usertable"]["usersitenumber"] . ")))))";
+ "(r.runstatus='judged+' and r.runjudge is NULL) or " .
+ "((r.runstatus='judging' or r.runstatus='judged+') and " .
+ " (r.runjudge1 is null or " .
+ " (r.runjudge2 is null)" . // " and (" . $_SESSION["usertable"]["usernumber"] . ">=120000 or r.runjudge1>=120000))" .
+ " or ((r.runjudge1=" . $_SESSION["usertable"]["usernumber"] . " and " .
+ " r.runjudgesite1=" . $_SESSION["usertable"]["usersitenumber"] . ") or " .
+ " (r.runjudge2=" . $_SESSION["usertable"]["usernumber"] . " and " .
+ " r.runjudgesite2=" . $_SESSION["usertable"]["usersitenumber"] . ")))))";
$tx = "Judge";
} else $tx = "Chief";
$r = DBExec ($c, $sql . " for update", "DBGetRunToAnswerC(get run/prob/lang for update)");
diff --git a/src/judge/clar.php b/src/judge/clar.php
index a5d56ce..ee120ab 100644
--- a/src/judge/clar.php
+++ b/src/judge/clar.php
@@ -49,7 +49,7 @@ $clar = DBOpenClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudg
for ($i=0; $i<count($clar); $i++) {
echo " <tr>\n";
- if (strpos($clar[$i]["status"], "answered") === false)
+ if (strpos($clar[$i]["status"], "answered") === false) // && strpos($_SESSION["usertable"]['username'], "setter") !== false)
echo " <td nowrap><a href=\"claredit.php?clarnumber=".$clar[$i]["number"]."&clarsitenumber=".$clar[$i]["site"] .
"\">" . $clar[$i]["number"] . "</td>\n";
else
diff --git a/src/judge/team.php b/src/judge/team.php
index 745380a..13e3e4e 100644
--- a/src/judge/team.php
+++ b/src/judge/team.php
@@ -75,7 +75,7 @@ $redo = TRUE;
if(!isset($_SESSION['forceredo']) || $_SESSION['forceredo']==false) {
$actualdelay = 30;
if(file_exists($runtmp)) {
- if(isset($strtmp) || (($strtmp = file_get_contents($runtmp,FALSE,NULL,-1,1000000)) !== FALSE)) {
+ if(isset($strtmp) || (($strtmp = file_get_contents($runtmp,FALSE,NULL,0,1000000)) !== FALSE)) {
list($d) = sscanf($strtmp,"%*s %d");
if($d > time() - $actualdelay) {
$conf=globalconf();
diff --git a/src/scoretable.php b/src/scoretable.php
index 3f785f3..2010bc1 100644
--- a/src/scoretable.php
+++ b/src/scoretable.php
@@ -91,7 +91,7 @@ if($ds=="") $ds = "/";
$scoretmp = $_SESSION["locr"] . $ds . "private" . $ds . "scoretmp" . $ds . $_SESSION["usertable"]["usertype"] . '-' . $_SESSION["usertable"]["username"] . ".php";
$redo = TRUE;
if(file_exists($scoretmp)) {
- if(($strtmp = file_get_contents($scoretmp,FALSE,NULL,-1,100000)) !== FALSE) {
+ if(($strtmp = file_get_contents($scoretmp,FALSE,NULL,0,5000000)) !== FALSE) {
list($d) = sscanf($strtmp,"%*s %d");
if($d > time() - $actualdelay) {
$redo = FALSE;
@@ -398,11 +398,14 @@ if($redo) {
if(isset($conf['doenc']) && $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) {
+ $randnum = session_id() . "_" . rand();
+ if(file_put_contents($scoretmp . "_" . $randnum, $strtmp,LOCK_EX)===FALSE) {
if($_SESSION["usertable"]["usertype"] == 'admin') {
MSGError("Cannot write to the score cache file -- performance might be compromised");
}
LOGError("Cannot write to the ".$_SESSION["usertable"]["usertype"]."-score cache file -- performance might be compromised");
+ } else {
+ @rename($scoretmp . "_" . $randnum, $scoretmp);
}
$conf=globalconf();
if(isset($conf['doenc']) && $conf['doenc'])
diff --git a/src/team/header.php b/src/team/header.php
index ec7352a..c02166b 100644
--- a/src/team/header.php
+++ b/src/team/header.php
@@ -60,7 +60,7 @@ $runtmp = $_SESSION["locr"] . $ds . "private" . $ds . "runtmp" . $ds . "run-cont
"-site". $_SESSION["usertable"]["usersitenumber"] . "-user" . $_SESSION["usertable"]["usernumber"] . ".php";
$doslow=true;
if(file_exists($runtmp)) {
- if(($strtmp = file_get_contents($runtmp,FALSE,NULL,-1,1000000)) !== FALSE) {
+ if(($strtmp = file_get_contents($runtmp,FALSE,NULL,0,1000000)) !== FALSE) {
$postab=strpos($strtmp,"\t");
$conf=globalconf();
$strcolors = decryptData(substr($strtmp,$postab+1,strpos($strtmp,"\n")-$postab-1),$conf['key'],'');
diff --git a/src/team/run.php b/src/team/run.php
index 10e7c76..32c0d25 100644
--- a/src/team/run.php
+++ b/src/team/run.php
@@ -291,7 +291,7 @@ $redo = TRUE;
if(!isset($_SESSION['forceredo']) || $_SESSION['forceredo']==false) {
$actualdelay = 15;
if(file_exists($runtmp)) {
- if(isset($strtmp) || (($strtmp = file_get_contents($runtmp,FALSE,NULL,-1,1000000)) !== FALSE)) {
+ if(isset($strtmp) || (($strtmp = file_get_contents($runtmp,FALSE,NULL,0,1000000)) !== FALSE)) {
list($d) = sscanf($strtmp,"%*s %d");
if($d > time() - $actualdelay) {
$conf=globalconf();