diff options
-rwxr-xr-x | html/import.php | 93 | ||||
-rwxr-xr-x | html/includes/config.php | 78 | ||||
-rwxr-xr-x | html/includes/functions.php | 85 | ||||
-rwxr-xr-x | html/includes/sidebar.php | 2 | ||||
-rwxr-xr-x | html/index.php | 7 |
5 files changed, 112 insertions, 153 deletions
diff --git a/html/import.php b/html/import.php index 277292a..f811d92 100755 --- a/html/import.php +++ b/html/import.php @@ -4,18 +4,17 @@ function add_info($name, $value) { return(htmlentities($name) ." ". htmlentities($value) ."<br>");
}
-?>
-<?php
@ignore_user_abort(true);
@set_time_limit(0);
+
if (isset($_REQUEST['rememberkey'])) setcookie('uts_importkey', $_REQUEST['key'], time()+60*60*24*30*365);
if (isset($_COOKIE['uts_importkey'])) $adminkey = $_REQUEST['uts_importkey'];
+
require ("includes/config.php");
require ("includes/functions.php");
$compatible_actor_versions = array('0.4.0', '0.4.1', '0.4.2', 'beta 4.0', 'beta 4.1', 'beta 4.2');
-
// Get key from web browser
if (isset($_REQUEST['key'])) $adminkey = $_REQUEST['key'];
if (!isset($adminkey)) $adminkey = '';
@@ -26,9 +25,6 @@ $debug = isset($_REQUEST['debug']) ? $_REQUEST['debug'] : false; // Output HTML?
$html = isset($_REQUEST['html']) ? $_REQUEST['html'] : true;
-
-
-
// Were running from the command line (cron-jobs)
if (php_sapi_name() == 'cli' or !isset($_SERVER['SERVER_PORT']) or !$_SERVER['SERVER_PORT']) {
// No password needed when in cli mode.
@@ -52,8 +48,7 @@ if ($html) { </tr>';
}
-
-IF (empty($import_adminkey)) {
+if (empty($import_adminkey)) {
if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
echo "\$import_adminkey not set in config.php!\n";
if ($html) {
@@ -63,14 +58,14 @@ IF (empty($import_adminkey)) { return;
}
-IF (!empty($adminkey) and $adminkey != $import_adminkey) {
+if (!empty($adminkey) and $adminkey != $import_adminkey) {
if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
echo "Keys do not match\n";
$adminkey = '';
if (!$html) return;
}
-IF (empty($adminkey)) {
+if (empty($adminkey)) {
if (!$html) die('Please provide the adminkey' ."\n");
echo'<tr>
<td class="smheading" align="left" width="150">Enter Admin key:</td>
@@ -84,8 +79,7 @@ IF (empty($adminkey)) { return;
}
-
-IF (!@is_dir('logs')) {
+if (!@is_dir('logs')) {
if ($html) echo'<tr><td class="smheading" align="left" width="150">Error:</td><td class="grey" align="left">';
echo "Can't find the logs directory!\n";
if ($html) echo "<br>";
@@ -99,8 +93,6 @@ IF (!@is_dir('logs')) { return;
}
-
-
if ($html) echo'</table><br>';
echo "\n";
@@ -118,13 +110,11 @@ else { DeBugMessage("Use ftp: no\n\$ftp_use: " . gettype($ftp_use) . ":". var_export($ftp_use, true));
}
-
$logdir = opendir('logs');
DeBugMessage("Open logdir and read logs");
-while (false !== ($filename = readdir($logdir)))
-{
+while (false !== ($filename = readdir($logdir))) {
// Our (self set) timelimit exceeded => reload the page to prevent srcipt abort
if (!empty($import_reload_after) and $start_time + $import_reload_after <= time()) {
if (!$html) die('Time limit exceeded - unable to reload page (no HTML output)' ."\n");
@@ -148,7 +138,7 @@ while (false !== ($filename = readdir($logdir))) $backupfilename = 'logs/backup/' . $oldfilename;
// UTDC log: Move to logs/utdc/
- if ($import_utdc_download_enable
+ if ($import_utdc_download_enable
and substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension
and substr($oldfilename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start) {
if ($import_utdc_log_compress == 'no') $import_utdc_log_compress = 'yes';
@@ -172,7 +162,7 @@ while (false !== ($filename = readdir($logdir))) }
// UTDC shot: Move to logs/utdc/
- if ($import_utdc_download_enable
+ if ($import_utdc_download_enable
and substr($filename, strlen($filename) - strlen($import_utdc_screenshot_extension)) == $import_utdc_screenshot_extension
and substr($oldfilename, 0, strlen($import_utdc_screenshot_start)) == $import_utdc_screenshot_start) {
if ($import_utdc_log_compress == 'no') $import_utdc_log_compress = 'yes';
@@ -196,7 +186,7 @@ while (false !== ($filename = readdir($logdir))) }
// ACE log: Move to logs/ace/
- if ($import_ace_download_enable
+ if ($import_ace_download_enable
and substr($filename, strlen($filename) - strlen($import_ace_log_extension)) == $import_ace_log_extension
and substr($oldfilename, 0, strlen($import_ace_log_start)) == $import_ace_log_start) {
if ($import_ace_log_compress == 'no') $import_ace_log_compress = 'yes';
@@ -219,7 +209,7 @@ while (false !== ($filename = readdir($logdir))) continue;
}
- if ($import_ace_download_enable
+ if ($import_ace_download_enable
and substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension
and substr($oldfilename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) {
if ($html) {
@@ -241,10 +231,8 @@ while (false !== ($filename = readdir($logdir))) continue;
}
-
-
// AnthChecker log: Move to logs/ac/
- if ($import_ac_download_enable
+ if ($import_ac_download_enable
and substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension
and substr($oldfilename, 0, strlen($import_ac_log_start)) == $import_ac_log_start) {
if ($import_ac_log_compress == 'no') $import_ac_log_compress = 'yes';
@@ -267,8 +255,8 @@ while (false !== ($filename = readdir($logdir))) continue;
}
- if(substr($filename, strlen($filename) - strlen($import_log_extension)) != $import_log_extension) continue;
- if(substr($oldfilename, 0, strlen($import_log_start)) != $import_log_start) continue;
+ if (substr($filename, strlen($filename) - strlen($import_log_extension)) != $import_log_extension) continue;
+ if (substr($oldfilename, 0, strlen($import_log_start)) != $import_log_start) continue;
// Create a unique ID
$uid = str_rand();
@@ -363,8 +351,6 @@ while (false !== ($filename = readdir($logdir))) if ($html) echo'<td class="grey" align="left" width="200">';
echo "Yes\n";
-
-
$log_incompatible = false;
$actor_version = 'unknown';
$qm_logtype = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'info' AND col2 = 'Log_Standard'");
@@ -384,7 +370,6 @@ while (false !== ($filename = readdir($logdir))) }
}
-
if ($html) echo '</td></tr><tr><td class="smheading" align="left" width="350">';
echo "Match Data Created: ";
if ($html) echo '</td><td class="grey" align="left" width="200">';
@@ -417,7 +402,7 @@ while (false !== ($filename = readdir($logdir))) $s_deaths = $qm_deaths[deaths];
// Add teamkills only if its a team game, else add them to kills total
- IF ($qm_teamgame[col3] == "True") {
+ if ($qm_teamgame[col3] == "True") {
$s_kills = $qm_kills[kills];
$s_teamkills = $qm_teamkills[teamkills];
} else {
@@ -432,7 +417,7 @@ while (false !== ($filename = readdir($logdir))) // Check if anything happened, if it didnt stop everything now
//
- IF (($qm_kills[kills] == 0 && $qm_deaths[deaths] == 0) && ($qm_gamename[col3] != "Bunny Track")) {
+ if (($qm_kills[kills] == 0 && $qm_deaths[deaths] == 0) && ($qm_gamename[col3] != "Bunny Track")) {
echo "No (Empty Match)\n";
if ($html) echo '</td></tr>';
} elseIF (($qm_playercount < 2) || (($qm_gamename == "Bunny Track") and ($qm_playercount < 1))) {
@@ -479,7 +464,6 @@ while (false !== ($filename = readdir($logdir))) $gamestart = $qm_gamestart[col0];
$gameend = $qm_gameend[col0];
-
$tournament = $qm_tournament[col3];
$teamgame = $qm_teamgame[col3];
$mapname = addslashes($qm_mapname[col3]);
@@ -488,13 +472,13 @@ while (false !== ($filename = readdir($logdir))) // Lazy Hack for unknown gametypes
$unknowngt = substr("$mapfile", 0, 3); // Gets first 3 characters
- IF ($unknowngt == "JB-") {
+ if ($unknowngt == "JB-") {
$gamename = "JailBreak";
$teamgame = 'True';
}
// Append insta to game if it was an insta game
- IF (($qm_insta[col3] == "True") && ($gamename != "Bunny Track")) { $gameinsta = 1; $gamename = "$gamename (insta)"; } else { $gameinsta = 0; }
+ if (($qm_insta[col3] == "True") && ($gamename != "Bunny Track")) { $gameinsta = 1; $gamename = "$gamename (insta)"; } else { $gameinsta = 0; }
// Get the unique ID of this gametype.
// Create a new one if it has none yet.
@@ -506,7 +490,6 @@ while (false !== ($filename = readdir($logdir))) $gid = mysql_insert_id();
}
-
// Check wheter we want to override the gametype for this match
// (Useful if we want a server to have separate stats for one server or if we want to
// combine DM and TDM rankings or ...)
@@ -533,16 +516,13 @@ while (false !== ($filename = readdir($logdir))) break;
}
-
$qm_firstblood = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'first_blood'");
$firstblood = addslashes($qm_firstblood[col2]);
-
$serverinfo = addslashes("Admin: $qm_serveran[col3]<br>Email: $qm_serverae[col3] <br><br>
<u>MOTD</u><br>$qm_serverm1[col3]<br>$qm_serverm2[col3]<br>$qm_serverm3[col3]<br>$qm_serverm4[col3]");
-
$gameinfo = addslashes( add_info('Time Limit:', $qm_gameinfotl[col3]) .
add_info('Frag Limit:', $qm_gameinfofl[col3]) .
add_info('Goal Team Score:', $qm_gameinfogt[col3]) .
@@ -562,7 +542,6 @@ while (false !== ($filename = readdir($logdir))) $gametime = utdate($gametime);
-
// Get Teams Info
$sql_tinfo = "SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamName' GROUP BY col4 ORDER BY col4 ASC";
$q_tinfo = mysql_query($sql_tinfo) or die(mysql_error());
@@ -573,10 +552,10 @@ while (false !== ($filename = readdir($logdir))) $t3info = 0;
while ($r_tinfo = mysql_fetch_array($q_tinfo)) {
- IF ($r_tinfo[col4] == "Red") { $t0info = 1; }
- IF ($r_tinfo[col4] == "Blue") { $t1info = 1; }
- IF ($r_tinfo[col4] == "Green") { $t2info = 1; }
- IF ($r_tinfo[col4] == "Gold") { $t3info = 1; }
+ if ($r_tinfo[col4] == "Red") { $t0info = 1; }
+ if ($r_tinfo[col4] == "Blue") { $t1info = 1; }
+ if ($r_tinfo[col4] == "Green") { $t2info = 1; }
+ if ($r_tinfo[col4] == "Gold") { $t3info = 1; }
}
// Get Teamscores
@@ -595,7 +574,6 @@ while (false !== ($filename = readdir($logdir))) if ($r_tscore['team'] == "3") $t3score = $r_tscore['score'];
}
-
// Insert Server Info Into Database
$sql_serverinfo = "INSERT INTO uts_match (time, servername, serverip, gamename, gid, gametime, mutators, insta, tournament, teamgame, mapname, mapfile, serverinfo, gameinfo, frags, kills, suicides, teamkills, deaths,
t0, t1, t2, t3, t0score, t1score, t2score, t3score)
@@ -606,8 +584,6 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; $q_serverinfo = mysql_query($sql_serverinfo) or die(mysql_error());
$matchid = mysql_insert_id(); // Get our Match ID
-
-
echo "Yes (ID: $matchid)\n";
if ($html) echo '</td></tr>';
@@ -623,6 +599,7 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; // Get List of Player IDs and Process What They Have Done
$sql_player = "SELECT DISTINCT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 <> ''";
$q_player = mysql_query($sql_player) or die(mysql_error());
+
while ($r_player = mysql_fetch_array($q_player)) {
$playerid = $r_player[col4];
@@ -630,7 +607,6 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; $r_player2 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 = $playerid ORDER BY id DESC LIMIT 0,1");
$playername = addslashes($r_player2[col3]);
-
// Are they a Bot
$r_player1 = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'IsABot' AND col3 = $playerid ORDER BY id DESC LIMIT 0,1");
$playertype = $r_player1[col4];
@@ -678,16 +654,16 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; }
// Get Gametype specific stuff done
- IF ($gamename == "Assault" || $gamename == "Assault (insta)") { include("import/import_ass.php"); }
- IF ($gamename == "Capture the Flag" || $gamename == "Capture the Flag (insta)") { include("import/import_ctf.php"); }
- IF ($gamename == "Bunny Track") { include("import/import_bt.php"); }
- IF ($gamename == "Domination" || $gamename == "Domination (insta)") { include("import/import_dom.php"); }
- IF ($gamename == "Tournament Team Game" || $gamename == "Tournament Team Game (insta)") { include("import/import_tdm.php"); }
- IF ($gamename == "JailBreak" || $gamename == "JailBreak (insta)") { include("import/import_jailbreak.php"); }
- IF ($gamename == "Last Man Standing" || $gamename == "Last Man Standing (insta)") { include("import/import_lms.php"); }
- IF ($gamename == "Extended Last Man Standing" || $gamename == "Extended Last Man Standing (insta)") { include("import/import_lms.php"); }
- IF ($gamename == "Last Man Standing +" || $gamename == "Last Man Standing + (insta)") { include("import/import_lms.php"); }
- IF ($gamename == "Last Man Standing++" || $gamename == "Last Man Standing++ (insta)") { include("import/import_lms.php"); }
+ if ($gamename == "Assault" || $gamename == "Assault (insta)") { include("import/import_ass.php"); }
+ if ($gamename == "Capture the Flag" || $gamename == "Capture the Flag (insta)") { include("import/import_ctf.php"); }
+ if ($gamename == "Bunny Track") { include("import/import_bt.php"); }
+ if ($gamename == "Domination" || $gamename == "Domination (insta)") { include("import/import_dom.php"); }
+ if ($gamename == "Tournament Team Game" || $gamename == "Tournament Team Game (insta)") { include("import/import_tdm.php"); }
+ if ($gamename == "JailBreak" || $gamename == "JailBreak (insta)") { include("import/import_jailbreak.php"); }
+ if ($gamename == "Last Man Standing" || $gamename == "Last Man Standing (insta)") { include("import/import_lms.php"); }
+ if ($gamename == "Extended Last Man Standing" || $gamename == "Extended Last Man Standing (insta)") { include("import/import_lms.php"); }
+ if ($gamename == "Last Man Standing +" || $gamename == "Last Man Standing + (insta)") { include("import/import_lms.php"); }
+ if ($gamename == "Last Man Standing++" || $gamename == "Last Man Standing++ (insta)") { include("import/import_lms.php"); }
// Do the rankings
include("import/import_ranking.php");
@@ -705,7 +681,7 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; // Check if theres any players left, if none or one delete the match (its possible ...)
$final_pcount = small_count("SELECT id FROM uts_player WHERE matchid = $matchid");
- IF ($final_pcount == NULL || ($final_pcount == 1 && $gamename != "Bunny Track")) {
+ if ($final_pcount == NULL || ($final_pcount == 1 && $gamename != "Bunny Track")) {
echo'<tr>
<td class="smheading" align="left" width="350">Deleting Match:</td>
<td class="grey" align="left" width="200">0 or 1 Player Entries Left</td>
@@ -857,7 +833,6 @@ if ($files != 0) { if ($html) echo '</p><br>';
}
-
// Optimise database
if (rand(0, 5) == 0) {
if ($html) echo '<p class="pages">';
diff --git a/html/includes/config.php b/html/includes/config.php index 7e9bd6f..7b086f6 100755 --- a/html/includes/config.php +++ b/html/includes/config.php @@ -5,9 +5,6 @@ $hostname = ""; $uname = "";
$upass = "";
-$dbconnect = mysql_connect($hostname,$uname,$upass);
-$dbconnect2 = mysql_select_db($dbname);
-
// The key needed to run the import script
$import_adminkey = 'fietsbel';
@@ -19,11 +16,11 @@ $import_homedir = ''; // Use the MySQL temporary tables feature?
// Available since MySQL 3.23 - requires CREATE TEMPORARY TABLE privilege since 4.0.2
-$import_use_temporary_tables = true; // set to true if available
+$import_use_temporary_tables = true; // set to true if available
// Use temporary heap tables?
// This will (at any cost) keep the entire table in RAM and may speed and/or fuck things up
-$import_use_heap_tables = false; // DON'T USE IF YOU DON'T KNOW WHAT YOU'RE DOING!
+$import_use_heap_tables = false; // DON'T USE IF YOU DON'T KNOW WHAT YOU'RE DOING!
// Log files start with...
$import_log_start = "Unreal.ngLog";
@@ -141,48 +138,49 @@ $pic_enable = true; // FTP Connection Details
-$ftp_use = false; // Whether to auto get the log files
-$ftp_interval = 0; // How often in minutes to allow stats update
-$ftp_type = 'sockets'; // Which FTP module do you want to use?
- // sockets - (recommended)
- // Use PHP's socket extension to connect to the FTP server
- // will fallback to 'pure' if no sockets available
- // pure - Use fsockopen() to connnect to the FTP server
- // should work with any php version
- // php - Use PHP's FTP extension (must be compiled in)
- // Debugging will not be available with this module and
- // error handling may not be as good as with the other modules
+$ftp_use = false; // Whether to auto get the log files
+$ftp_interval = 0; // How often in minutes to allow stats update
+$ftp_type = 'sockets'; // Which FTP module do you want to use?
+ // sockets - (recommended)
+ // Use PHP's socket extension to connect to the FTP server
+ // will fallback to 'pure' if no sockets available
+ // pure - Use fsockopen() to connnect to the FTP server
+ // should work with any php version
+ // php - Use PHP's FTP extension (must be compiled in)
+ // Debugging will not be available with this module and
+ // error handling may not be as good as with the other modules
-$ftp_debug = false; // Debugging output that may help you to resolve ftp problems
+$ftp_debug = false; // Debugging output that may help you to resolve ftp problems
// UT Server 1
$i = 0;
-$ftp_hostname[$i] = ''; // FTP server location here
-$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
- // Do not add '' around the port either
-$ftp_uname[$i] = ''; // FTP Username
-$ftp_upass[$i] = ''; // FTP Password
-$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
-//$ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
-//$ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
-//$ftp_dir[$i][] = '/'; // (or use an absolute path)
-$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
-$ftp_delete[$i] = true; // Delete logs after download?
+$ftp_hostname[$i] = ''; // FTP server location here
+$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
+ // Do not add '' around the port either
+$ftp_uname[$i] = ''; // FTP Username
+$ftp_upass[$i] = ''; // FTP Password
+$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
+// $ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
+// $ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
+// $ftp_dir[$i][] = '/'; // (or use an absolute path)
+$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
+$ftp_delete[$i] = true; // Delete logs after download?
/*
// UT Server 2 --- Uncomment this one if needed, or copy/paste the block above if more servers are needed.
$i++;
-$ftp_hostname[$i] = ''; // FTP server location here
-$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
- // Do not add '' around the port either
-$ftp_uname[$i] = ''; // FTP Username
-$ftp_upass[$i] = ''; // FTP Password
-$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
-//$ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
-//$ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
-//$ftp_dir[$i][] = '/'; // (or use an absolute path)
-$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
-$ftp_delete[$i] = true; // Delete logs after download?
+$ftp_hostname[$i] = ''; // FTP server location here
+$ftp_port[$i] = 21; // FTP Port - do not remove this even if you do not use ftp
+ // Do not add '' around the port either
+$ftp_uname[$i] = ''; // FTP Username
+$ftp_upass[$i] = ''; // FTP Password
+$ftp_dir[$i][] = '/'; // Directory of the log files - MUST NOT end with a /
+// $ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
+// $ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
+// $ftp_dir[$i][] = '/'; // (or use an absolute path)
+$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
+$ftp_delete[$i] = true; // Delete logs after download?
*/
-?>
\ No newline at end of file +
+?>
diff --git a/html/includes/functions.php b/html/includes/functions.php index 1975914..b8cab68 100755 --- a/html/includes/functions.php +++ b/html/includes/functions.php @@ -1,6 +1,12 @@ <?php
+// Connect to database
+mysql_connect($hostname, $uname, $upass);
+mysql_select_db($dbname);
+
+// Error reporting
// error_reporting(E_ALL & ~E_NOTICE);
-error_reporting(0);
+// error_reporting(-1); // Turn on all errors
+error_reporting(0); // Turn off all errors
@ini_set('track_errors', '1');
// Image Rotation Code
@@ -27,14 +33,14 @@ require_once(dirname(__FILE__) .'/countries.php'); // Addslashes if magic_quotes are off
function my_addslashes($data) {
- IF (!get_magic_quotes_gpc()) {
+ if (!get_magic_quotes_gpc()) {
$data = addslashes($data);
}
return $data;
}
function my_stripslashes($data) {
- IF (!get_magic_quotes_gpc()) {
+ if (!get_magic_quotes_gpc()) {
$data = $data;
} else {
$data = stripslashes($data);
@@ -46,7 +52,7 @@ function my_fgets($fp, $length = -1, $compression = 'none') { static $use_fgets = NULL;
if ($use_fgets === NULL) $use_fgets = (version_compare(phpversion(), "4.3.0", ">=")) ? true : false;
-
+
if ($use_fgets and $compression == 'none') {
if ($length == -1) {
return(fgets($fp));
@@ -54,7 +60,7 @@ function my_fgets($fp, $length = -1, $compression = 'none') { return(fgets($fp, $length));
}
}
-
+
$buffer = '';
$i = 0;
while(!feof($fp)) {
@@ -90,7 +96,7 @@ function my_fopen($filename, $mode, &$compression) { }
}
}
-
+
switch($compression) {
case 'bz2': $fp = @bzopen($filename, $mode); break;
case 'zlib': $fp = @gzopen($filename, $mode); break;
@@ -99,17 +105,14 @@ function my_fopen($filename, $mode, &$compression) { return($fp);
}
-
function my_fclose($fp, $compression) {
switch($compression) {
case 'bz2': return(@bzclose($fp));
case 'zlib': return(@gzclose($fp));
default: return(@fclose($fp));
}
-
}
-
// Small query
function small_query($query) {
$sql_small = "$query";
@@ -127,22 +130,21 @@ function small_count($query) { }
// uid generator
-function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789')
-{
- $str = '';
- $seeds_count = strlen($seeds);
-
- // Seed
- list($usec, $sec) = explode(' ', microtime());
- $seed = (float) $sec + ((float) $usec * 100000);
- mt_srand($seed);
-
- // Generate
- for ($i = 0; $length > $i; $i++) {
- $str .= $seeds{mt_rand(0, $seeds_count - 1)};
- }
+function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
+ $str = '';
+ $seeds_count = strlen($seeds);
+
+ // Seed
+ list($usec, $sec) = explode(' ', microtime());
+ $seed = (float) $sec + ((float) $usec * 100000);
+ mt_srand($seed);
+
+ // Generate
+ for ($i = 0; $length > $i; $i++) {
+ $str .= $seeds{mt_rand(0, $seeds_count - 1)};
+ }
- return $str;
+ return $str;
}
function zero_out($data) {
@@ -192,7 +194,6 @@ function mtimestamp($date) { }
function mdate($date) {
-
$ourdate = date('D, M j Y \a\t g:i a', mtimestamp($date));
return ($ourdate);
}
@@ -229,7 +230,7 @@ function btcaptime($time) { }
if ($time < 0) {
return "-:--";
- }
+ }
$minutes = intval($time / 60);
$seconds = intval($time % 60);
$hundreds = substr($time, -2, 2);
@@ -240,31 +241,25 @@ function btcaptime($time) { $hundreds = "00";
}
if ($seconds < 10) {
- $seconds = "0" . $seconds;
- }
+ $seconds = "0" . $seconds;
+ }
return $minutes . ":" . $seconds . ":" . $hundreds;
}
// UT Server Query Functions
-function GetItemInfo ($itemname, $itemchunks)
-{
-
+function GetItemInfo ($itemname, $itemchunks) {
$retval = "N/A";
for ($i = 0; $i < count($itemchunks); $i++) {
//Found this item
-
if (strcasecmp($itemchunks[$i], $itemname) == 0) {
$retval = $itemchunks[$i+1];
-
}
}
- //Return value
- return $retval;
+ return $retval;
}
-function GetMinutes($seconds)
-{
+function GetMinutes($seconds) {
$timemins = intval($seconds / 60);
$timesecs = ($seconds % 60);
@@ -274,7 +269,6 @@ function GetMinutes($seconds) return $timemins . ":" . $timesecs;
}
-
function FlagImage($country, $mini = true) {
global $a_countries;
$width = ($mini) ? 15 : 18;
@@ -285,7 +279,6 @@ function FlagImage($country, $mini = true) { return('<img src="images/flags/'. $country .'.png" width="'.$width.'" height="'.$height.'" style="border:0;" alt="'. $country .'" title="'. $countryname .'">');
}
-
function RankMovement($diff) {
$diff = round($diff, 2);
if ($diff == 0) {
@@ -310,9 +303,7 @@ function RankMovement($diff) { return($moveimg);
}
-
function ordinal($number) {
-
// when fed a number, adds the English ordinal suffix. Works for any
// number, even negatives
@@ -347,7 +338,6 @@ function ordinal($number) { return $suffix;
}
-
function RankImageOrText($pid, $name, $rank, $gid, $gamename, $mini = true, $format = NULL, $rankchange = NULL) {
$points = 0;
@@ -371,7 +361,6 @@ function RankImageOrText($pid, $name, $rank, $gid, $gamename, $mini = true, $for if ($rankchange !== NULL) {
$moveimg = ' '. RankMovement($rankchange);
}
-
if (empty($format)) {
if ($img) {
@@ -386,7 +375,6 @@ function RankImageOrText($pid, $name, $rank, $gid, $gamename, $mini = true, $for return(str_replace($search, $replace, $format));
}
-
function FormatPlayerName($country, $pid, $name, $gid = NULL, $gamename = NULL, $mini = true, $rankchange = NULL) {
static $cache = array();
@@ -410,7 +398,6 @@ function QuoteHintText($text) { return(str_replace($search, $replace, $text));
}
-
function OverlibPrintHint($name, $text = NULL, $caption = NULL) {
include(dirname(__FILE__) .'/hints.php');
if (!isset($hint[$name]) and empty($text)) return('');
@@ -481,7 +468,6 @@ function compress_file($method, $in, $out, $stripx00) { if ($bytes === false) return(false);
}
-
@fclose($fp_in);
switch($method) {
case 'bz2': @bzclose($fp_out); break;
@@ -513,7 +499,7 @@ function backup_logfile($method, $filename, $backupfilename, $stripx00) { default:
if ($stripx00) {
- if (compress_file('none', $filename, $backupfilename, $stripx00)) {
+ if (compress_file('none', $filename, $backupfilename, $stripx00)) {
return('Succeeded (uncompressed)');
} else {
return('FAILED' . (!empty($php_errormsg) ? ': '. $php_errormsg : ''));
@@ -549,7 +535,6 @@ function purge_backups($dir, $maxage) { return($deleted);
}
-
function file_size_info($filesize) {
$bytes = array('KB', 'KB', 'MB', 'GB', 'TB'); # values are always displayed
if ($filesize < 1024) $filesize = 1; # in at least kilobytes.
@@ -570,13 +555,13 @@ function GetCurrentWatchlist() { }
function PlayerOnWatchlist($pid) {
- $watchlist = GetCurrentWatchlist();
+ $watchlist = GetCurrentWatchlist();
return(in_array($pid, $watchlist));
}
function ToggleWatchStatus($pid) {
$watchlist = GetCurrentWatchlist();
-
+
if (in_array($pid, $watchlist)) {
$key = array_search($pid, $watchlist);
unset($watchlist[$key]);
diff --git a/html/includes/sidebar.php b/html/includes/sidebar.php index 9ae8f09..8a2537a 100755 --- a/html/includes/sidebar.php +++ b/html/includes/sidebar.php @@ -11,7 +11,7 @@ <p><a class="sidebar" href="./?p=maps">Maps</a></p>
<p><a class="sidebar" href="./?p=totals">Totals</a></p>
<p><a class="sidebar" href="./?p=watchlist">Watchlist</a></p>
- <p><a class="sidebar" href="./import.php?'.str_rand().'='.str_rand().'">Import</a></p>
+ <p><a class="sidebar" href="./import.php?<?php echo str_rand() . '=' . str_rand(); ?>">Import</a></p>
<p><a class="sidebar" href="./admin.php">Admin</a></p>
<p><a class="sidebar" href="./?p=credits">Credits</a></p>
<p><a class="sidebar" href="./?p=help">Help</a></p>
diff --git a/html/index.php b/html/index.php index 4b12de6..545bc2d 100755 --- a/html/index.php +++ b/html/index.php @@ -1,10 +1,10 @@ <?php
include ("includes/config.php");
include ("includes/functions.php");
+
if (!isset($_GET['noheader'])) include ("includes/header.php");
switch ($_GET["p"])
-
{
case "": page(); break; // Our opening page
@@ -31,9 +31,10 @@ switch ($_GET["p"]) case "totals": totals(); break; // Totals summary
case "watchlist": watchlist(); break; // The viewer's watchlist
-
+
case "credits": credits(); break; // Credits
case "help": help(); break; // Help Page
+
default : page(); break; // Our opening page
}
@@ -153,4 +154,4 @@ function help() }
include("includes/footer.php");
-?>
\ No newline at end of file +?>
|