diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-06-05 11:52:54 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-06-05 11:52:54 +0000 |
| commit | 0fc1ba6dff3238360a0a0da3b7cc65b86b911c63 (patch) | |
| tree | 59451a4fd9f67a294d5be1c954661d4f3354d9c8 | |
| parent | 64451b33aa22fc5b96abc65bb416a2e0c78a2a98 (diff) | |
| download | boca-master.tar.gz boca-master.zip | |
| -rw-r--r-- | src/Css.php | 270 | ||||
| -rw-r--r-- | src/admin/header.php | 2 | ||||
| -rw-r--r-- | src/admin/report/header.php | 2 | ||||
| -rw-r--r-- | src/balloon.php | 6 | ||||
| -rw-r--r-- | src/db.php | 123 | ||||
| -rw-r--r-- | src/index.php | 13 | ||||
| -rw-r--r-- | src/indexscore.php | 2 | ||||
| -rw-r--r-- | src/judge/header.php | 2 | ||||
| -rw-r--r-- | src/score/header.php | 2 | ||||
| -rw-r--r-- | src/staff/header.php | 2 | ||||
| -rwxr-xr-x | src/staff/report/header.php | 2 | ||||
| -rw-r--r-- | src/system/header.php | 2 | ||||
| -rw-r--r-- | src/team/header.php | 2 |
13 files changed, 315 insertions, 115 deletions
diff --git a/src/Css.php b/src/Css.php index ad9b784..f0839d1 100644 --- a/src/Css.php +++ b/src/Css.php @@ -1,4 +1,5 @@ <?php + //////////////////////////////////////////////////////////////////////////////// //BOCA Online Contest Administrator // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) @@ -16,73 +17,230 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// // Last modified 05/aug/2012 by cassio@ime.usp.br + $corfundo = "#e0e0d0"; $corfrente = "#000000"; $corfundo2 = "#dfdfdf"; $cormenu = "#dfdfdf"; + ?> + div#popupnew { -position:absolute; -left:50%; -top:17%; -margin-left:-202px; -font-family:'Raleway',sans-serif + position: absolute; + left: 50%; + top: 17%; + margin-left: -202px; + font-family: 'Raleway',sans-serif } + div#normal { -width:100%; -height:100%; -opacity:.95; -top:0; -left:0; -display:none; -position:fixed; -background-color:#313131; -overflow:auto -} -DIV.menu {background-color:<?php echo $corfundo?>; layer-background-color:<?php echo $corfundo?>} -DIV.menudown {background-color:<?php echo $cormenu?>; border-bottom:1px solid white; border-right:1px solid white;border-top:2px solid #555555;border-left:1px solid #555555} -DIV.fname {background-color:<?php echo $corfundo2?>; layer-background-color:<?php echo $corfundo2?>; position:absolute; visibility:hidden; border:0; left:0px; top:0px; height:19px; z-index:100;} -DIV.dir {background-color:<?php echo $corfundo?>; layer-background-color:<?php echo $corfundo?>; position:absolute; visibility:hidden; border:0; left:0px; top:0px; height:19px;z-index:100; } -A {font-family:"Courier New", Courier, mono; font-size:12pt; color:<?php echo $corfrente?>} -A.header {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12pt} -A.menu {font-family:Verdana, Arial, Helvetica, sans-serif; text-decoration:none; font-size:12pt; border: 1px solid <?php echo $corfundo?>} -A.menu:hover {background-color:<?php echo $cormenu?>; border-bottom:1px solid #555555; border-right:1px solid #555555;border-top:1px solid white;border-left:1px solid white} -A.user {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12pt} -A.user:hover {font-weight: bolder} -A.disabled {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12pt; text-decoration:none; color:#BFBFBF} -A.form {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12pt; background-color:<?php echo $cormenu?>} -BODY {background-color:<?php echo $corfundo?>; font-family:"Courier new", monospace; font-size:12pt; color:<?php echo $corfrente?>} -BODY.cline {background-color:#000000; color:#FFFFFF} -TABLE { font-family:"Courier New", Courier, mono; font-size:12pt } -TABLE.form { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12pt } -FORM { font-size:12pt;} -FORM.alt { font-size:12pt; margin-top: 5px } -FORM.fname { font-size:12pt; margin: 0px} -INPUT.fname { font-family:"Courier New", Courier, mono;font-size:12pt; border:0; background-color:<?php echo $corfundo2?> } -FORM.dir { font-size:12pt; margin: 0px} -INPUT.dir { font-family:"Courier New", Courier, mono;font-size:12pt; border:0; background-color:<?php echo $corfundo?> } + width: 100%; + height: 100%; + opacity: .95; + top: 0; + left: 0; + display: none; + position: fixed; + background-color: #313131; + overflow: auto +} + +DIV.menu { + background-color: <?php echo $corfundo?>; + layer-background-color: <?php echo $corfundo?> +} + +DIV.menudown { + background-color: <?php echo $cormenu?>; + border-bottom: 1px solid white; + border-right: 1px solid white; + border-top: 2px solid #555555; + border-left: 1px solid #555555 +} + +DIV.fname { + background-color: <?php echo $corfundo2?>; + layer-background-color: <?php echo $corfundo2?>; + position: absolute; + visibility: hidden; + border: 0; + left: 0px; + top: 0px; + height: 19px; + z-index: 100; +} + +DIV.dir { + background-color: <?php echo $corfundo?>; + layer-background-color: <?php echo $corfundo?>; + position: absolute; + visibility: hidden; + border: 0; + left: 0px; + top: 0px; + height: 19px; + z-index: 100; +} + +A { + font-family: "Courier New", Courier, mono; + font-size: 12pt; + color:<?php echo $corfrente?> +} + +A.header { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12pt +} + +A.menu { + font-family: Verdana, Arial, Helvetica, sans-serif; + text-decoration: none; + font-size: 12pt; + border: 1px solid <?php echo $corfundo?> +} + +A.menu:hover { + background-color: <?php echo $cormenu?>; + border-bottom: 1px solid #555555; + border-right: 1px solid #555555; + border-top: 1px solid white; + border-left: 1px solid white +} + +A.user { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size:12pt +} + +A.user:hover { + font-weight: bolder +} + +A.disabled { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12pt; + text-decoration: none; + color:#BFBFBF +} + +A.form { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12pt; + background-color: <?php echo $cormenu?> +} + +BODY { + background-color: <?php echo $corfundo?>; + font-family: "Courier new", monospace; + font-size: 12pt; + color:<?php echo $corfrente?> +} + +BODY.cline { + background-color: #000000; + color:#FFFFFF +} + +TABLE { + font-family: "Courier New", Courier, mono; + font-size: 12pt +} + +TABLE.form { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12pt +} + +FORM { + font-size: 12pt; +} + +FORM.alt { + font-size: 12pt; + margin-top: 5px +} + +FORM.fname { + font-size: 12pt; + margin: 0px +} + +INPUT.fname { + font-family: "Courier New", Courier, mono; + font-size: 12pt; + border: 0; + background-color: <?php echo $corfundo2?> +} + +FORM.dir { + font-size:12pt; + margin: 0px +} + +INPUT.dir { + font-family: "Courier New", Courier, mono; + font-size: 12pt; + border:0; + background-color: <?php echo $corfundo?> +} + <?php if( strstr(getenv("HTTP_USER_AGENT"), "MSIE")) { ?> -input.checkbox { border:none } +input.checkbox { + border: none +} <?php } else { ?> input.checkbox { } <?php } ?> -INPUT { font-size:12pt; border:1px solid #555555} -INPUT.cline { background-color:#000000; font-family:"Courier new", monospace; font-size:12pt; color:#FFFFFF; border:0} -TEXTAREA { border:1px solid #555555 } -TEXTAREA.edit { font-family:"Courier New", Courier, mono;font-size:10pt; background-color:#EFEFEF } -SELECT { font-size:12pt;} -p.link a:hover {background-color: #2B2E21;;color:#fff;} -p.link a:link span{display: none;} -p.link a:visited span{display: none;} + +INPUT { + font-size: 12pt; + border: 1px solid #555555 +} + +INPUT.cline { + background-color: #000000; + font-family: "Courier new", monospace; font-size:12pt; + color: #FFFFFF; + border: 0 +} + +TEXTAREA { + border: 1px solid #555555 +} + +TEXTAREA.edit { + font-family: "Courier New", Courier, mono; + font-size: 10pt; + background-color: #EFEFEF +} + +SELECT { + font-size:12pt; +} + +p.link a:hover { + background-color: #2B2E21; + color: #fff; +} + +p.link a:link span { + display: none; +} + +p.link a:visited span { + display: none; +} + p.link a:hover span { - position: absolute; - margin:15px 0px 0px 20px; - background-color: beige; - max-width:220; - padding: 2px 10px 2px 10px; - border: 1px solid #C0C0C0; - font: normal 10px/12px verdana; - color: #000; - text-align:left; - display: block; + position: absolute; + margin:15px 0px 0px 20px; + background-color: beige; + max-width:220; + padding: 2px 10px 2px 10px; + border: 1px solid #C0C0C0; + font: normal 10px/12px verdana; + color: #000; + text-align:left; + display: block; } diff --git a/src/admin/header.php b/src/admin/header.php index b4fc812..058471a 100644 --- a/src/admin/header.php +++ b/src/admin/header.php @@ -39,7 +39,7 @@ if(!isset($_POST['noflush'])) { require_once("$locr/version.php"); echo "<html><head><title>Admin's Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; - echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n"; + echo "<link rel=stylesheet href=\"$loc/css.php\" type=\"text/css\">\n"; } if(!ValidSession()) { diff --git a/src/admin/report/header.php b/src/admin/report/header.php index 4c11575..401f965 100644 --- a/src/admin/report/header.php +++ b/src/admin/report/header.php @@ -50,7 +50,7 @@ if(isset($_GET['webcastcode']) && ctype_alnum($_GET['webcastcode'])) { echo "<html><head><title>Report Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; - echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n"; + echo "<link rel=stylesheet href=\"$loc/css.php\" type=\"text/css\">\n"; $contest=$_SESSION["usertable"]["contestnumber"]; if(($ct = DBContestInfo($contest)) == null) diff --git a/src/balloon.php b/src/balloon.php index ae5e186..81b7b5c 100644 --- a/src/balloon.php +++ b/src/balloon.php @@ -1,4 +1,5 @@ <?php + //////////////////////////////////////////////////////////////////////////////// //BOCA Online Contest Administrator // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) @@ -16,6 +17,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// // Last modified 05/aug/2012 by cassio@ime.usp.br + ob_start(); header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); @@ -27,11 +29,15 @@ ob_end_flush(); require_once('fballoon.php'); $get_s=false; + if(isset($_GET["s"])) $get_s=true; + $get_color=null; + if(isset($_GET["color"])) $get_color=$_GET["color"]; balloonpng($_SESSION["locr"],$get_s,$get_color,null); + ?> @@ -1,4 +1,5 @@ <?php + //////////////////////////////////////////////////////////////////////////////// //BOCA Online Contest Administrator // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) @@ -16,10 +17,12 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////// // Last modified 21/jul/2012 by cassio@ime.usp.br + if(isset($_SESSION["locr"]) && isset($_SESSION["loc"]) && !is_readable($_SESSION["locr"] . '/private/conf.php')) { MSGError('Permission problems in ' . $_SESSION["locr"] . '/private/conf.php - the file must be readable to the user running the web server'); exit; } + require_once('hex.php'); require_once('globals.php'); require_once('private/conf.php'); @@ -33,10 +36,11 @@ function DB_lo_open($conn, $file, $mode) { else return pg_lo_open ($conn, $file, $mode); } + function DB_lo_read_tobrowser($contest,$id,$c=null) { - $str = DB_lo_read($contest,$id,-1,$c); - echo $str; - return true; + $str = DB_lo_read($contest,$id,-1,$c); + echo $str; + return true; } function DB_lo_read($contest,$id,$s=-1,$c=null) { @@ -46,28 +50,32 @@ function DB_lo_read($contest,$id,$s=-1,$c=null) { while (($buf = pg_loread ($id, 1000000)) != false) $str .= $buf; } else $str = pg_loread ($id, $s); - } - else { + } else { if($s<0) { $str=''; while (($buf = pg_lo_read ($id, 1000000)) != false) $str .= $buf; } else $str = pg_lo_read ($id, $s); } + if(($str2 = DB_unlock($contest,$str,$c))===false) return $str; return $str2; } + function DB_unlock($contest,$str,$c=null) { if($contest <= 0) return false; if(($ct = DBContestInfo($contest,$c)) == null) return false; + if(strlen($ct['contestunlockkey']) > 1) { $ar=explode(',',$ct['contestkeys']); foreach($ar as $key) { if(substr($key,0,10) == substr($str,0,10)) { $pass=decryptData(substr($key,15),$ct['contestunlockkey'],'db_unlock'); if(substr($pass,0,5) != '#####') continue; + $str2=decryptData($str,$pass,'db_unlock2'); if($str2=='') continue; + return $str2; } } @@ -81,12 +89,13 @@ function DB_lo_import($conn, $file) { else return pg_lo_import ($conn, $file); } + function DB_lo_import_text($conn, $text) { - if(($oid = DB_lo_create($conn))===false) return false; - if(($handle = DB_lo_open($conn, $oid, "w"))===false) return false; - if(DB_lo_write($handle, $text)===false) $oid=false; - DB_lo_close($handle); - return $oid; + if(($oid = DB_lo_create($conn))===false) return false; + if(($handle = DB_lo_open($conn, $oid, "w"))===false) return false; + if(DB_lo_write($handle, $text)===false) $oid=false; + DB_lo_close($handle); + return $oid; } //a função sofreu modificações importantes na versão 8.1 do php. A @@ -96,30 +105,36 @@ function DB_lo_export($contest, $conn, $oid, $file) { if($stat===false) return false; if(!is_readable($file)) return false; + if(($str=DB_unlock($contest,file_get_contents($file),$conn))!==false) { file_put_contents($file,$str); return 2; } + return 1; } + function DB_lo_close($id) { if (strcmp(phpversion(),'4.2.0')<0) return pg_loclose ($id); else return pg_lo_close ($id); } + function DB_lo_create($conn) { if (strcmp(phpversion(),'4.2.0')<0) return pg_locreate ($conn); else return pg_lo_create ($conn); } + function DB_lo_write($fp, $data) { if (strcmp(phpversion(),'4.2.0')<0) return pg_lowrite ($fp, $data); else return pg_lo_write ($fp, $data); } + function DB_lo_unlink($conn, $data) { if(($fp = DB_lo_open ($conn, $data, "r"))===false) return false; DB_lo_close($fp); @@ -128,12 +143,14 @@ function DB_lo_unlink($conn, $data) { else return pg_lo_unlink ($conn, $data); } + function DB_pg_exec($conn, $data) { if (strcmp(phpversion(),'4.2.0')<0) return pg_exec ($conn, $data); else return pg_query ($conn, $data); } + function escape_string($str) { if(strcmp(phpversion(),'4.2.0')<0) return addslashes($str); @@ -148,37 +165,35 @@ function escape_string($str) { //dados do boca ao usuario dono desses arquivos php. Esses problemas nao existem quando //shell no servidor do boca+postgres eh restrito. function DBConnect($forcenew=false) { - // procura por arquivo com as configuracao. se nao achar, usa padroes $conf = globalconf(); if($conf["dblocal"]=="true") { if($forcenew) - $conn = @pg_connect ("connect_timeout=10 dbname=".$conf["dbname"]." user=".$conf["dbuser"]. - " password=".$conf["dbpass"],PGSQL_CONNECT_FORCE_NEW); + $conn = @pg_connect ("connect_timeout=10 dbname=".$conf["dbname"]." user=".$conf["dbuser"]." password=".$conf["dbpass"],PGSQL_CONNECT_FORCE_NEW); else - $conn = @pg_connect ("connect_timeout=10 dbname=".$conf["dbname"]." user=".$conf["dbuser"]. - " password=".$conf["dbpass"]); + $conn = @pg_connect ("connect_timeout=10 dbname=".$conf["dbname"]." user=".$conf["dbuser"]." password=".$conf["dbpass"]); } else { if($forcenew) - $conn = @pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=".$conf["dbname"]. - " user=".$conf["dbuser"]." password=".$conf["dbpass"],PGSQL_CONNECT_FORCE_NEW); + $conn = @pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=".$conf["dbname"]." user=".$conf["dbuser"]." password=".$conf["dbpass"],PGSQL_CONNECT_FORCE_NEW); else - $conn = @pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=".$conf["dbname"]. - " user=".$conf["dbuser"]." password=".$conf["dbpass"]); + $conn = @pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=".$conf["dbname"]." user=".$conf["dbuser"]." password=".$conf["dbpass"]); } + if (!$conn) { LOGError("Unable to connect to database (${conf["dbhost"]},${conf["dbname"]},${conf["dbuser"]})."); - MSGError("Unable to connect to database (${conf["dbhost"]}:${conf["dbport"]},${conf["dbname"]},${conf["dbuser"]}). ". - "Is it running? Is the DB password in conf.php correct?"); + MSGError("Unable to connect to database (${conf["dbhost"]}:${conf["dbport"]},${conf["dbname"]},${conf["dbuser"]}). ". "Is it running? Is the DB password in conf.php correct?"); exit; } + if(isset($conf["dbclientenc"])) DBExecNonStop($conn,"SET NAMES '${conf["dbclientenc"]}'","set client encoding"); return $conn; } + //fecha a conexao com o banco (isso nao eh realmente necessario, ja que o php/apache cuidam do servico) function DBClose($c) { pg_close($c); } + //executar instrucao no banco de dados, sem finalizar a execucao do php //em caso de erro (mas com uma chamada para a funcao LOGLevel) //$conn eh a conexao com o banco @@ -187,12 +202,12 @@ function DBClose($c) { function DBExecNonStop($conn,$sql,$txt='') { if($txt=='') $txt='unknown at '. getFunctionName(); $result = @DB_pg_exec ($conn, $sql); - if (!$result) { - LOGError("Unable to exec SQL in the database ($txt). " . - " Error=(" . pg_errormessage($conn) . ")"); - } + + if (!$result) + LOGError("Unable to exec SQL in the database ($txt). " . " Error=(" . pg_errormessage($conn) . ")"); return $result; } + //executar instrucao no banco de dados, finalizando a execucao do php //em caso de erro (alem da chamada para a funcao LOGLevel e alerta na tela) //$conn eh a conexao com o banco @@ -200,16 +215,16 @@ function DBExecNonStop($conn,$sql,$txt='') { //$txt eh um pequeno texto descrevendo o que esta sendo feito no sql function DBExec($conn,$sql,$txt='') { if($txt=='') $txt='unknown at '. getFunctionName(); -// LOGLevel("DBExec: " . $sql, 3, false); $result = DB_pg_exec ($conn, $sql); + if (!$result) { - LOGError("Unable to exec SQL in the database ($txt). " . - " SQL=(" . sanitizeText(str_replace("\n", " ",$sql)) . "Error=(" . sanitizeText(str_replace("\n", " ",pg_errormessage($conn))) . ")"); + LOGError("Unable to exec SQL in the database ($txt). " . " SQL=(" . sanitizeText(str_replace("\n", " ",$sql)) . "Error=(" . sanitizeText(str_replace("\n", " ",pg_errormessage($conn))) . ")"); MSGError("Unable to exec SQL in the database ($txt). Aborting."); exit; } return $result; } + //executar instrucao no banco de dados, sem finalizar a execucao do php //mesmo em caso de erro (apenas uma janela de aviso tentara ser mostrada ao usuario //$conn eh a conexao com o banco @@ -217,39 +232,46 @@ function DBExec($conn,$sql,$txt='') { //$txt eh um pequeno texto descrevendo o que esta sendo feito no sql function DBExecNoSQLLog($sql,$txt='') { if($txt=='') $txt='unknown at '.getFunctionName(); + $conn = DBConnect(true); $result = DB_pg_exec ($conn, $sql); pg_close($conn); - if (!$result) { + + if (!$result) MSGError("Unable to exec SQL in the database ($txt)."); - } + return $result; } + //devolve o numero de linhas da consulta function DBnlines ($result) { return pg_numrows ($result); } + //pega uma linha da consulta no formato de array function DBRow ($r, $i) { return pg_fetch_array ($r, $i, PGSQL_ASSOC); } + //faz a consulta e pega uma linha da consulta no formato de array //$sql eh a consulta em sql //$i eh a linha desejada, comecando de zero //$txt eh uma descricao da consulta sendo feita function DBGetRow ($sql,$i,$c=null,$txt='') { if($txt=='') $txt='unknown at '.getFunctionName(); - if($c==null) - $c = DBConnect(); + if($c==null) $c = DBConnect(); + $r = DBExec($c,$sql,$txt); if (DBnlines($r) < $i+1) return null; + $a = DBRow ($r, $i); if (!$a) { - DBClose($c); - LOGError("Unable to get row $i from a query ($txt). SQL=(" . $sql . ")"); - MSGError("Unable to get row from query ($txt)."); - exit; + DBClose($c); + LOGError("Unable to get row $i from a query ($txt). SQL=(" . $sql . ")"); + MSGError("Unable to get row from query ($txt)."); + exit; } + return $a; } function DBDropDatabase() { @@ -257,27 +279,28 @@ function DBDropDatabase() { if($conf["dblocal"]=="true") $conn = pg_connect ("connect_timeout=10 dbname=template1 user=".$conf["dbsuperuser"]." password=".$conf["dbsuperpass"]); else - $conn = pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=template1 user=".$conf["dbsuperuser"]. - " password=".$conf["dbsuperpass"]); - if(!$conn) { - MSGError("Unable to connect to template1 as ".$conf["dbsuperuser"]); - exit; + $conn = pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=template1 user=".$conf["dbsuperuser"]." password=".$conf["dbsuperpass"]); + + if(!$conn) { + MSGError("Unable to connect to template1 as ".$conf["dbsuperuser"]); + exit; } + $r = DBExecNonStop($conn, "drop database ${conf["dbname"]}", "DBDropDatabase(drop)"); } -// pg_connect ("options='--client_encoding=UTF8' dbname=template1 ... ???? + function DBCreateDatabase() { $conf = globalconf(); if($conf["dblocal"]=="true") $conn = pg_connect ("connect_timeout=10 dbname=template1 user=".$conf["dbsuperuser"]." password=".$conf["dbsuperpass"]); else - $conn = pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=template1 user=".$conf["dbsuperuser"]. - " password=".$conf["dbsuperpass"]); + $conn = pg_connect ("connect_timeout=10 host=".$conf["dbhost"]." port=".$conf["dbport"]." dbname=template1 user=".$conf["dbsuperuser"]." password=".$conf["dbsuperpass"]); if(!$conn) { - MSGError("Unable to connect to template1 as ".$conf["dbsuperuser"]); - exit; + MSGError("Unable to connect to template1 as ".$conf["dbsuperuser"]); + exit; } + if(isset($conf["dbencoding"])) $r = DBExec($conn, "create database ${conf["dbname"]} with encoding = '${conf["dbencoding"]}'", "DBCreateDatabase(create)"); else @@ -286,21 +309,25 @@ function DBCreateDatabase() { function DBcrc($contest,$id, $c=null) { $docommit=false; + if($c == null) { $docommit=true; $c = DBConnect(); DBExec($c, "begin work", "DBcrc(begin)"); } + if(($f = DB_lo_open($c, $id, "r")) === false) { if($docommit) DBExec($c, "commit work", "DBcrc(commit)"); - // just to return a unique string that will not match any other... return "no-HASH-" . rand() . "-" . rand() . "-" . time(); } + $str = DB_lo_read($contest,$f,-1,$c); DB_lo_close($f); + if($docommit) DBExec($c, "commit work", "DBcrc(commit)"); + return myshorthash($str); } @@ -317,5 +344,5 @@ require_once('fbkp.php'); require_once('fextdata.php'); require_once('fzip.php'); require_once('fballoon.php'); -// eof + ?> diff --git a/src/index.php b/src/index.php index 6e75b41..ab74741 100644 --- a/src/index.php +++ b/src/index.php @@ -1,4 +1,5 @@ <?php + //////////////////////////////////////////////////////////////////////////////// //BOCA Online Contest Administrator // Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com) @@ -66,12 +67,13 @@ if(count($coo) != 2) ob_end_flush(); require_once('version.php'); + ?> <title>BOCA Online Contest Administrator <?php echo $BOCAVERSION; ?> - Login</title> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<link rel=stylesheet href="Css.php" type="text/css"> +<link rel=stylesheet href="css.php" type="text/css"> <script language="JavaScript" src="sha256.js"></script> <script language="JavaScript"> function computeHASH() { @@ -86,6 +88,7 @@ function computeHASH() { </script> <?php + if(function_exists("globalconf") && function_exists("sanitizeVariables")) { if(isset($_GET["name"]) && $_GET["name"] != "" ) { $name = $_GET["name"]; @@ -123,6 +126,7 @@ if(function_exists("globalconf") && function_exists("sanitizeVariables")) { echo "alert('Unable to load config files. Possible file permission problem in the BOCA directory.');\n"; echo "</script>\n"; } + ?> </head> @@ -175,4 +179,9 @@ if(function_exists("globalconf") && function_exists("sanitizeVariables")) { </td> </tr> </table> -<?php include('footnote.php'); ?> + +<?php + +include('footnote.php'); + +?> diff --git a/src/indexscore.php b/src/indexscore.php index 1b0d271..611bc41 100644 --- a/src/indexscore.php +++ b/src/indexscore.php @@ -57,7 +57,7 @@ require_once('version.php'); <title>BOCA Online Contest Administrator <?php echo $BOCAVERSION; ?> - Login</title> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<link rel=stylesheet href="Css.php" type="text/css"> +<link rel=stylesheet href="css.php" type="text/css"> <script language="JavaScript" src="sha256.js"></script> <script language="JavaScript"> function computeHASH() diff --git a/src/judge/header.php b/src/judge/header.php index 21f871d..38fd364 100644 --- a/src/judge/header.php +++ b/src/judge/header.php @@ -34,7 +34,7 @@ $runeditphp = "runeditchief.php"; echo "<html><head><title>Judge's Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"../css.php\" type=\"text/css\">\n"; //temporario!!!! //echo "<meta http-equiv=\"refresh\" content=\"60\" />"; diff --git a/src/score/header.php b/src/score/header.php index 2125adb..a304b03 100644 --- a/src/score/header.php +++ b/src/score/header.php @@ -31,7 +31,7 @@ require_once("../db.php"); echo "<html><head><title>Score Board Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"../css.php\" type=\"text/css\">\n"; //echo "<meta http-equiv=\"refresh\" content=\"60\" />"; if(!ValidSession()) { diff --git a/src/staff/header.php b/src/staff/header.php index 5c8fd6d..e1bc4ef 100644 --- a/src/staff/header.php +++ b/src/staff/header.php @@ -31,7 +31,7 @@ require_once("../db.php"); echo "<html><head><title>Staff's Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"../css.php\" type=\"text/css\">\n"; //echo "<meta http-equiv=\"refresh\" content=\"60\" />"; diff --git a/src/staff/report/header.php b/src/staff/report/header.php index 6ebcc32..dc3df38 100755 --- a/src/staff/report/header.php +++ b/src/staff/report/header.php @@ -46,7 +46,7 @@ require_once($locr."/freport.php"); echo "<html><head><title>Report Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"$loc/css.php\" type=\"text/css\">\n"; $contest=$_SESSION["usertable"]["contestnumber"]; if(($ct = DBContestInfo($contest)) == null) diff --git a/src/system/header.php b/src/system/header.php index 38b9938..9e7275e 100644 --- a/src/system/header.php +++ b/src/system/header.php @@ -31,7 +31,7 @@ require_once("../db.php"); echo "<html><head><title>System's Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"../css.php\" type=\"text/css\">\n"; //echo "<meta http-equiv=\"refresh\" content=\"60\" />"; if(!ValidSession()) { diff --git a/src/team/header.php b/src/team/header.php index 00909df..d48bf2c 100644 --- a/src/team/header.php +++ b/src/team/header.php @@ -32,7 +32,7 @@ $runteam='run.php'; echo "<html><head><title>Team's Page</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; -echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n"; +echo "<link rel=stylesheet href=\"../css.php\" type=\"text/css\">\n"; //echo "<meta http-equiv=\"refresh\" content=\"60\" />"; |