diff options
| author | cassiopc <cassiopc@gmail.com> | 2012-08-06 15:27:18 +0000 |
|---|---|---|
| committer | cassiopc <cassiopc@gmail.com> | 2012-08-06 15:27:18 +0000 |
| commit | d75956684f9599b8daf705b11d67c75186ea7e3f (patch) | |
| tree | b22f943e9ab3c6849898e3cf5e9659a7ed24b359 /boca-1.5.0/src | |
| parent | 2c2663e03f56149ad4c909858b93fb3c1ea9f271 (diff) | |
| download | boca-d75956684f9599b8daf705b11d67c75186ea7e3f.tar.gz boca-d75956684f9599b8daf705b11d67c75186ea7e3f.zip | |
moving problem examples to better places and fixing a couple of typos in the problem's interface
Diffstat (limited to 'boca-1.5.0/src')
| -rw-r--r-- | boca-1.5.0/src/admin/problem.php | 2 | ||||
| -rw-r--r-- | boca-1.5.0/src/fcontest.php | 7 | ||||
| -rw-r--r-- | boca-1.5.0/src/fproblem.php | 39 | ||||
| -rw-r--r-- | boca-1.5.0/src/team/problem.php | 2 |
4 files changed, 29 insertions, 21 deletions
diff --git a/boca-1.5.0/src/admin/problem.php b/boca-1.5.0/src/admin/problem.php index d55ff63..d52c429 100644 --- a/boca-1.5.0/src/admin/problem.php +++ b/boca-1.5.0/src/admin/problem.php @@ -98,7 +98,7 @@ for ($i=0; $i<count($prob); $i++) { echo " <td nowrap>" . $prob[$i]["name"] . "</td>\n"; echo " <td nowrap>" . $prob[$i]["fullname"] . " </td>\n"; echo " <td nowrap>" . $prob[$i]["basefilename"] . " </td>\n"; - if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null) { + if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null && isset($prob[$i]["descfilename"])) { echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["descoid"], $prob[$i]["descfilename"]) . "\">" . basename($prob[$i]["descfilename"]) . "</td>\n"; } diff --git a/boca-1.5.0/src/fcontest.php b/boca-1.5.0/src/fcontest.php index 8771291..077b4ec 100644 --- a/boca-1.5.0/src/fcontest.php +++ b/boca-1.5.0/src/fcontest.php @@ -151,6 +151,7 @@ CREATE TABLE \"usertable\" ( \"usersessionextra\" varchar(50) DEFAULT '', -- (sessao do usuario) \"userlastlogout\" int4, -- (data em seg desde epoch do ult logout) \"userpermitip\" varchar(300), -- (ip permitido para acesso) + \"userinfo\" varchar(300) DEFAULT '', \"updatetime\" int4 DEFAULT EXTRACT(EPOCH FROM now()) NOT NULL, -- (indica a ultima atualizacao no registro) -- (esta tabela contem uma linha para cada usuario, seja ele administrador, juiz ou time. ) \"usericpcid\" varchar(50) DEFAULT '', -- (compatibilidade com dados do ICPC) @@ -921,11 +922,7 @@ function DBNewContest ($param=array(), $c=null) { insertanswers($n,$c); insertlanguages($n,$c); - - DBExec($c, "insert into problemtable (contestnumber, problemnumber, problemname, problemfullname, ". - "problembasefilename, problemdescfilename, problemdescfile, probleminputfilename, probleminputfile, ". - "problemsolfilename, problemsolfile, fake) values ($n, 0, 'General', 'General', NULL, NULL, ". - "NULL, NULL, NULL, NULL, NULL, 't')", "DBNewContest(insert problem)"); + DBinsertfakeproblem($n,$c); if($cw) { DBExec($c, "commit work", "DBNewContest(commit)"); diff --git a/boca-1.5.0/src/fproblem.php b/boca-1.5.0/src/fproblem.php index dc8ed16..6a05836 100644 --- a/boca-1.5.0/src/fproblem.php +++ b/boca-1.5.0/src/fproblem.php @@ -54,6 +54,12 @@ CONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contestta "(\"contestnumber\" int4_ops, \"problemname\" varchar_ops)", "DBCreateProblemTable(create problem_index2)"); } +function DBinsertfakeproblem($n,$c) { + DBExec($c, "insert into problemtable (contestnumber, problemnumber, problemname, problemfullname, ". + "problembasefilename, probleminputfilename, probleminputfile, fake) values ($n, 0, 'General', 'General', NULL, NULL, ". + "NULL, 't')", "DBNewContest(insert problem)"); +} + //////////////////////funcoes de problemas////////////////////////////////////////////////////////////// //recebe um numero de contest e numero de problema //devolve todos os dados relativos ao problema em cada linha do array, sendo que cada linha representa o fato @@ -61,7 +67,7 @@ CONSTRAINT \"contest_fk\" FOREIGN KEY (\"contestnumber\") REFERENCES \"contestta function DBGetProblemData($contestnumber, $problemnumber) { $c = DBConnect(); $r = DBExec($c, "select p.problemname as problemname, p.problemfullname as fullname, p.problembasefilename " . - "as basefilename, p.problemtimelimit as timelimit, " . + "as basefilename, " . "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.problemnumber=$problemnumber and p.fake!='t'", @@ -80,8 +86,9 @@ function DBGetProblemData($contestnumber, $problemnumber) { if($ds=="") $ds = "/"; $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $a[$i]['number'] . "-contest" . $contestnumber; if(is_readable($ptmp . ".name")) { - $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name"); - $a[$i]['descoid']=-1; + $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); + if($a[$i]['descfilename'] != '') + $a[$i]['descoid']=-1; } } return $a; @@ -90,7 +97,7 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { $c = DBConnect(); DBExec($c, "begin work", "GetFullProblemData"); $r = DBExec($c, "select p.problemnumber as number, p.problemname as name, p.problemfullname as fullname, " . - "p.problembasefilename as basefilename, p.fake as fake, p.problemtimelimit as timelimit, " . + "p.problembasefilename as basefilename, p.fake as fake, " . "p.problemcolor as color, p.problemcolorname as colorname, " . "p.probleminputfilename as inputfilename, p.probleminputfile as inputoid, p.probleminputfilehash as inputhash " . " from problemtable as p " . @@ -110,8 +117,9 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { if($ds=="") $ds = "/"; $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $nn . "-contest" . $contestnumber; if(is_readable($ptmp . ".name")) { - $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name"); - $a[$i]['descoid']=-1; + $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); + if($a[$i]['descfilename'] != '') + $a[$i]['descoid']=-1; } else { $randnum = session_id() . "_" . rand(); $dir = $ptmp . '-' . $randnum; @@ -145,19 +153,21 @@ function DBGetFullProblemData($contestnumber,$freeproblems=false) { $fullname=trim(sanitizeText($aa[1])); } } - if($descfile=='' || $basename=='' || $fullname=='') + if($basename=='' || $fullname=='') $failed=3; } } else $failed=4; if(!$failed) { @mkdir($ptmp); - if(file_put_contents($ptmp . $ds . $descfile, encryptData(file_get_contents($dir . $ds . "description" . $ds . $descfile),$cf['key']),LOCK_EX)===FALSE) - $failed=5; + 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",$descfile); + file_put_contents($ptmp . ".name",$ptmp . $ds . $descfile); if(is_readable($ptmp . ".name")) { - $a[$i]['descfilename']=$ptmp . $ds . $descfile; - $a[$i]['descoid']=-1; + $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); + if($a[$i]['descfilename'] != '') + $a[$i]['descoid']=-1; } DBExec($c,"update problemtable set problemfullname='$fullname', problembasefilename='$basename' where problemnumber=$nn and contestnumber=$contestnumber", "DBGetFullProblemData(free problem)"); @@ -410,8 +420,9 @@ function DBGetProblems($contest,$showanyway=false) { if($ds=="") $ds = "/"; $ptmp = $_SESSION["locr"] . $ds . "private" . $ds . "problemtmp" . $ds . "problem" . $a[$i]['number'] . "-contest" . $contestnumber; if(is_readable($ptmp . ".name")) { - $a[$i]['descfilename']=$ptmp . $ds . file_get_contents($ptmp . ".name"); - $a[$i]['descoid']=-1; + $a[$i]['descfilename']=trim(file_get_contents($ptmp . ".name")); + if($a[$i]['descfilename'] != '') + $a[$i]['descoid']=-1; } } return $a; diff --git a/boca-1.5.0/src/team/problem.php b/boca-1.5.0/src/team/problem.php index c5bc8cb..2627990 100644 --- a/boca-1.5.0/src/team/problem.php +++ b/boca-1.5.0/src/team/problem.php @@ -42,7 +42,7 @@ for ($i=0; $i<count($prob); $i++) { echo "</td>\n"; echo " <td nowrap>" . $prob[$i]["basefilename"] . " </td>\n"; echo " <td nowrap>" . $prob[$i]["fullname"] . " </td>\n"; - if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null) { + if (isset($prob[$i]["descoid"]) && $prob[$i]["descoid"] != null && isset($prob[$i]["descfilename"])) { echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($prob[$i]["descoid"], $prob[$i]["descfilename"]) . "\">" . basename($prob[$i]["descfilename"]) . "</td>\n"; } |