aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.1/src
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-10-20 12:24:23 +0000
committercassiopc <cassiopc@gmail.com>2012-10-20 12:24:23 +0000
commit9e75d473525446d0961a7567bcb8a1e672949df8 (patch)
treea054cab8f262a6e9230bc572ecae25513572c99b /boca-1.5.1/src
parente457938928ba589b16f12a2e6d38922dd94b2a51 (diff)
downloadboca-9e75d473525446d0961a7567bcb8a1e672949df8.tar.gz
boca-9e75d473525446d0961a7567bcb8a1e672949df8.zip
fixed team login issue, included empty default options in submission tab, included extra-packages and links in ICPC Linux
Diffstat (limited to 'boca-1.5.1/src')
-rw-r--r--boca-1.5.1/src/fcontest.php2
-rw-r--r--boca-1.5.1/src/flog.php5
-rw-r--r--boca-1.5.1/src/scoretable.php55
-rw-r--r--boca-1.5.1/src/team/run.php8
4 files changed, 41 insertions, 29 deletions
diff --git a/boca-1.5.1/src/fcontest.php b/boca-1.5.1/src/fcontest.php
index 23ce241..a698fd3 100644
--- a/boca-1.5.1/src/fcontest.php
+++ b/boca-1.5.1/src/fcontest.php
@@ -1205,7 +1205,7 @@ function DBNewUser($param, $c=null) {
MSGError("Site $site does not exist");
return false;
}
- if($type=='team') $pass='!'.$pass;
+ if($type=='team' && $pass != myhash("")) $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.1/src/flog.php b/boca-1.5.1/src/flog.php
index 56fdfed..e52e167 100644
--- a/boca-1.5.1/src/flog.php
+++ b/boca-1.5.1/src/flog.php
@@ -123,7 +123,7 @@ function DBLogInContest($name,$pass,$contest,$msg=true) {
}
$a = DBGetRow("select * from usertable where username='$name' and contestnumber=".
$b["contestnumber"]." and " .
- "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)");
+ "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)");
if ($a == null) {
if($msg) {
LOGLevel("User $name tried to log in contest $contest but it does not exist.",2);
@@ -131,12 +131,13 @@ function DBLogInContest($name,$pass,$contest,$msg=true) {
}
return false;
}
+ $a = DBUserInfo($b["contestnumber"], $b["contestlocalsite"],$a['usernumber'],null,false);
$_SESSION['usertable'] = $a;
$p = myhash($a["userpassword"] . session_id());
$_SESSION['usertable']['userpassword'] = $p;
if ($a["userpassword"] != "" && $p != $pass) {
LOGLevel("User $name tried to log in contest $contest but password was incorrect.",2);
- if($msg) MSGError("User does not exist or incorrect password.");
+ if($msg) MSGError("Incorrect password.");
unset($_SESSION["usertable"]);
return false;
}
diff --git a/boca-1.5.1/src/scoretable.php b/boca-1.5.1/src/scoretable.php
index 0233e99..574b700 100644
--- a/boca-1.5.1/src/scoretable.php
+++ b/boca-1.5.1/src/scoretable.php
@@ -74,7 +74,7 @@ if(!ValidSession()) {
$loc = $_SESSION["loc"];
if(!isset($detail)) $detail=true;
if(!isset($final)) $final=false;
-$scoredelay["admin"] = 1;
+$scoredelay["admin"] = 2;
$scoredelay["score"] = 30;
$scoredelay["team"] = 30;
$scoredelay["judge"] = 10;
@@ -95,33 +95,38 @@ if(file_exists($scoretmp)) {
}
}
+if($_SESSION["usertable"]["usertype"]=='score' || (isset($_GET["remote"]) && is_numeric($_GET["remote"]))) {
+ $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores";
+ $destination = $remotedir . $ds ."scores.zip";
+ if(is_writable($remotedir)) {
+ if($redo || !is_readable($destination)) {
+ if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
+ ForceLoad("index.php");
+
+ $level=$s["sitescorelevel"];
+ $data0 = array();
+ if($level>0) {
+ list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"], 1, -1);
+ }
+ $ct=DBGetActiveContest();
+ $localsite=$ct['contestlocalsite'];
+ $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']);
+ @file_put_contents($fname . ".tmp",base64_encode(serialize($data0)));
+ @rename($fname . ".tmp",$fname . ".dat");
+
+ if(@create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) {
+ LOGError("Cannot create score zip file");
+ } else {
+ @create_zip($remotedir,array(),$destination);
+ }
+ }
+ }
+}
+
if(isset($_GET["remote"])) {
if(is_numeric($_GET["remote"])) {
if($_GET["remote"]==-42) {
- $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores";
- $destination = $remotedir . $ds ."scores.zip";
- if($redo || !is_readable($destination)) {
- if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
- ForceLoad("index.php");
-
- $level=$s["sitescorelevel"];
- $data0 = array();
- if($level>0) {
- list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"],
- $_SESSION["usertable"]["usersitenumber"], 1, -1);
- }
- $ct=DBGetActiveContest();
- $localsite=$ct['contestlocalsite'];
- $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']);
- file_put_contents($fname . ".tmp",base64_encode(serialize($data0)));
- rename($fname . ".tmp",$fname . ".dat");
-
- if(create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) {
- LOGError("Cannot create score zip file");
- } else {
- create_zip($remotedir,array(),$destination);
- }
- }
echo file_get_contents($destination);
} else {
if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
diff --git a/boca-1.5.1/src/team/run.php b/boca-1.5.1/src/team/run.php
index 51afc75..3879674 100644
--- a/boca-1.5.1/src/team/run.php
+++ b/boca-1.5.1/src/team/run.php
@@ -132,6 +132,7 @@ $strtmp .= "<br><br><center><b>To submit a program, just fill in the following f
" <td width=\"75%\">\n".
" <select name=\"problem\" onclick=\"Arquivo()\">\n";
$prob = DBGetProblems($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usertype"]=='judge');
+$strtmp .= "<option value=\"-1\"></option>\n";
for ($i=0;$i<count($prob);$i++)
$strtmp .= "<option value=\"" . $prob[$i]["number"] . "\">" . $prob[$i]["problem"] . "</option>\n";
$strtmp .= " </select>\n".
@@ -142,6 +143,7 @@ $strtmp .= " </select>\n".
" <td width=\"75%\"> \n".
" <select name=\"language\" onclick=\"Arquivo()\">\n";
$lang = DBGetLanguages($_SESSION["usertable"]["contestnumber"]);
+$strtmp .= "<option value=\"-1\"></option>\n";
for ($i=0;$i<count($lang);$i++)
$strtmp .= "<option value=\"" . $lang[$i]["number"] . "\">" . $lang[$i]["name"] . "</option>\n";
$strtmp .= " </select>\n".
@@ -157,8 +159,12 @@ $strtmp .= " </select>\n".
" </center>\n".
" <script language=\"javascript\">\n".
" function conf() {\n".
-" if (confirm(\"Confirm submission?\")) {\n".
+" if (document.form1.problem.value != '-1' && document.form1.language.value != '-1') {\n".
+" if (confirm(\"Confirm submission?\")) {\n".
" document.form1.confirmation.value='confirm';\n".
+" }\n".
+" } else {\n".
+" alert('Invalid problem and/or language');\n".
" }\n".
" }\n".
" </script>\n".