aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.1/src/site
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2013-07-02 05:44:46 +0000
committercassio <cassiopc@gmail.com>2013-07-02 05:44:46 +0000
commita9aa438ea0558eb0044cf1e54a9190ddb41b65e5 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /boca-1.5.1/src/site
parent94caebadeb66ad7b453d4258a796979cafb758b0 (diff)
downloadboca-a9aa438ea0558eb0044cf1e54a9190ddb41b65e5.tar.gz
boca-a9aa438ea0558eb0044cf1e54a9190ddb41b65e5.zip
restructuring of boca's git
Diffstat (limited to 'boca-1.5.1/src/site')
-rw-r--r--boca-1.5.1/src/site/get.php167
-rw-r--r--boca-1.5.1/src/site/header.php88
-rw-r--r--boca-1.5.1/src/site/index.php312
-rw-r--r--boca-1.5.1/src/site/putfile.php172
4 files changed, 0 insertions, 739 deletions
diff --git a/boca-1.5.1/src/site/get.php b/boca-1.5.1/src/site/get.php
deleted file mode 100644
index 81ede0d..0000000
--- a/boca-1.5.1/src/site/get.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-////////////////////////////////////////////////////////////////////////////////
-//BOCA Online Contest Administrator
-// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-////////////////////////////////////////////////////////////////////////////////
-// Last modified 05/aug/2012 by cassio@ime.usp.br
-require('header.php');
-
-header ("Content-transfer-encoding: binary\n");
-ob_end_flush();
-
-if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null) {
- echo "<!-- <ERROR4> ".session_id() . " " . session_id() . " -->\n";
- exit;
-}
-if($ct["contestlocalsite"]==$ct["contestmainsite"]) {
- $fromsite = $_SESSION["usertable"]["usericpcid"];
- LOGLevel("Connection received from site=$fromsite PHPID=".$_COOKIE['PHPSESSID'].",extra=".$_SESSION['usertable']['usersessionextra'].
- ",session=".session_id().",name=".$getx['name'].", check=".$getx['check'],2);
- if($fromsite != '' && is_numeric($fromsite) && $fromsite > 0) {
- $siteinfo = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$fromsite);
- $scores = explode(",", $siteinfo['siteglobalscore']);
- if(count($scores)==0 || (count($scores)==1 && !is_numeric($scores[0]))) $scores=array($fromsite);
- $judges = explode(",", $siteinfo['sitejudging']);
- if(count($judges)==0 || (count($judges)==1 && !is_numeric($judges[0]))) $judges=array($fromsite);
- $scores = array_unique(array_merge($scores,$judges));
- if(in_array(0,$scores)) $scores=null;
-
- $tasks = explode(",", $siteinfo['sitetasking']);
- if(count($tasks)==0 || (count($tasks)==1 && !is_numeric($tasks[0]))) $tasks=array($fromsite);
- } else {
- echo "<!-- <ERROR9> ".session_id() . " " . session_id() . " -->\n";
- exit;
- }
- if(isset($_POST) && isset($_POST['xml'])) {
-// $fp=fopen('/tmp/aaa',"w"); fwrite($fp,$_POST['xml']); fclose($fp);
- $s = decryptData(rawurldecode($_POST['xml']),myhash($_SESSION["usertable"]["userpassword"]));
-// $fp=fopen('/tmp/aaa1',"w"); fwrite($fp,$s); fclose($fp);
-
- $ac=array();
- $ac['SITEREC']=array(
- 'site'=>$fromsite,
- 'sitenumber'=>0,
- 'number'=>0,
- 'sitename'=>0,
- 'siteip'=>0,
- 'siteduration'=>0,
- 'sitelastmileanswer'=>0,
- 'sitelastmilescore'=>0,
-// 'sitejudging'=>0,
-// 'sitetasking'=>0,
- 'siteautoend'=>0,
-// 'siteglobalscore'=>0,
- 'siteactive'=>0,
- 'sitescorelevel'=>0,
- 'sitepermitlogins'=>0,
- 'siteautojudge'=>0,
- 'sitenextuser'=>0,
- 'sitenextclar'=>0,
- 'sitenextrun'=>0,
- 'sitenexttask'=>0,
- 'sitemaxtask'=>0,
- 'sitechiefname'=>0,
- 'updatetime'=>0);
- $ac['SITETIME']=array('site'=>$fromsite,
- 'number'=>0,
- 'start'=>0,
- 'enddate'=>0,
- 'updatetime'=>0);
- $ac['USERREC']=array('site'=>$fromsite,
- 'user'=>0,
- 'number'=>0,
- 'username'=>0,
- 'usericpcid'=>0,
- 'userfull'=>0,
- 'userdesc'=>0,
- 'type'=>0,
- 'enabled'=>0,
- 'multilogin'=>0,
- 'userip'=>0,
- 'userlastlogin'=>0,
- 'userlastlogout'=>0,
- 'permitip'=>0,
- 'updatetime'=>0);
- $ac['CLARREC']=array('site'=>$judges,
- 'user'=>0,
- 'number'=>0,
- 'problem'=>0,
- 'question'=>0,
- 'clarnumber'=>0,
- 'clardate'=>0,
- 'clardatediff'=>0,
- 'clardatediffans'=>0,
- 'claranswer'=>0,
- 'clarstatus'=>0,
- 'clarjudge'=>0,
- 'clarjudgesite'=>0,
- 'updatetime'=>0);
- $ac['RUNREC']=array('site'=>$judges,
- 'user'=>0,
- 'number'=>0,
- 'runnumber'=>0,
- 'problem'=>0,
- 'lang'=>0,
- 'filename'=>0,
- 'filepath'=>0,
- 'rundate'=>0,
- 'rundatediff'=>0,
- 'rundatediffans'=>0,
- 'runanswer'=>0,
- 'runstatus'=>0,
- 'runjudge'=>0,
- 'runjudgesite'=>0,
- 'runjudge1'=>0,
- 'runjudgesite1'=>0,
- 'runanswer1'=>0,
- 'runjudge2'=>0,
- 'runjudgesite2'=>0,
- 'runanswer2'=>0,
- 'autoip'=>0,
- 'autobegindate'=>0,
- 'autoenddate'=>0,
- 'autoanswer'=>0,
- 'autostdout'=>0,
- 'autostderr'=>0,
- 'updatetime'=>0);
- $ac['TASKREC']=array(
- 'site'=>$tasks,
- 'user'=>0,
- 'desc'=>0,
- 'number'=>0,
- 'tasknumber'=>0,
- 'color'=>0,
- 'colorname'=>0,
- 'updatetime'=>0,
- 'filename'=>0,
- 'filepath'=>0,
- 'sys'=>0,
- 'status'=>0,
- 'taskdate'=>0,
- 'taskdatediff'=>0,
- 'taskdatediffans'=>0,
- 'taskstaffnumber'=>0,
- 'taskstaffsite'=>0);
-
- if(importFromXML($s,$ac,$_SESSION["usertable"]["contestnumber"]))
- echo "<!-- <OK> -->";
- else
- echo "<!-- <NOTOK> -->";
- }
- $xml = generateXML($_SESSION["usertable"]["contestnumber"],0,$scores);
- echo encryptData($xml,myhash($_SESSION["usertable"]["userpassword"]));
-} else
- echo "<!-- <ERROR3> ".session_id() . " " . session_id() . " -->\n";
-?>
diff --git a/boca-1.5.1/src/site/header.php b/boca-1.5.1/src/site/header.php
deleted file mode 100644
index f1b47b3..0000000
--- a/boca-1.5.1/src/site/header.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-////////////////////////////////////////////////////////////////////////////////
-//BOCA Online Contest Administrator
-// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// 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");
-header ("Cache-Control: no-cache, must-revalidate");
-header ("Pragma: no-cache");
-header ("Content-Type: text/html; charset=utf-8");
-session_start();
-//require_once('../version.php');
-require_once("../globals.php");
-require_once("../db.php");
-
-if(!function_exists("globalconf") || !function_exists("sanitizeVariables")) {
- ob_end_flush();
- ForceLoad("../index.php");
- exit;
-}
-
-$getx=array();
-if(isset($_GET['name'])) $getx['name']=$_GET['name'];
-if(isset($_GET['password'])) $getx['password']=$_GET['password'];
-if(isset($_GET['check'])) $getx['check']=$_GET['check'];
-//if(isset($_POST)) {
-if(isset($_POST["name"])) $getx['name']=$_POST['name'];
-if(isset($_POST["password"])) $getx['password']=$_POST['password'];
-if(isset($_POST["check"])) $getx['check']=$_POST['check'];
-//}
-//LOGError("PHPID=".$_COOKIE['PHPSESSID'].",extra=".$_SESSION['usertable']['usersessionextra'].
-// ",session=".session_id().",name=".$getx['name'].", password=".$getx['password'].",check=".$getx['check']);
-if (!isset($_SESSION["usertable"])) {
- if(isset($getx['name']) && $getx['name'] != "" && isset($getx['password']) && $getx['password'] != "") {
- $name = $getx["name"];
- LogLevel("Connection try by IP " . getIP() . ", username=" . $name,2);
- $password = $getx["password"];
- $usertable = DBLogIn($name, $password, false);
- if(!$usertable) {
- ob_end_flush();
- echo "<!-- <ERROR1> ". session_id() . " " . session_id() . " -->\n";
- exit;
- }
- if(!isset($getx['check'])) {
- ob_end_flush();
- echo "<!-- <ERROR2> ". session_id() . " " . session_id() . " -->\n";
- exit;
- }
- } else {
- ob_end_flush();
- LogLevel("Init connection by IP " . getIP(),2);
- echo "<!-- <SESSION1> ". session_id() . " " . session_id() . " -->\n";
- exit;
- }
-}
-if(!ValidSession()) {
- ob_end_flush();
- InvalidSession("site/index.php");
- ForceLoad("../index.php");
- exit;
-}
-if(isset($getx['check']) && isset($getx["password"]) && $getx['check'] != myhash($getx["password"] . $_SESSION['usertable']['userpassword'])) {
- ob_end_flush();
- echo "<!-- <SESSION2> ". session_id() . " " . $_SESSION['usertable']['usersessionextra'] . " -->\n";
- exit;
-}
-
-if($_SESSION["usertable"]["usertype"] != "site") {
- ob_end_flush();
- IntrusionNotify("site/index.php");
- ForceLoad("../index.php");
- exit;
-}
-?>
diff --git a/boca-1.5.1/src/site/index.php b/boca-1.5.1/src/site/index.php
deleted file mode 100644
index 3b066ab..0000000
--- a/boca-1.5.1/src/site/index.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-////////////////////////////////////////////////////////////////////////////////
-//BOCA Online Contest Administrator
-// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-////////////////////////////////////////////////////////////////////////////////
-// Last modified 21/jul/2012 by cassio@ime.usp.br
-require('header.php');
-if(isset($_GET['mainuser']) && isset($_GET['mainpass']) && $_GET['mainuser']!="" && $_GET['mainpass']!="") {
- $_SESSION['mainuser'] = $_GET['mainuser'];
- $_SESSION['mainpass'] = $_GET['mainpass'];
- $_SESSION['check'] = $_GET['check'];
- unset($_GET['mainuser']);
- unset($_GET['mainpass']);
- unset($_GET['check']);
- ForceLoad('index.php');
-}
-$smi = isset($_SESSION['mainid'])? $_SESSION['mainid']: "";
-$smu = isset($_SESSION['mainuser'])? $_SESSION['mainuser']: "";
-$smp = isset($_SESSION['mainpass'])? $_SESSION['mainpass']: "";
-$smc = isset($_SESSION['check'])? $_SESSION['check']: "";
-//MSGError("id=".$smi." user=".$smu." pass=".$smp. " check=".$smc);
-
-echo "<html><head><title>Site 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";
-if ($smp != $smc && $smp != '' && $smc != '')
- echo "<meta http-equiv=\"refresh\" content=\"60\" />";
-
-if ($smu != '')
- echo "</head><body onload=\"document.form1.password.focus()\"><table border=1 width=\"100%\">\n";
-else
- echo "</head><body onload=\"document.form1.name.focus()\"><table border=1 width=\"100%\">\n";
-echo "<tr><td nowrap bgcolor=\"#ff00ff\" align=center>";
-echo "<img src=\"../images/smallballoontransp.png\" alt=\"\">";
-echo "<font color=\"#000000\">BOCA</font>";
-echo "</td><td bgcolor=\"#ff00ff\" width=\"99%\">\n";
-echo "Username: " . $_SESSION["usertable"]["userfullname"] . " (site=".$_SESSION["usertable"]["usersitenumber"].")<br>\n";
-list($clockstr,$clocktype)=siteclock();
-echo "</td><td bgcolor=\"#ff00ff\" align=center nowrap>&nbsp;".$clockstr."&nbsp;</td></tr>\n";
-echo "</table>\n";
-echo "<table border=0 width=\"100%\" align=center>\n";
-echo " <tr>\n";
-echo " <td align=center><a class=menu style=\"font-weight:bold\" href=../index.php>Logout</a></td>\n";
-echo " </tr>\n";
-echo "</table>\n";
-
-list($t,$id,$idextra) = getMainXML($smu,$smi,$smp,$smc);
-//MSGError("t=". ($t==false?"false":"true") ." id=$id idextra=$idextra");
-if($t==false)
- $_SESSION['mainid'] = $id;
-$_SESSION['mainok'] = $t;
-
-if(!$t) {
- unset($_GET['mainuser']);
- unset($_GET['mainpass']);
- unset($_GET['check']);
- unset($_SESSION["mainuser"]);
- unset($_SESSION["mainpass"]);
- unset($_SESSION["check"]);
-?>
-<script language="JavaScript" src="../sha256.js"></script>
-<script language="JavaScript">
-function computeHASH()
-{
- var userHASH, passHASH, passHASH2;
- userHASH = document.form1.name.value;
- <?php if(strlen($id) > 20 && strlen($idextra) > 20) { ?>
- tmpv = js_myhash(document.form1.password.value);
- passHASH = js_myhash(tmpv+'<?php echo $id; ?>');
- passHASH2 = js_myhash(tmpv+'<?php echo $idextra; ?>');
- <?php } ?>
- tmpv = ' ';
- document.form1.name.value = '';
- document.form1.password.value = ' ';
- document.location = 'index.php?mainuser='+userHASH+'&mainpass='+passHASH+'&check='+passHASH2;
-}
-</script>
-<table width="100%" height="100%" border="0">
- <tr align="center" valign="middle">
- <td>
- <form name="form1" action="javascript:computeHASH()">
- <div align="center">
- <table border="0" align="center">
-<?php
- if($id == '' || $idextra=='') {
-?>
- <input type="hidden" name="name" value="">
- <input type="hidden" name="password" value="">
- <tr>
- <td nowrap>
- <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">
-Cannot access main server. Check IP address,<br> password and internet connection, then press OK.</font></div>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <center><input type="submit" name="Submit" value="OK"></center>
- </td>
- </tr>
-<?php
- } else {
-?>
- <tr>
- <td nowrap>
- <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="+1">
- <?php
- if($id==$idextra) {
- $contest=$_SESSION["usertable"]["contestnumber"];
- $ct = DBContestInfo($contest);
- echo "Credentials to connect to main server<br>";
- echo "at URL: " . $ct['contestmainsiteurl'];
- } else
- echo "<u>Status</u>: initial connection established<br><br>To guarantee an encrypted connection, please type the same password again:";
-?>
- </font></div>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <table border="0" align="left">
- <tr>
- <td><font face="Verdana, Arial, Helvetica, sans-serif" >
- Name
- </font></td>
- <td>
- <input type="text" name="name" value="<?php echo $smu; ?>">
- </td>
- </tr>
- <tr>
- <td><font face="Verdana, Arial, Helvetica, sans-serif" >Password</font></td>
- <td>
- <input type="password" name="password">
- </td>
- </tr>
- </table>
- <input type="submit" name="Submit" value="Login">
- </td>
- </tr>
-<?php } ?>
- </table>
- </div>
- </form>
- </td>
- </tr>
-</table>
-<?php
-} else {
- if($idextra == "<OK>")
- echo "<u>Data sent correctly to main server</u><br><br>";
- else
- echo "<u>Error sending data to main server</u><br><br>";
- $ac['CONTESTREC']=array('number'=>-1,
- 'name'=>-1,
- 'startdate'=>-1,
- 'duration'=>-1,
- 'lastmileanswer'=>-1,
- 'lastmilescore'=>-1,
- 'penalty'=>-1,
- 'maxfilesize'=>-1,
- 'updatetime'=>-1);
- $ac['ANSWERREC']=array('number'=>-1,
- 'name'=>-1,
- 'yes'=>-1,
- 'updatetime'=>-1);
- $ac['LANGUAGEREC']=array('number'=>-1,
- 'name'=>-1,
- 'filepath'=>-1,
- 'filename'=>-1,
- 'comppath'=>-1,
- 'compname'=>-1,
- 'problemnumber'=>-1,
- 'updatetime'=>-1);
- $ac['PROBLEMREC']=array('number'=>-1,
- 'name'=>-1,
- 'fullname'=>-1,
- 'basename'=>-1,
- 'inputfilename'=>-1,
- 'inputfilepath'=>-1,
- 'solfilename'=>-1,
- 'solfilepath'=>-1,
- 'descfilename'=>-1,
- 'descfilepath'=>-1,
- 'tl'=>-1,
-// 'colorname'=>-1,
-// 'color'=>-1,
- 'fake'=>-1,
- 'updatetime'=>-1);
- $ac['SITETIME']=array('site'=>-1,
- 'start'=>-1,
- 'enddate'=>-1,
- 'updatetime'=>-1);
- $ac['SITEREC']=array('sitenumber'=>-1,
- 'site'=>-1,
- 'number'=>-1,
- 'sitename'=>-1,
- 'siteip'=>-1,
- 'siteduration'=>-1,
- 'sitelastmileanswer'=>-1,
- 'sitelastmilescore'=>-1,
- 'sitejudging'=>-1,
- 'sitetasking'=>-1,
- 'siteautoend'=>-1,
- 'siteglobalscore'=>-1,
- 'siteactive'=>-1,
- 'sitescorelevel'=>-1,
- 'sitepermitlogins'=>-1,
- 'siteautojudge'=>-1,
- 'sitenextuser'=>-1,
- 'sitenextclar'=>-1,
- 'sitenextrun'=>-1,
- 'sitenexttask'=>-1,
- 'sitemaxtask'=>-1,
- 'sitechiefname'=>-1,
- 'updatetime'=>-1);
- $ac['USERREC']=array('site'=>-1,
- 'user'=>-1,
- 'number'=>-1,
- 'username'=>-1,
- 'updatetime'=>-1,
- 'usericpcid'=>-1,
- 'userfull'=>-1,
- 'userdesc'=>-1,
- 'type'=>-1,
- 'enabled'=>-1,
- 'multilogin'=>-1,
- 'userip'=>-1,
- 'userlastlogin'=>-1,
- 'userlastlogout'=>-1,
- 'permitip'=>-1);
- $ac['CLARREC']=array('site'=>-1,
- 'user'=>-1,
- 'number'=>-1,
- 'problem'=>-1,
- 'question'=>-1,
- 'clarnumber'=>-1,
- 'clardate'=>-1,
- 'clardatediff'=>-1,
- 'clardatediffans'=>-1,
- 'claranswer'=>-1,
- 'clarstatus'=>-1,
- 'clarjudge'=>-1,
- 'clarjudgesite'=>-1,
- 'updatetime'=>-1);
- $ac['RUNREC']=array('site'=>-1,
- 'user'=>-1,
- 'number'=>-1,
- 'runnumber'=>-1,
- 'problem'=>-1,
- 'lang'=>-1,
- 'filename'=>-1,
- 'filepath'=>-1,
- 'rundate'=>-1,
- 'rundatediff'=>-1,
- 'rundatediffans'=>-1,
- 'runanswer'=>-1,
- 'runstatus'=>-1,
- 'runjudge'=>-1,
- 'runjudgesite'=>-1,
- 'runjudge1'=>-1,
- 'runjudgesite1'=>-1,
- 'runanswer1'=>-1,
- 'runjudge2'=>-1,
- 'runjudgesite2'=>-1,
- 'runanswer2'=>-1,
- 'autoip'=>-1,
- 'autobegindate'=>-1,
- 'autoenddate'=>-1,
- 'autoanswer'=>-1,
- 'autostdout'=>-1,
- 'autostderr'=>-1,
- 'updatetime'=>-1);
- $ac['TASKREC']=array(
- 'site'=>-1,
- 'user'=>-1,
- 'desc'=>-1,
- 'number'=>-1,
- 'tasknumber'=>-1,
- 'color'=>-1,
- 'colorname'=>-1,
- 'updatetime'=>-1,
- 'filename'=>-1,
- 'filepath'=>-1,
- 'sys'=>-1,
- 'status'=>-1,
- 'taskdate'=>-1,
- 'taskdatediff'=>-1,
- 'taskdatediffans'=>-1,
- 'taskstaffnumber'=>-1,
- 'taskstaffsite'=>-1);
-
- if(importFromXML($id,$ac,$_SESSION["usertable"]["contestnumber"]))
- echo "<u>Data received correctly from main server at " . dateconv(time()) . "</u>";
- else
- echo "<u>Error receiving data from main server at ". dateconv(time()) . "</u>";
-// echo "<pre>" . $id . "</pre>";
- echo "<br><br><b>waiting for next round...</b>";
-}
-?>
-</body>
-</html>
diff --git a/boca-1.5.1/src/site/putfile.php b/boca-1.5.1/src/site/putfile.php
deleted file mode 100644
index 3155bd8..0000000
--- a/boca-1.5.1/src/site/putfile.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-////////////////////////////////////////////////////////////////////////////////
-//BOCA Online Contest Administrator
-// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-////////////////////////////////////////////////////////////////////////////////
-//Last updated 10/jul/2012 by cassio@ime.usp.br
-//
-//PC^2 integration developed by Fabio Antonio Avellaneda Pachon
-$quiet=true;
-require 'header.php';
-$ds = DIRECTORY_SEPARATOR;
-if($ds=="") $ds = "/";
-$remotedir=$ds . "private" . $ds . "remotescores";
-
-if(($ct = DBContestInfo($_SESSION["usertable"]["contestnumber"])) == null)
-exit;
-if(($st = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
-exit;
-
-if(is_writable($_SESSION["locr"] . $remotedir)) {
- if(isset($_POST['PC2']) && is_numeric($_POST['PC2']) && $_POST['PC2'] > 0) {
- $site = $_POST['PC2'];
- $problemCount = 4;
- for($i=0;$i<$problemCount;$i++) {
- $problems[$i]["name"]=chr($i+ord("A"));
- $problems[$i]["color"]="FFFFFF";
- $problems[$i]["colorname"]="white";
- $problems[$i]["solved"]=0;
- $problems[$i]["judging"]=false;
- $problems[$i]["time"]=0;
- $problems[$i]["penalty"]=0;
- $problems[$i]["count"]=0;
- }
-
- /*** Load PC2 summary.html **/
- $board=base64_decode($_POST['data']);
-
- /*** a new dom object ***/
- $dom = new domDocument;
-
- /*** load the html into the object ***/
- $dom->loadHTML($board);
-
- /*** discard white space ***/
- $dom->preserveWhiteSpace = false;
-
- /*** the table by its tag name ***/
- $tables = $dom->getElementsByTagName('table');
-
- /*** get all rows from the table ***/
- $rows = $tables->item(0)->getElementsByTagName('tr');
-
- /*** loop over the table rows ***/
- $userCount = 1;
- $firstProblem=-1;
- foreach ($rows as $row)
- {
- //teams are always being renumbered since their number is not important... just they have to be different
- $team["user"]=(string)$userCount;
- $team["site"]=(string)$site;
-
- /*** get each column by tag name ***/
- $cols = $row->getElementsByTagName('td');
- $colCount=0;
- $probCount=1;
- //Ignore empty cols
- if($cols->item(0)->nodeValue=="")
- {
- continue;
- }
- foreach ($cols as $col)
- {
- switch($colCount)
- {
- //First column, start the problem counter and by default, the team hasnt solved a problem
- case 0;
- $probCount=1;
- $firstProblem=-1;
- break;
- //First column: team name
- case 1:
- $team["username"]=$col->nodeValue;
-// echo "username: $col->nodeValue\n";
- $team["usertype"]="team";
- $team["userfullname"]=$col->nodeValue;
- break;
- //Second column: How many problems does the team solved at this time
- case 2:
- $team["totalcount"]=(int)$col->nodeValue;
- // echo "totalcount: $col->nodeValue\n";
- break;
- //Third column: Elapsed time, including penalisations
- case 3:
- $team["totaltime"]=$col->nodeValue;
- // echo "totaltime: $col->nodeValue\n";
- break;
- //No more problems to process
- case $problemCount+4:
- $total[$userCount-1]=$team;
- //If firstProblem is different to -1 is because the team has solved at least one problem
- if($firstProblem!=-1)
- {
- $total[$userCount-1]["first"]=$firstProblem;
- }
- break;
- //Problems columns
- default:
- list($count, $time) = split('/', $col->nodeValue);
- //echo "Sol: $solved / time: $count";
- if($time=="--")
- {
- $solved=false;
- $time="";
- }else
- {
- $solved=true;
- }
- $team["problem"][$probCount]=$problems[$probCount];
- $team["problem"][$probCount]["solved"]=$solved;
- $team["problem"][$probCount]["time"]=$time;
- //I can calculate the effective time and the penalisation time, if needed
- $team["problem"][$probCount]["penalty"]=$time;
- $team["problem"][$probCount]["count"]=$count;
- //look for the time which first problem was solved
- if($firstProblem==-1 && $solved)
- {
- $firstProblem=$time;
- }else
- {
- if($solved && $time<$firstProblem)
- {
- $firstProblem=$time;
- }
- }
- $probCount++;
- }//end switch
-
- $colCount++; //echo $col->nodeValue."\t";
- }//end col for
-
- $userCount++;
-// echo '<hr />';
- } //end row col
-//echo print_r($total);
- $total=base64_encode(serialize($total));
- } else
- $total=$_POST['data'];
-
- $fn = tempnam($_SESSION["locr"] . $remotedir,"score_");
- $fout = fopen($fn,"wb");
- fwrite($fout,$total,10000000);
- fclose($fout);
-
- if(@rename($fn, $_SESSION["locr"] . $remotedir . $ds . "score_" . $_SESSION["usertable"]["username"] .
- "_" . $_SESSION["usertable"]["usericpcid"] . "_" . md5(getIP()) . ".dat"))
- echo "SCORE UPLOADED OK\n";
- else
- echo "FAILED: UPDATE SCORE ERROR\n";
-} else echo "FAILED: PERMISSION DENIED IN THE SERVER\n";
-?>