From 0fb7637e5b9fff24a7265a27308ea795ec8e3f38 Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Thu, 19 Oct 2017 13:44:08 +0100 Subject: new options to admin --- src/admin/header.php | 4 +-- src/admin/misc.php | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 src/admin/misc.php (limited to 'src/admin') diff --git a/src/admin/header.php b/src/admin/header.php index d2cf43f..5a01c93 100644 --- a/src/admin/header.php +++ b/src/admin/header.php @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . //////////////////////////////////////////////////////////////////////////////// -// Last modified 21/jul/2012 by cassio@ime.usp.br +// Last modified 19/oct/2017 by cassio@ime.usp.br ob_start(); header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT"); @@ -71,7 +71,7 @@ if(!isset($_POST['noflush'])) { echo " Problems\n"; echo " Languages\n"; echo " Answers\n"; - echo " Transfer\n"; + echo " Misc\n"; //echo "
\n"; echo " \n"; echo " \n"; diff --git a/src/admin/misc.php b/src/admin/misc.php new file mode 100644 index 0000000..9872f12 --- /dev/null +++ b/src/admin/misc.php @@ -0,0 +1,98 @@ +. +//////////////////////////////////////////////////////////////////////////////// +//Last updated 16/oct/2017 by cassio@ime.usp.br +require 'header.php'; +?> +
+ + + +
+   +   +   + +
+ +\n"; + echo "Building scores\n"; + $level=$s["sitescorelevel"]; + $data0 = array(); + if($level>0) { + list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"], + $_SESSION["usertable"]["usersitenumber"], 0, -1); + } + $ct=DBGetActiveContest(); + $localsite=$ct['contestlocalsite']; + $fname = $privatedir . $ds . "score_localsite_" . $localsite . "_x"; // . md5($_SERVER['HTTP_HOST']); + @file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); + @rename($fname . ".tmp",$fname . ".dat"); + + $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 . "_" . $localsite . "_x"; // . md5($_SERVER['HTTP_HOST']); + @file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); + @rename($fname . ".tmp",$fname . ".dat"); + echo "Transferring scores\n"; + scoretransfer($fname . ".dat", $localsite); + echo "Saving scores\n"; + if(@create_zip($remotedir,glob($remotedir . '/*.dat'),$fname . ".tmp") != 1) { + LOGError("Cannot create score zip file"); + if(@create_zip($remotedir,array(),$fname . ".tmp") == 1) + @rename($fname . ".tmp",$destination); + } else { + @rename($fname . ".tmp",$destination); + } + @fclose($fp); + echo "Processing other data\n"; + getMainXML($_SESSION["usertable"]["contestnumber"]); + echo "\n"; + @unlink($destination . ".lck"); + } else { + if(file_exists($destination . ".lck") && filemtime($destination . ".lck") < time() - 180) + @unlink($destination . ".lck"); + } + } +} +?> + + -- cgit v1.2.3
Tasks