From 40dfa7d5c0dc8e4cb2c95e403b6b4b2c4bf70644 Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Sat, 4 Feb 2017 16:05:45 +0100 Subject: Original UTStats beta 4.2.8 --- html/includes/clanbase.php | 90 ++++++ html/includes/config.php | 188 +++++++++++ html/includes/config_pic.php | 239 ++++++++++++++ html/includes/countries.php | 244 +++++++++++++++ html/includes/footer.php | 16 + html/includes/ftp.php | 411 ++++++++++++++++++++++++ html/includes/ftp_class.php | 492 +++++++++++++++++++++++++++++ html/includes/ftp_class_native.php | 142 +++++++++ html/includes/ftp_class_pure.php | 192 ++++++++++++ html/includes/ftp_class_sockets.php | 249 +++++++++++++++ html/includes/ftptimestamp.php | 1 + html/includes/functions.php | 605 ++++++++++++++++++++++++++++++++++++ html/includes/functions_admin.php | 332 ++++++++++++++++++++ html/includes/geoip.inc | 498 +++++++++++++++++++++++++++++ html/includes/header.php | 66 ++++ html/includes/hints.php | 81 +++++ html/includes/index.htm | 0 html/includes/overlib_mini.js | 322 +++++++++++++++++++ html/includes/sidebar.php | 27 ++ html/includes/teamstats.php | 177 +++++++++++ html/includes/weaponstats.php | 216 +++++++++++++ 21 files changed, 4588 insertions(+) create mode 100755 html/includes/clanbase.php create mode 100755 html/includes/config.php create mode 100755 html/includes/config_pic.php create mode 100755 html/includes/countries.php create mode 100755 html/includes/footer.php create mode 100755 html/includes/ftp.php create mode 100755 html/includes/ftp_class.php create mode 100755 html/includes/ftp_class_native.php create mode 100755 html/includes/ftp_class_pure.php create mode 100755 html/includes/ftp_class_sockets.php create mode 100755 html/includes/ftptimestamp.php create mode 100755 html/includes/functions.php create mode 100755 html/includes/functions_admin.php create mode 100755 html/includes/geoip.inc create mode 100755 html/includes/header.php create mode 100755 html/includes/hints.php create mode 100755 html/includes/index.htm create mode 100755 html/includes/overlib_mini.js create mode 100755 html/includes/sidebar.php create mode 100755 html/includes/teamstats.php create mode 100755 html/includes/weaponstats.php (limited to 'html/includes') diff --git a/html/includes/clanbase.php b/html/includes/clanbase.php new file mode 100755 index 0000000..5ad7640 --- /dev/null +++ b/html/includes/clanbase.php @@ -0,0 +1,90 @@ +| )/U", $file, $out, PREG_SET_ORDER); + + + //for each player split the information and put all info in one array + + for ($x=0;$x',$out[$x][1]); + } + + //return the array + + return ($player); + + //All players are listed as: + //$player[0] + //$player[1] + //$player[2] + //etc. + + //the info for each player is listed as: + //$player[0][0] = pid; + //$player[0][1] = name; +} + + +/* + This function is to get the clans from a war. + It will return an array with all the information. +*/ + +function get_clans($wid) { + //Load the page where all players are listed into a var. + + $url = 'http://www.clanbase.com/warinfo.php?wid='.$wid.'&frame=1'; + $file = implode('', file($url)); + + //Use an expression to get the tags from each clan + + preg_match_all("/pagetitle'>Match (.*)vs (.*)<.div>/U", $file, $out, PREG_SET_ORDER); + + //Add the information to one array + + $clan[0][0]=$out[0][1]; + $clan[1][0]=$out[0][2]; + + //Use an expression to get the cid + full name from each clan + + preg_match_all("/claninfo\.php\?cid+=(.*)<.a>/U", $file, $out, PREG_SET_ORDER); + + //Add the information to one array + + $temp = explode('" class="slink">', $out[0][1]); + $clan[0][1]=$temp[0]; + $clan[0][2]=$temp[1]; + + $temp = explode('" class="slink">', $out[1][1]); + $clan[1][1]=$temp[0]; + $clan[1][2]=$temp[1]; + + //return the array + + return ($clan); + + + //The clans are listed as: + //$clan[0] + //$clan[1] + + //the info for each clan is listed as: + //$clan[0][0] = tag + //$clan[0][1] = cid + //$clan[0][2] = full name + +} +?> \ No newline at end of file diff --git a/html/includes/config.php b/html/includes/config.php new file mode 100755 index 0000000..7e9bd6f --- /dev/null +++ b/html/includes/config.php @@ -0,0 +1,188 @@ + \ No newline at end of file diff --git a/html/includes/config_pic.php b/html/includes/config_pic.php new file mode 100755 index 0000000..e70aee5 --- /dev/null +++ b/html/includes/config_pic.php @@ -0,0 +1,239 @@ + 'Player has played a total of 57 Capture the Flag games.' +// +// '%PLAYERNAME%'s overall accuracy this month was %MONTH_ACC% % while it was %LMONTH_ACC% last month!' +// ==> 'Player's overall accuracy this month was 42.22 % while it was 27.52 % last month!' + + +$j=0; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = '%PLAYERNAME%'; +$pic[$i]['process'][$j]['fontcolor'] = '000000'; +$pic[$i]['process'][$j]['fontsize'] = 18; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 23; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = '%GAMENAME%'; +$pic[$i]['process'][$j]['fontsize'] = 14; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 43; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = 'Rank:'; +$pic[$i]['process'][$j]['fontcolor'] = 'DDDD20'; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 69; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['align'] = 'left'; +$pic[$i]['process'][$j]['value'] = '%RT%'; +$pic[$i]['process'][$j]['x_from'] = 65; +$pic[$i]['process'][$j]['y_from'] = 69; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = 'Hours:'; +$pic[$i]['process'][$j]['fontcolor'] = '000000'; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 91; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['align'] = 'left'; +$pic[$i]['process'][$j]['value'] = '%TOTAL_GAMETIME%'; +$pic[$i]['process'][$j]['x_from'] = 75; +$pic[$i]['process'][$j]['y_from'] = 91; +$j++; + + + + + + + + +// The next picture + +$i++; +$pic[$i]['enabled'] = false; +$pic[$i]['gidrequired'] = false; +$pic[$i]['load']['template'] = 'basic.png'; +$pic[$i]['load']['recreate'] = true; +$pic[$i]['load']['bgcolor'] = 'AAAAAA'; +$pic[$i]['load']['bgtransparent'] = false; + +$pic[$i]['output']['type'] = 'png'; + +$pic[$i]['default']['align'] = 'left'; +$pic[$i]['default']['angle'] = 0; +$pic[$i]['default']['font'] = 'microsbe.ttf'; +$pic[$i]['default']['fontcolor'] = 'FFFFFF'; +$pic[$i]['default']['fontsize'] = 10; + +$j=0; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = '%PLAYERNAME% sucks!'; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 23; +$j++; +$pic[$i]['process'][$j]['type'] = 'text'; +$pic[$i]['process'][$j]['value'] = 'in %GAMENAME% games that is...'; +$pic[$i]['process'][$j]['x_from'] = 9; +$pic[$i]['process'][$j]['y_from'] = 43; +$j++; + + + +?> \ No newline at end of file diff --git a/html/includes/countries.php b/html/includes/countries.php new file mode 100755 index 0000000..4de8dde --- /dev/null +++ b/html/includes/countries.php @@ -0,0 +1,244 @@ + 'Afghanistan', + 'al' => 'Albania, People\'s Socialist Republic of', + 'dz' => 'Algeria, People\'s Democratic Republic of', + 'as' => 'American Samoa', + 'ad' => 'Andorra, Principality of', + 'ao' => 'Angola, Republic of', + 'ai' => 'Anguilla', + 'aq' => 'Antarctica (the territory South of 60 deg S)', + 'ag' => 'Antigua and Barbuda', + 'ar' => 'Argentina, Argentine Republic', + 'am' => 'Armenia', + 'aw' => 'Aruba', + 'au' => 'Australia, Commonwealth of', + 'at' => 'Austria, Republic of', + 'az' => 'Azerbaijan, Republic of', + 'bs' => 'Bahamas, Commonwealth of the', + 'bh' => 'Bahrain, Kingdom of', + 'bd' => 'Bangladesh, People\'s Republic of', + 'bb' => 'Barbados', + 'by' => 'Belarus', + 'be' => 'Belgium, Kingdom of', + 'bz' => 'Belize', + 'bj' => 'Benin, People\'s Republic of', + 'bm' => 'Bermuda', + 'bt' => 'Bhutan, Kingdom of', + 'bo' => 'Bolivia, Republic of', + 'ba' => 'Bosnia and Herzegovina', + 'bw' => 'Botswana, Republic of', + 'bv' => 'Bouvet Island (Bouvetoya)', + 'br' => 'Brazil, Federative Republic of', + 'io' => 'British Indian Ocean Territory (Chagos Archipelago)', + 'vg' => 'British Virgin Islands', + 'bn' => 'Brunei Darussalam', + 'bg' => 'Bulgaria, People\'s Republic of', + 'bf' => 'Burkina Faso', + 'bi' => 'Burundi, Republic of', + 'kh' => 'Cambodia, Kingdom of', + 'cm' => 'Cameroon, United Republic of', + 'ca' => 'Canada', + 'cv' => 'Cape Verde, Republic of', + 'ky' => 'Cayman Islands', + 'cf' => 'Central African Republic', + 'td' => 'Chad, Republic of', + 'cl' => 'Chile, Republic of', + 'cn' => 'China, People\'s Republic of', + 'cx' => 'Christmas Island', + 'cc' => 'Cocos (Keeling) Islands', + 'co' => 'Colombia, Republic of', + 'km' => 'Comoros, Federal and Islamic Republic of', + 'cd' => 'Congo, Democratic Republic of', + 'cg' => 'Congo, People\'s Republic of', + 'ck' => 'Cook Islands', + 'cr' => 'Costa Rica, Republic of', + 'ci' => 'Cote D\'Ivoire, Ivory Coast, Republic of the', + 'cu' => 'Cuba, Republic of', + 'cy' => 'Cyprus, Republic of', + 'cz' => 'Czech Republic', + 'dk' => 'Denmark, Kingdom of', + 'dj' => 'Djibouti, Republic of', + 'dm' => 'Dominica, Commonwealth of', + 'do' => 'Dominican Republic', + 'tl' => 'Timor-Leste', + 'ec' => 'Ecuador, Republic of', + 'eg' => 'Egypt, Arab Republic of', + 'sv' => 'El Salvador, Republic of', + 'gq' => 'Equatorial Guinea, Republic of', + 'er' => 'Eritrea', + 'ee' => 'Estonia', + 'et' => 'Ethiopia', + 'fo' => 'Faeroe Islands', + 'fk' => 'Falkland Islands (Malvinas)', + 'fj' => 'Fiji, Republic of the Fiji Islands', + 'fi' => 'Finland, Republic of', + 'fr' => 'France, French Republic', + 'gf' => 'French Guiana', + 'pf' => 'French Polynesia', + 'tf' => 'French Southern Territories', + 'ga' => 'Gabon, Gabonese Republic', + 'gm' => 'Gambia, Republic of the', + 'ge' => 'Georgia', + 'de' => 'Germany', + 'gh' => 'Ghana, Republic of', + 'gi' => 'Gibraltar', + 'gr' => 'Greece, Hellenic Republic', + 'gl' => 'Greenland', + 'gd' => 'Grenada', + 'gp' => 'Guadaloupe', + 'gu' => 'Guam', + 'gt' => 'Guatemala, Republic of', + 'gn' => 'Guinea, Revolutionary People\'s Rep\'c of', + 'gw' => 'Guinea-Bissau, Republic of', + 'gy' => 'Guyana, Republic of', + 'ht' => 'Haiti, Republic of', + 'hm' => 'Heard and McDonald Islands', + 'va' => 'Holy See (Vatican City State)', + 'hn' => 'Honduras, Republic of', + 'hk' => 'Hong Kong, Special Administrative Region of China', + 'hr' => 'Hrvatska (Croatia)', + 'hu' => 'Hungary, Hungarian People\'s Republic', + 'is' => 'Iceland, Republic of', + 'in' => 'India, Republic of', + 'id' => 'Indonesia, Republic of', + 'ir' => 'Iran, Islamic Republic of', + 'iq' => 'Iraq, Republic of', + 'ie' => 'Ireland', + 'il' => 'Israel, State of', + 'it' => 'Italy, Italian Republic', + 'jm' => 'Jamaica', + 'jp' => 'Japan', + 'jo' => 'Jordan, Hashemite Kingdom of', + 'kz' => 'Kazakhstan, Republic of', + 'ke' => 'Kenya, Republic of', + 'ki' => 'Kiribati, Republic of', + 'kp' => 'Korea, Democratic People\'s Republic of', + 'kr' => 'Korea, Republic of', + 'kw' => 'Kuwait, State of', + 'kg' => 'Kyrgyz Republic', + 'la' => 'Lao People\'s Democratic Republic', + 'lv' => 'Latvia', + 'lb' => 'Lebanon, Lebanese Republic', + 'ls' => 'Lesotho, Kingdom of', + 'lr' => 'Liberia, Republic of', + 'ly' => 'Libyan Arab Jamahiriya', + 'li' => 'Liechtenstein, Principality of', + 'lt' => 'Lithuania', + 'lu' => 'Luxembourg, Grand Duchy of', + 'mo' => 'Macao, Special Administrative Region of China', + 'mk' => 'Macedonia, the former Yugoslav Republic of', + 'mg' => 'Madagascar, Republic of', + 'mw' => 'Malawi, Republic of', + 'my' => 'Malaysia', + 'mv' => 'Maldives, Republic of', + 'ml' => 'Mali, Republic of', + 'mt' => 'Malta, Republic of', + 'mh' => 'Marshall Islands', + 'mq' => 'Martinique', + 'mr' => 'Mauritania, Islamic Republic of', + 'mu' => 'Mauritius', + 'yt' => 'Mayotte', + 'mx' => 'Mexico, United Mexican States', + 'fm' => 'Micronesia, Federated States of', + 'md' => 'Moldova, Republic of', + 'mc' => 'Monaco, Principality of', + 'mn' => 'Mongolia, Mongolian People\'s Republic', + 'ms' => 'Montserrat', + 'ma' => 'Morocco, Kingdom of', + 'mz' => 'Mozambique, People\'s Republic of', + 'mm' => 'Myanmar', + 'na' => 'Namibia', + 'nr' => 'Nauru, Republic of', + 'np' => 'Nepal, Kingdom of', + 'an' => 'Netherlands Antilles', + 'nl' => 'Netherlands, Kingdom of the', + 'nc' => 'New Caledonia', + 'nz' => 'New Zealand', + 'ni' => 'Nicaragua, Republic of', + 'ne' => 'Niger, Republic of the', + 'ng' => 'Nigeria, Federal Republic of', + 'nu' => 'Niue, Republic of', + 'nf' => 'Norfolk Island', + 'mp' => 'Northern Mariana Islands', + 'no' => 'Norway, Kingdom of', + 'om' => 'Oman, Sultanate of', + 'pk' => 'Pakistan, Islamic Republic of', + 'pw' => 'Palau', + 'ps' => 'Palestinian Territory, Occupied', + 'pa' => 'Panama, Republic of', + 'pg' => 'Papua New Guinea', + 'py' => 'Paraguay, Republic of', + 'pe' => 'Peru, Republic of', + 'ph' => 'Philippines, Republic of the', + 'pn' => 'Pitcairn Island', + 'pl' => 'Poland, Polish People\'s Republic', + 'pt' => 'Portugal, Portuguese Republic', + 'pr' => 'Puerto Rico', + 'qa' => 'Qatar, State of', + 're' => 'Reunion', + 'ro' => 'Romania, Socialist Republic of', + 'ru' => 'Russian Federation', + 'rw' => 'Rwanda, Rwandese Republic', + 'sh' => 'St. Helena', + 'kn' => 'St. Kitts and Nevis', + 'lc' => 'St. Lucia', + 'pm' => 'St. Pierre and Miquelon', + 'vc' => 'St. Vincent and the Grenadines', + 'ws' => 'Samoa, Independent State of', + 'sm' => 'San Marino, Republic of', + 'st' => 'Sao Tome and Principe, Democratic Republic of', + 'sa' => 'Saudi Arabia, Kingdom of', + 'sn' => 'Senegal, Republic of', + 'sc' => 'Seychelles, Republic of', + 'sl' => 'Sierra Leone, Republic of', + 'sg' => 'Singapore, Republic of', + 'sk' => 'Slovakia (Slovak Republic)', + 'si' => 'Slovenia', + 'sb' => 'Solomon Islands', + 'so' => 'Somalia, Somali Republic', + 'za' => 'South Africa, Republic of', + 'gs' => 'South Georgia and the South Sandwich Islands', + 'es' => 'Spain, Spanish State', + 'lk' => 'Sri Lanka, Democratic Socialist Republic of', + 'sd' => 'Sudan, Democratic Republic of the', + 'sr' => 'Suriname, Republic of', + 'sg' => 'Svalbard & Jan Mayen Islands', + 'sz' => 'Swaziland, Kingdom of', + 'se' => 'Sweden, Kingdom of', + 'ch' => 'Switzerland, Swiss Confederation', + 'sy' => 'Syrian Arab Republic', + 'tw' => 'Taiwan, Province of China', + 'tj' => 'Tajikistan', + 'tz' => 'Tanzania, United Republic of', + 'th' => 'Thailand, Kingdom of', + 'tg' => 'Togo, Togolese Republic', + 'tk' => 'Tokelau (Tokelau Islands)', + 'to' => 'Tonga, Kingdom of', + 'tt' => 'Trinidad and Tobago, Republic of', + 'tn' => 'Tunisia, Republic of', + 'tr' => 'Turkey, Republic of', + 'tm' => 'Turkmenistan', + 'tc' => 'Turks and Caicos Islands', + 'tv' => 'Tuvalu', + 'vi' => 'US Virgin Islands', + 'ug' => 'Uganda, Republic of', + 'ua' => 'Ukraine', + 'ae' => 'United Arab Emirates', + 'gb' => 'United Kingdom of Great Britain & N. Ireland', + 'um' => 'United States Minor Outlying Islands', + 'us' => 'United States of America', + 'uy' => 'Uruguay, Eastern Republic of', + 'uz' => 'Uzbekistan', + 'vu' => 'Vanuatu', + 've' => 'Venezuela, Bolivarian Republic of', + 'vn' => 'Viet Nam, Socialist Republic of', + 'wf' => 'Wallis and Futuna Islands', + 'eh' => 'Western Sahara', + 'ye' => 'Yemen', + 'yu' => 'Yugoslavia, Socialist Federal Republic of', + 'zm' => 'Zambia, Republic of', + 'zw' => 'Zimbabwe', + 'xx' => 'Unknown country' + ); +?> \ No newline at end of file diff --git a/html/includes/footer.php b/html/includes/footer.php new file mode 100755 index 0000000..0fd4f3f --- /dev/null +++ b/html/includes/footer.php @@ -0,0 +1,16 @@ +

+'; + +// Please leave this bit in, its the least you can do with all the work we have done :) + + echo' + + +
+ UTStats Beta 4.2.8 © 2005 azazel, AnthraX and toa
+ + +'; + +ob_end_flush(); \ No newline at end of file diff --git a/html/includes/ftp.php b/html/includes/ftp.php new file mode 100755 index 0000000..7e058a3 --- /dev/null +++ b/html/includes/ftp.php @@ -0,0 +1,411 @@ +PopError()) !== false) { + + $fctname = $err['fctname']; + + $msg = $err['msg']; + + $desc = $err['desc']; + + if($desc) $tmp=' ('.$desc.')'; else $tmp=''; + + if (strpos($msg, 'socket set') === 0) { + + $tmp .= "\nTry disabling the usage of sockets (set \$ftp_type = 'pure'; in config.php)"; + + } + + tablerow('Error details:', $fctname.': '.$msg.$tmp, true); + + } + + + +} + + + +function tablerow($left, $right, $error=false) { + + global $html, $ftp_debug; + + if ($ftp_debug) return; + + $space = ($html) ? ' ' : ' '; + + $left = (empty($left)) ? $space : (($html) ? htmlentities($left) : $left); + + $right = (empty($right)) ? $space : (($html) ? nl2br(htmlentities($right)) : $right); + + $style = ($error) ? 'style="background-color: red;"' : ''; + + if ($html) { + + echo ''; + + echo ''. $left .''; + + echo ''. $right .''; + + echo ''; + + } else { + + if (strlen($left) < 30) $left .= str_repeat(" ", 30 - strlen($left)); + + echo "$left $right\n"; + + } + + flush(); + +} + + + +function ftpupdate() + +{ + + global $html, $ftp, $ftp_uname, $ftp_upass, $ftp_hostname, $ftp_port, $g_ftp_error, $ftp_debug, + + $ftp_delete, $ftp_movedir, $ftp_dir, $ftp_passive, $import_log_start, $import_log_extension, + + $import_utdc_download_enable, $import_utdc_log_start, $import_utdc_log_extension, $import_utdc_screenshot_start, $import_utdc_screenshot_extension, + $import_ac_download_enable, $import_ac_log_start, $import_ac_log_extension, + $import_ace_download_enable, $import_ace_log_start, $import_ace_log_extension, $import_ace_screenshot_start, $import_ace_screenshot_extension; + + + + if (!$ftp_debug) { + + if ($html) echo''; + + } + + + + // Update, from here on were going to be doing multiple FTP sessions. + + for ($i = 0; $i < count($ftp_hostname); $i++) { + + if ($i != 0) { + + if ($html and !$ftp_debug) echo ''; + + echo "\n"; + + } + + + + tablerow('Connecting to server:', $ftp_hostname[$i] .':'. $ftp_port[$i]); + + if (!$ftp->SetServer($ftp_hostname[$i], $ftp_port[$i])) { + + ftp_error("Unable to set server: ". $ftp->lastmsg); $ftp->quit(true); continue; + + } + + if (!$ftp->connect()) { + + ftp_error("Unable to connect to server: ". $ftp->lastmsg); $ftp->quit(true); continue; + + } + + + + tablerow('', "Connected, now logging in..."); + + if (!$ftp->login($ftp_uname[$i], $ftp_upass[$i])) { + + ftp_error("Login failed!\nBad username/password?"); $ftp->quit(true); continue; + + } + + tablerow('', "Logged in!"); + + + + if (!$ftp->SetType(FTP_BINARY)) { + + ftp_error("Could not set type: ". $ftp->lastmsg); $ftp->quit(true); continue; + + } + + if (!isset($ftp_passive[$i]) or $ftp_passive[$i]) { + + tablerow("", "Setting passive mode"); + + if(!$ftp->Passive(true)) { + + ftp_error("Could not set passive mode: ". $ftp->lastmsg); $ftp->quit(true); continue; + + } + + } else { + + tablerow("", "Setting active mode"); + + if(!$ftp->Passive(false)) { + + ftp_error("Could not set active mode: ". $ftp->lastmsg); $ftp->quit(true); continue; + + } + + } + + if (($pwd = $ftp->pwd()) === false) { + + ftp_error("Unable to retrieve current working directory"); $ftp->quit(true); continue; + + } + + tablerow("Current directory is:", $pwd); + + + + $dl_start = time(); + + $dl_files = 0; + + $dl_bytes = 0; + + $error = false; + + foreach($ftp_dir[$i] as $dir) { + + if (!empty($dir)) { + + if (!$ftp->chdir($dir)) { + + ftp_error("Unable to change directory to: $dir"); $ftp->quit(true); continue; + + } + + tablerow('', "Changing directory to: $dir"); + + if (($pwd = $ftp->pwd()) === false) { + + ftp_error("Unable to retrieve current working directory"); $ftp->quit(true); continue; + + } + + tablerow("New directory is:", $pwd); + + } + + + + if (($filelist = $ftp->nlist()) === false) { + + ftp_error("Unable to retrieve file list"); continue; + + } + + + + tablerow("Directory contains:", count($filelist) ." ". ((count($filelist) == 1) ? 'file' : 'files')); + + if (count($filelist) == 0) { + + continue; + + } + + foreach ($filelist as $filename) { + + if (((substr($filename, 0, strlen($import_log_start)) == $import_log_start) and (substr($filename, strlen($filename) - strlen($import_log_extension)) == $import_log_extension)) + + or ($import_utdc_download_enable and (substr($filename, 0, strlen($import_utdc_log_start)) == $import_utdc_log_start) and (substr($filename, strlen($filename) - strlen($import_utdc_log_extension)) == $import_utdc_log_extension)) + + or ($import_utdc_download_enable and (substr($filename, 0, strlen($import_utdc_screenshot_start)) == $import_utdc_screenshot_start) and (substr($filename, strlen($filename) - strlen($import_utdc_screenshot_extension)) == $import_utdc_screenshot_extension)) + + or ($import_ac_download_enable and (substr($filename, 0, strlen($import_ac_log_start)) == $import_ac_log_start) and (substr($filename, strlen($filename) - strlen($import_ac_log_extension)) == $import_ac_log_extension)) + + or ($import_ace_download_enable and (substr($filename, 0, strlen($import_ace_log_start)) == $import_ace_log_start) and (substr($filename, strlen($filename) - strlen($import_ace_log_extension)) == $import_ace_log_extension)) + + or ($import_ace_download_enable and (substr($filename, 0, strlen($import_ace_screenshot_start)) == $import_ace_screenshot_start) and (substr($filename, strlen($filename) - strlen($import_ace_screenshot_extension)) == $import_ace_screenshot_extension))) { + } else { + continue; + } + + $size = $ftp->get($filename, 'logs/' . $filename); + + if ($size === FALSE) { + + $result = 'ERROR!'; + + $error = true; + + if (file_exists('logs/' . $filename)) { + unlink('logs/' . $filename); + } + + } else { + + $result = "OK (". number_format(round(($size / 1024), 0)) ." KB)"; + + $dl_files++; + + $dl_bytes += $size; + + } + + tablerow(($dl_files == 1) ? 'Downloading...' : '', "$filename -> $result"); + + if ((!isset($ftp_delete[$i]) or $ftp_delete[$i]) and !$error) { + $ftp->delete($filename); + } + else { + // rename the file to prevent reimporting + $ftp->rename($filename, "~" . $filename); + } + + } + + } + + $dl_kb = number_format(round(($dl_bytes / 1024), 0)); + + $dl_time = time() - $dl_start; + + tablerow("Downloaded:", "$dl_files ". ((count($filelist) == 1) ? 'file' : 'files') ." ($dl_kb KB) in $dl_time seconds"); + + + + if ($error) { + + ftp_error('There were errors when downoading (some) files!'); + + } + + + + tablerow("Disconnecting...", "done!"); + + $ftp->quit(true); + + } + + if (!$ftp_debug and $html) echo '
'; + + echo "FTP Transferring Log Files...\n"; + + if ($html) echo '

'; + + echo "\n\n"; + + + + //update timestamp + + + + if (!$g_ftp_error) { + + $file = fopen('includes/ftptimestamp.php', 'wb+', 1); + + fwrite($file, time()); + + fclose($file); + + } + +} + + + + + +$fname = 'includes/ftptimestamp.php'; + +$timestamp = 0; + + + +if(file_exists($fname)) + +{ + + $file = fopen($fname, 'rb'); + + $timestamp = trim(my_fgets($file)); + + fclose($file); + +} + + + +if(!$timestamp || (time() - $timestamp) > $ftp_interval*60) { + + if ($timestamp) { + + if ($html) echo '

'; + + echo "Last FTP update more than $ftp_interval minutes ago, starting update ($ftp_type): \n"; + + if ($html) echo '

'; + + } + + if ($ftp_debug) { + + if ($html) echo '
'; + + echo "FTP Debugging Output:\n"; + + if ($html) echo '
';
+
+	}
+
+	$ftp = new ftp($ftp_debug, $ftp_debug);
+
+	ftpupdate();
+
+	if ($ftp_debug and $html) echo '

'; + +} else { + + if ($html) echo '

'; + + echo "Last FTP update was ". round(((time() - $timestamp) / 60), 0) ." minutes ago, no update necessary\n"; + + if ($html) echo '

'; + +} + + + +?> \ No newline at end of file diff --git a/html/includes/ftp_class.php b/html/includes/ftp_class.php new file mode 100755 index 0000000..5281379 --- /dev/null +++ b/html/includes/ftp_class.php @@ -0,0 +1,492 @@ + +// http://www.phpclasses.org/browse/package/1743.html +// License: Free for non-commercial use +// + +if(!defined('CRLF')) define('CRLF',"\r\n"); +if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1); +if(!defined("FTP_BINARY")) define("FTP_BINARY", 1); +if(!defined("FTP_ASCII")) define("FTP_ASCII", 0); +if(!defined('FTP_FORCE')) define('FTP_FORCE', TRUE); +define('FTP_OS_Unix','u'); +define('FTP_OS_Windows','w'); +define('FTP_OS_Mac','m'); + +class ftp_base { + /* Public variables */ + var $LocalEcho=FALSE; + var $Verbose=FALSE; + var $OS_local; + var $lastmsg; + + /* Private variables */ + var $_lastaction=NULL; + var $_errors; + var $_type; + var $_umask; + var $_timeout; + var $_passive; + var $_host; + var $_fullhost; + var $_port; + var $_datahost; + var $_dataport; + var $_ftp_control_sock; + var $_ftp_data_sock; + var $_ftp_temp_sock; + var $_login; + var $_password; + var $_connected; + var $_ready; + var $_code; + var $_message; + var $_can_restore; + var $_port_available; + + var $_error_array=array(); + var $AuthorizedTransferMode=array( + FTP_AUTOASCII, + FTP_ASCII, + FTP_BINARY + ); + var $OS_FullName=array( + FTP_OS_Unix => 'UNIX', + FTP_OS_Windows => 'WINDOWS', + FTP_OS_Mac => 'MACOS' + ); + var $NewLineCode=array( + FTP_OS_Unix => "\n", + FTP_OS_Mac => "\r", + FTP_OS_Windows => "\r\n" + ); + var $AutoAsciiExt=array("ASP","BAT","C","CPP","CSV","H","HTM","HTML","SHTML","INI","LOG","PHP","PHP3","PL","PERL","SH","SQL","TXT"); + + /* Constructor */ + function ftp_base($port_mode=FALSE) { + $this->_port_available=($port_mode==TRUE); + $this->SendMSG("Staring FTP client class with".($this->_port_available?"":"out")." PORT mode support"); + $this->_connected=FALSE; + $this->_ready=FALSE; + $this->_can_restore=FALSE; + $this->_code=0; + $this->_message=""; + $this->SetUmask(0022); + $this->SetType(FTP_AUTOASCII); + $this->SetTimeout(30); + $this->Passive(!$this->_port_available); + $this->_login="anonymous"; + $this->_password="anon@ftp.com"; + $this->OS_local=FTP_OS_Unix; + if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows; + elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac; + } + +// +// +// + function parselisting($list) { +// Parses i line like: "drwxrwx--- 2 owner group 4096 Apr 23 14:57 text" + if(preg_match("/^([-ld])([rwxst-]+)\s+(\d+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\w{3})\s+(\d+)\s+([\:\d]+)\s+(.+)$/i", $list, $ret)) { + $v=array( + "type" => ($ret[1]=="-"?"f":$ret[1]), + "perms" => 0, + "inode" => $ret[3], + "owner" => $ret[4], + "group" => $ret[5], + "size" => $ret[6], + "date" => $ret[7]." ".$ret[8]." ".$ret[9], + "name" => $ret[10] + ); + $v["perms"]+=00400*(int)($ret[2]{0}=="r"); + $v["perms"]+=00200*(int)($ret[2]{1}=="w"); + $v["perms"]+=00100*(int)in_array($ret[2]{2}, array("x","s")); + $v["perms"]+=00040*(int)($ret[2]{3}=="r"); + $v["perms"]+=00020*(int)($ret[2]{4}=="w"); + $v["perms"]+=00010*(int)in_array($ret[2]{5}, array("x","s")); + $v["perms"]+=00004*(int)($ret[2]{6}=="r"); + $v["perms"]+=00002*(int)($ret[2]{7}=="w"); + $v["perms"]+=00001*(int)in_array($ret[2]{8}, array("x","t")); + $v["perms"]+=04000*(int)in_array($ret[2]{2}, array("S","s")); + $v["perms"]+=02000*(int)in_array($ret[2]{5}, array("S","s")); + $v["perms"]+=01000*(int)in_array($ret[2]{8}, array("T","t")); + } + return $v; + } + + function SendMSG($message = "", $crlf=true) { + $this->lastmsg = $message; + if ($this->Verbose) { + echo $message.($crlf?CRLF:""); + flush(); + } + return TRUE; + } + + function SetType($mode=FTP_AUTOASCII) { + if(!in_array($mode, $this->AuthorizedTransferMode)) { + $this->SendMSG("Wrong type"); + return FALSE; + } + $this->_type=$mode; + $this->SendMSG("Transfer type: ".($this->_type==FTP_BINARY?"binary":($this->_type==FTP_ASCII?"ASCII":"auto ASCII") ) ); + return TRUE; + } + + function Passive($pasv=NULL) { + if(is_null($pasv)) $this->_passive=!$this->_passive; + else $this->_passive=$pasv; + if(!$this->_port_available and !$this->_passive) { + $this->SendMSG("Only passive connections available!"); + $this->_passive=TRUE; + return FALSE; + } + $this->SendMSG("Passive mode ".($this->_passive?"on":"off")); + return TRUE; + } + + function SetServer($host, $port=21, $reconnect=true) { + global $ftp_debug; + if ($ftp_debug) { + $this->verbose=true; + $this->SendMSG("Connect to:
\n- Server: $host
\n- Port: $port
\n"); + $this->verbose=false; + } + $port = intval($port); + if(!is_long($port)) { + $this->verbose=true; + $this->SendMSG("Incorrect port syntax"); + return FALSE; + } else { + $ip=@gethostbyname($host); + $dns=@gethostbyaddr($host); + if(!$ip) $ip=$host; + if(!$dns) $dns=$host; + if(ip2long($ip) === -1) { + $this->SendMSG("Wrong host name/address \"".$host."\""); + return FALSE; + } + $this->_host=$ip; + $this->_fullhost=$dns; + $this->_port=$port; + $this->_dataport=$port-1; + } + $this->SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\""); + if($reconnect){ + if($this->_connected) { + $this->SendMSG("Reconnecting"); + if(!$this->quit(FTP_FORCE)) return FALSE; + if(!$this->connect()) return FALSE; + } + } + return TRUE; + } + + function SetUmask($umask=0022) { + $this->_umask=$umask; + umask($this->_umask); + $this->SendMSG("UMASK 0".decoct($this->_umask)); + return TRUE; + } + + function SetTimeout($timeout=30) { + $this->_timeout=$timeout; + $this->SendMSG("Timeout ".$this->_timeout); + if($this->_connected) + if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE; + return TRUE; + } + + function connect() { + $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]); + if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) { + $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\""); + return FALSE; + } + $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting."); + do { + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + $this->_lastaction=time(); + } while($this->_code<200); + $this->_ready=true; + return TRUE; + } + + function quit($force=false) { + if($this->_ready) { + if(!$this->_exec("QUIT") and !$force) return FALSE; + if(!$this->_checkCode() and !$force) return FALSE; + $this->_ready=false; + $this->SendMSG("Session finished"); + } + $this->_quit(); + return TRUE; + } + + function login($user=NULL, $pass=NULL) { + if(!is_null($user)) $this->_login=$user; + else $this->_login="anonymous"; + if(!is_null($pass)) $this->_password=$pass; + else $this->_password="anon@anon.com"; + if(!$this->_exec("USER ".$this->_login, "login")) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($this->_code!=230) { + if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE; + if(!$this->_checkCode()) return FALSE; + } + $this->SendMSG("Authentication succeeded"); + $this->_can_restore=$this->restore(100); + $this->SendMSG("This server can".($this->_can_restore?"":"'t")." resume broken uploads/downloads"); + return TRUE; + } + + function pwd() { + if(!$this->_exec("PWD", "pwd")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return ereg_replace("^[0-9]{3} \"(.+)\" .+".CRLF, "\\1", $this->_message); + } + + function cdup() { + if(!$this->_exec("CDUP", "cdup")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return true; + } + + function chdir($pathname) { + if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function rmdir($pathname) { + if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function mkdir($pathname) { + if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function rename($from, $to) { + if(!$this->_exec("RNFR ".$from, "rename")) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($this->_code==350) { + if(!$this->_exec("RNTO ".$to, "rename")) return FALSE; + if(!$this->_checkCode()) return FALSE; + } else return FALSE; + return TRUE; + } + + function filesize($pathname) { + if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + } + + function mdtm($pathname) { + if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE; + if(!$this->_checkCode()) return FALSE; + $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); + $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); + return $timestamp; + } + + function systype() { + if(!$this->_exec("SYST", "systype")) return FALSE; + if(!$this->_checkCode()) return FALSE; + $DATA = explode(" ", $this->_message); + return $DATA[1]; + } + + function delete($pathname) { + if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function site($command, $fnction="site") { + if(!$this->_exec("SITE ".$command, $fnction)) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function chmod($pathname, $mode) { + if(!$this->site("CHMOD ".decoct($mode)." ".$pathname, "chmod")) return FALSE; + return TRUE; + } + + function restore($from) { + if(!$this->_exec("REST ".$from, "resore")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return TRUE; + } + + function features() { + if(!$this->_exec("FEAT", "features")) return FALSE; + if(!$this->_checkCode()) return FALSE; + return preg_split("/[".CRLF."]+/", ereg_replace("[0-9]{3}[ -][^".CRLF."]*".CRLF, "", $this->_message), -1, PREG_SPLIT_NO_EMPTY); + } + + function rawlist($arg="", $pathname="") { + return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "LIST", "rawlist"); + } + + function nlist($arg="", $pathname="") { + return $this->_list(($arg?" ".$arg:"").($pathname?" ".$pathname:""), "NLST", "nlist"); + } + + function is_exists($pathname) + { + if (!($remote_list = $this->nlist("-a", dirname($pathname)))) { + $this->SendMSG("Error : Cannot get remote file list"); + return -1; + } + reset($remote_list); + while (list(,$value) = each($remote_list)) { + if ($value == basename($pathname)) { + $this->SendMSG("Remote file ".$pathname." exists"); + return TRUE; + } + } + $this->SendMSG("Remote file ".$pathname." does not exist"); + return FALSE; + } + + function get($remotefile, $localfile=NULL) { + if(is_null($localfile)) $localfile=$remotefile; + if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten"); + $fp = @fopen($localfile, "w"); + if (!$fp) { + $this->PushError("get","can't open local file", "Cannot create \"".$localfile."\""); + return FALSE; + } + $pi=pathinfo($remotefile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + fclose($fp); + return FALSE; + } + if($this->_can_restore) $this->restore(0); + if(!$this->_exec("RETR ".$remotefile, "get")) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + $out=$this->_data_read($mode, $fp); + fclose($fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $out; + } + + function put($localfile, $remotefile=NULL) { + if(is_null($remotefile)) $remotefile=$localfile; + if (!@file_exists($localfile)) { + $this->PushError("put","can't open local file", "No such file or directory \"".$localfile."\""); + return FALSE; + } + $fp = @fopen($localfile, "r"); + if (!$fp) { + $this->PushError("put","can't open local file", "Cannot read file \"".$localfile."\""); + return FALSE; + } + $pi=pathinfo($localfile); + if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII; + else $mode=FTP_BINARY; + if(!$this->_data_prepare($mode)) { + fclose($fp); + return FALSE; + } + if($this->_can_restore) $this->restore(0); + if(!$this->_exec("STOR ".$remotefile, "put")) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + fclose($fp); + return FALSE; + } + $ret=$this->_data_write($mode, $fp); + fclose($fp); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + return $ret; + } + +// +// +// + function _checkCode() { + return ($this->_code<400 and $this->_code>0); + } + + function _list($arg="", $cmd="LIST", $fnction="_list") { + if(!$this->_data_prepare()) return FALSE; + if(!$this->_exec($cmd.$arg, $fnction)) { + $this->_data_close(); + return FALSE; + } + if($this->_code == 450 and $cmd == "NLST") return(array()); + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $out=$this->_data_read(); + $this->_data_close(); + if(!$this->_readmsg()) return FALSE; + if(!$this->_checkCode()) return FALSE; + if($out === FALSE ) return FALSE; + $out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY); + $this->SendMSG(implode($this->NewLineCode[$this->OS_local], $out)); + return $out; + } + +// +// +// +// G�n�re une erreur pour traitement externe � la classe + function PushError($fctname,$msg,$desc=false){ + $error=array(); + $error['time']=time(); + $error['fctname']=$fctname; + $error['msg']=$msg; + $error['desc']=$desc; + if($desc) $tmp=' ('.$desc.')'; else $tmp=''; + $this->SendMSG($fctname.': '.$msg.$tmp); + return(array_push($this->_error_array,$error)); + } + +// R�cup�re une erreur externe + function PopError(){ + if(count($this->_error_array)) return(array_pop($this->_error_array)); + else return(false); + } +} + +if (isset($ftp_type) and $ftp_type == 'pure') { + require_once "ftp_class_pure.php"; +} else { + $mod_sockets=TRUE; + if (!extension_loaded('sockets')) { + $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : ''; + if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE; + } + require_once "ftp_class_".($mod_sockets?"sockets":"pure").".php"; +} +?> \ No newline at end of file diff --git a/html/includes/ftp_class_native.php b/html/includes/ftp_class_native.php new file mode 100755 index 0000000..4f7f1df --- /dev/null +++ b/html/includes/ftp_class_native.php @@ -0,0 +1,142 @@ +lastmsg = "Incorrect port syntax"; + return(false); + } else { + $ip=@gethostbyname($host); + $dns=@gethostbyaddr($host); + if(!$ip) $ip = $host; + if(!$dns) $dns = $host; + if(ip2long($ip) === -1) { + $this->lastmsg("Wrong host name/address \"".$host."\""); + return(false); + } + $this->host = $ip; + $this->fullhost = $dns; + $this->port = $port; + } + return(true); + } + + function connect() { + $php_erormsg = ''; + if (!check_extension('ftp') or true) { + $this->lastmsg = "No FTP support in this php build!"; + return(false); + } + $this->fp = @ftp_connect($this->host, $this->port, 30); + if (!$this->fp) { + $this->lastmsg = $php_errormsg; + return(false); + } + return(true); + } + + function login($user, $pass) { + $php_errormsg = ''; + if (!@ftp_login($this->fp, $user, $pass)) { + $this->lastmsg = $php_errormsg; + return(false); + } + return(true); + } + + function SetType($transfertype) { + $this->transfertype = $transfertype; + return(true); + } + + function Passive($pasv) { + $php_errormsg = ''; + if (!@ftp_pasv($this->fp, $pasv)) { + $this->lastmsg = $php_errormsg; + return(false); + } + return(true); + } + + function pwd() { + $php_errormsg = ''; + if (!($res = @ftp_pwd($this->fp))) { + $this->lastmsg = $php_errormsg; + return(false); + } + return($res); + } + + function chdir($dir) { + $php_errormsg = ''; + if (!@ftp_chdir($this->fp, $dir)) { + $this->lastmsg = $php_errormsg; + return(false); + } + return(true); + } + + function nlist() { + $php_errormsg = ''; + if (!($res = @ftp_nlist($this->fp, '.'))) { + $this->lastmsg = $php_errormsg; + return(false); + } + return($res); + } + + function get($remotefile, $localfile) { + $php_errormsg = ''; + if (!@ftp_get($this->fp, $localfile, $remotefile, $this->transfertype)) { + $this->lastmsg = $php_errormsg; + $this->PushError('get', "Unable to download $remotefile", $php_errormsg); + return(false); + } + return(filesize($localfile)); + } + + function delete($remotefile) { + $php_errormsg = ''; + if (!@ftp_delete($this->fp, $remotefile)) { + $this->lastmsg = $php_errormsg; + return(false); + } + return(true); + } + + + function quit() { + if ($this->fp) { + ftp_close($this->fp); + $this->fp = NULL; + } + return(true); + } + + + function PushError($fctname, $msg, $desc=false){ + $error=array(); + $error['time']=time(); + $error['fctname']=$fctname; + $error['msg']=$msg; + $error['desc']=$desc; + if($desc) $tmp=' ('.$desc.')'; else $tmp=''; + return(array_push($this->errors,$error)); + } + + function PopError(){ + if(count($this->errors)) return(array_pop($this->_error_array)); + else return(false); + } + + + +} diff --git a/html/includes/ftp_class_pure.php b/html/includes/ftp_class_pure.php new file mode 100755 index 0000000..e7806db --- /dev/null +++ b/html/includes/ftp_class_pure.php @@ -0,0 +1,192 @@ + +// http://www.phpclasses.org/browse/package/1743.html +// License: Free for non-commercial use +// + + +class ftp extends ftp_base { + function ftp($verb=FALSE, $le=FALSE) { + $this->LocalEcho = $le; + $this->Verbose = $verb; + $this->ftp_base(); + } + +// +// +// + + function _settimeout($sock) { + if(!@stream_set_timeout($sock, $this->_timeout)) { + $this->PushError('_settimeout','socket set send timeout'); + $this->_quit(); + return FALSE; + } + return TRUE; + } + + function _connect($host, $port) { + $this->SendMSG("NOT using PHP's socket extension"); + $this->SendMSG("Creating socket"); + $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); + if (!$sock) { + $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); + return FALSE; + } + $this->_connected=true; + return $sock; + } + + function _readmsg($fnction="_readmsg"){ + if(!$this->_connected) { + $this->PushError($fnction, 'Connect first'); + return FALSE; + } + $result=true; + $this->_message=""; + $this->_code=0; + $go=true; + do { + $tmp=@my_fgets($this->_ftp_control_sock, 512); + if($tmp===false) { + $go=$result=false; + $this->PushError($fnction,'Read failed'); + } else { + $this->_message.=$tmp; +// for($i=0; $i_message); $i++) +// if(ord($this->_message[$i])<32) echo "#".ord($this->_message[$i]); else echo $this->_message[$i]; +// echo CRLF; + if(preg_match("/^([0-9]{3})(-(.*".CRLF.")+\\1)? [^".CRLF."]+".CRLF."$/", $this->_message, $regs)) $go=false; + } + } while($go); + if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; + $this->_code=(int)$regs[1]; + return $result; + } + + function _exec($cmd, $fnction="_exec") { + if(!$this->_ready) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; + $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); + if($status===false) { + $this->PushError($fnction,'socket write failed'); + return FALSE; + } + $this->_lastaction=time(); + if(!$this->_readmsg($fnction)) return FALSE; + return TRUE; + } + + function _data_prepare($mode=FTP_ASCII) { + if($mode==FTP_BINARY) { + if(!$this->_exec("TYPE I", "_data_prepare")) return FALSE; + } else { + if(!$this->_exec("TYPE A", "_data_prepare")) return FALSE; + } + if($this->_passive) { + if(!$this->_exec("PASV", "pasv")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message)); + $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; + $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); + if(!$this->_ftp_data_sock) { + $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); + $this->_data_close(); + return FALSE; + } + else $this->_ftp_data_sock; + } else { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + return TRUE; + } + + function _data_read($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->NewLineCode[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + if($mode!=FTP_BINARY) { + while (!feof($this->_ftp_data_sock)) { + $tmp=fread($this->_ftp_data_sock, 4096); + $line.=$tmp; + if(!preg_match("/".CRLF."$/", $line)) continue; + $line=rtrim($line,CRLF).$NewLine; + if(is_resource($fp)) $out+=fwrite($fp, $line, strlen($line)); + else $out.=$line; + $line=""; + } + } else { + while (!feof($this->_ftp_data_sock)) { + $block=fread($this->_ftp_data_sock, 4096); + if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); + else $out.=$line; + } + } + return $out; + } + + function _data_write($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->NewLineCode[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Only passive connections available!"); + return FALSE; + } + if(is_resource($fp)) { + while(!feof($fp)) { + $line=my_fgets($fp, 4096); + if($mode!=FTP_BINARY) $line=rtrim($line, CRLF).CRLF; + do { + if(($res=@fwrite($this->_ftp_data_sock, $line))===FALSE) { + $this->PushError("_data_write","Can't write to socket"); + return FALSE; + } + $line=substr($line, $res); + }while($line!=""); + } + } else { + if($mode!=FTP_BINARY) $fp=rtrim($fp, $NewLine).CRLF; + do { + if(($res=@fwrite($this->_ftp_data_sock, $fp))===FALSE) { + $this->PushError("_data_write","Can't write to socket"); + return FALSE; + } + $fp=substr($fp, $res); + }while($fp!=""); + } + return TRUE; + } + + function _data_close() { + @fclose($this->_ftp_data_sock); + $this->SendMSG("Disconnected data from remote host"); + return TRUE; + } + + function _quit($force=FALSE) { + if($this->_connected or $force) { + @fclose($this->_ftp_control_sock); + $this->_connected=false; + $this->SendMSG("Socket closed"); + } + } +} +?> \ No newline at end of file diff --git a/html/includes/ftp_class_sockets.php b/html/includes/ftp_class_sockets.php new file mode 100755 index 0000000..8cfd27f --- /dev/null +++ b/html/includes/ftp_class_sockets.php @@ -0,0 +1,249 @@ + +// http://www.phpclasses.org/browse/package/1743.html +// License: Free for non-commercial use +// + + +class ftp extends ftp_base { + function ftp($verb=FALSE, $le=FALSE) { + $this->LocalEcho = $le; + $this->Verbose = $verb; + $this->ftp_base(TRUE); + } + +// +// +// + + function _settimeout($sock) { + if(!@socket_set_option($sock, 1, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { + $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + if(!@socket_set_option($sock, 1, SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { + $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + return true; + } + + function _connect($host, $port) { + $this->SendMSG("Using PHP's socket extension"); + $this->SendMSG("Creating socket"); + $sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + if ($sock < 0) { + $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); + return FALSE; + } + if(!$this->_settimeout($sock)) return FALSE; + $this->SendMSG("Connecting to \"".$host.":".$port."\""); + if (!($res = @socket_connect($sock, $host, $port))) { + $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); + @socket_close($sock); + return FALSE; + } + $this->_connected=true; + return $sock; + } + + function _readmsg($fnction="_readmsg"){ + if(!$this->_connected) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + $result=true; + $this->_message=""; + $this->_code=0; + $go=true; + do { + $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); + if($tmp===false) { + $go=$result=false; + $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); + } elseif($tmp=="") $go=false; + else { + $this->_message.=$tmp; +// for($i=0; $i_message); $i++) +// if(ord($this->_message[$i])<32) echo "#".ord($this->_message[$i]); else echo $this->_message[$i]; +// echo CRLF; + if(preg_match("/^([0-9]{3})(-(.*".CRLF.")+\\1)? [^".CRLF."]+".CRLF."$/", $this->_message, $regs)) $go=false; + } + } while($go); + if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; + $this->_code=(int)$regs[1]; + return $result; + } + + function _exec($cmd, $fnction="_exec") { + if(!$this->_ready) { + $this->PushError($fnction,'Connect first'); + return FALSE; + } + if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; + $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); + if($status===false) { + $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); + return FALSE; + } + $this->_lastaction=time(); + if(!$this->_readmsg($fnction)) return FALSE; + return TRUE; + } + + function _data_prepare($mode=FTP_ASCII) { + if($mode==FTP_BINARY) { + if(!$this->_exec("TYPE I", "_data_prepare")) return FALSE; + } else { + if(!$this->_exec("TYPE A", "_data_prepare")) return FALSE; + } + $this->SendMSG("Creating data socket"); + $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + if ($this->_ftp_data_sock < 0) { + $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock))); + return FALSE; + } + if(!$this->_settimeout($this->_ftp_data_sock)) { + $this->_data_close(); + return FALSE; + } + if($this->_passive) { + if(!$this->_exec("PASV", "pasv")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + $ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message)); + $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; + $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { + $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + else $this->_ftp_temp_sock=$this->_ftp_data_sock; + } else { + if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { + $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_bind($this->_ftp_data_sock,$addr)){ + $this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_listen($this->_ftp_data_sock)) { + $this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { + $this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); + $this->_data_close(); + return FALSE; + } + if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) { + $this->_data_close(); + return FALSE; + } + if(!$this->_checkCode()) { + $this->_data_close(); + return FALSE; + } + } + return TRUE; + } + + function _data_read($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->NewLineCode[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); + if($this->_ftp_temp_sock===FALSE) { + $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + $this->_data_close(); + return FALSE; + } + } + if($mode!=FTP_BINARY) { + while(($tmp=@socket_read($this->_ftp_temp_sock, 8192, PHP_NORMAL_READ))!==false) { + $line.=$tmp; + if(!preg_match("/".CRLF."$/", $line)) continue; + $line=rtrim($line,CRLF).$NewLine; + if(is_resource($fp)) $out+=fwrite($fp, $line, strlen($line)); + else $out.=$line; + $line=""; + } + } else { + while($block=@socket_read($this->_ftp_temp_sock, 8192, PHP_BINARY_READ)) { + if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); + else $out.=$line; + } + } + return $out; + } + + function _data_write($mode=FTP_ASCII, $fp=NULL) { + $NewLine=$this->NewLineCode[$this->OS_local]; + if(is_resource($fp)) $out=0; + else $out=""; + if(!$this->_passive) { + $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); + $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); + if($this->_ftp_temp_sock===FALSE) { + $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + $this->_data_close(); + return FALSE; + } + } + if(is_resource($fp)) { + while(!feof($fp)) { + $line=my_fgets($fp, 4096); + if($mode!=FTP_BINARY) $line=rtrim($line, CRLF).CRLF; + do { + if(($res=@socket_write($this->_ftp_temp_sock, $line))===FALSE) { + $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + return FALSE; + } + $line=substr($line, $res); + }while($line!=""); + } + } else { + if($mode!=FTP_BINARY) $fp=rtrim($fp, $NewLine).CRLF; + do { + if(($res=@socket_write($this->_ftp_temp_sock, $fp))===FALSE) { + $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); + return FALSE; + } + $fp=substr($fp, $res); + }while($fp!=""); + } + return TRUE; + } + + function _data_close() { + @socket_close($this->_ftp_temp_sock); + @socket_close($this->_ftp_data_sock); + $this->SendMSG("Disconnected data from remote host"); + return TRUE; + } + + function _quit() { + if($this->_connected) { + @socket_close($this->_ftp_control_sock); + $this->_connected=false; + $this->SendMSG("Socket closed"); + } + } +} +?> \ No newline at end of file diff --git a/html/includes/ftptimestamp.php b/html/includes/ftptimestamp.php new file mode 100755 index 0000000..5b6994a --- /dev/null +++ b/html/includes/ftptimestamp.php @@ -0,0 +1 @@ +1112804209 \ No newline at end of file diff --git a/html/includes/functions.php b/html/includes/functions.php new file mode 100755 index 0000000..1975914 --- /dev/null +++ b/html/includes/functions.php @@ -0,0 +1,605 @@ +=")) ? true : false; + + if ($use_fgets and $compression == 'none') { + if ($length == -1) { + return(fgets($fp)); + } else { + return(fgets($fp, $length)); + } + } + + $buffer = ''; + $i = 0; + while(!feof($fp)) { + if ($length != -1 and $i >= $length) break; + $i++; + switch($compression) { + case 'bz2': $char = bzread($fp, 1); break; + case 'zlib': $char = gzread($fp, 1); break; + default: $char = fread($fp, 1); + } + $buffer .= $char; + if ($char == "\n") break; + } + if (empty($buffer) and feof($fp)) return(false); + return($buffer); +} + +function my_fopen($filename, $mode, &$compression) { + if ($compression === NULL) { + $compression = 'none'; + if (substr($filename, -4) == '.bz2') { + if (check_extension('bz2')) { + $compression = 'bz2'; + } else { + return(false); + } + } + if (substr($filename, -3) == '.gz') { + if (check_extension('zlib')) { + $compression = 'zlib'; + } else { + return(false); + } + } + } + + switch($compression) { + case 'bz2': $fp = @bzopen($filename, $mode); break; + case 'zlib': $fp = @gzopen($filename, $mode); break; + default: $fp = @fopen($filename, $mode); break; + } + 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"; + $q_small = mysql_query($sql_small) or die(mysql_error()); + $r_small = mysql_fetch_array($q_small); + return $r_small; +} + +// Small query count +function small_count($query) { + $sql_small = "$query"; + $q_small = mysql_query($sql_small) or die(mysql_error()); + $r_small = mysql_num_rows($q_small); + return $r_small; +} + +// 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)}; + } + + return $str; +} + +function zero_out($data) { + if (!is_array($data)) return($data); + foreach($data as $key => $value) { + if ($value == '0') $data[$key] = ''; + } + return($data); +} + +function get_dp($number) { + $dp = number_format($number, 2, '.', ''); + return ($dp); +} + +function sec2min($number) { + $dp = $number/60; + + $dp = number_format($dp, 2, '.', ''); + return ($dp); +} + +function sec2hour($number) { + $dp = $number/3600; + + $dp = number_format($dp, 2, '.', ''); + return ($dp); +} + +function un_ut($name) { + $gname = str_replace("Botpack.", "", "$name"); + $gname = str_replace("Class ", "", "$gname"); + $gname = str_replace("CTFGame", "Capture The Flag", "$gname"); + $gname = str_replace(".unr", "", "$gname"); + return ($gname); +} + +function mtimestamp($date) { + $hour = substr($date, 8, 2); + $minute = substr($date, 10, 2); + $second = 00; + $day = substr($date, 6, 2); + $month = substr($date, 4, 2); + $year = substr($date, 0, 4); + + return(mktime($hour,$minute,$second,$month,$day,$year)); +} + +function mdate($date) { + + $ourdate = date('D, M j Y \a\t g:i a', mtimestamp($date)); + return ($ourdate); +} + +function mdate2($date) { + $hour = substr("$date", 8, 2); + $minute = substr("$date", 10, 2); + $second = "00"; + $day = substr("$date", 6, 2); + $month = substr("$date", 4, 2); + $year = substr("$date", 0, 4); + + $ourdate = mktime($hour,$minute,$second,$month,$day,$year); + + $ourdate = date('Y-m-d g:i a', $ourdate); + return ($ourdate); +} + +function utdate($gametime) { + $year = substr("$gametime", 0, 4); + $month = substr("$gametime", 5, 2); + $day = substr("$gametime", 8, 2); + $hour = substr("$gametime", 11, 2); + $minute = substr("$gametime", 14, 2); + $second = substr("$gametime", 17, 2); + + $gametime = $year . $month . $day . $hour . $minute . $second; + return ($gametime); +} + +function btcaptime($time) { + if (empty($time)) { + return; + } + if ($time < 0) { + return "-:--"; + } + $minutes = intval($time / 60); + $seconds = intval($time % 60); + $hundreds = substr($time, -2, 2); + if (substr($hundreds, 0, 1) == '.') { + $hundreds = substr($hundreds, 1, 1) . 0; + } + if ((substr($hundreds, 1, 1) == '.') or (!preg_match("/\./", $time))) { + $hundreds = "00"; + } + if ($seconds < 10) { + $seconds = "0" . $seconds; + } + return $minutes . ":" . $seconds . ":" . $hundreds; +} + +// UT Server Query Functions +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; +} + +function GetMinutes($seconds) +{ + $timemins = intval($seconds / 60); + $timesecs = ($seconds % 60); + + $Reqlength = 2; //Amount of digits we need + if ($Reqlength-strlen($timemins) > 0) $timemins = str_repeat("0",($Reqlength-strlen($timemins))) . $timemins; + if ($Reqlength-strlen($timesecs) > 0) $timesecs = str_repeat("0",($Reqlength-strlen($timesecs))) . $timesecs; + return $timemins . ":" . $timesecs; +} + + +function FlagImage($country, $mini = true) { + global $a_countries; + $width = ($mini) ? 15 : 18; + $height = ($mini) ? 10 : 12; + if (empty($country)) return(''); + if (!file_exists("images/flags/$country.png")) return(''); //18*12 + $countryname = (isset($a_countries[$country])) ? $a_countries[$country] : ''; + return(''. $country .''); +} + + +function RankMovement($diff) { + $diff = round($diff, 2); + if ($diff == 0) { + $chimg = 'same'; + $chtext = "ranking not affected"; + } + if ($diff > 0) { + $chimg = 'up'; + $chtext = "gained ". get_dp($diff) ." ranking points"; + } + if ($diff < 0) { + $chimg = 'down'; + $chtext = "lost ". get_dp($diff * -1) ." ranking points"; + } + $moveimg = ''; + if (file_exists("images/ranks/$chimg.png")) { + $infos = getimagesize("images/ranks/$chimg.png"); + $width = $infos[0]; + $height = $infos[1]; + $moveimg = ''; + } + return($moveimg); +} + + +function ordinal($number) { + + // when fed a number, adds the English ordinal suffix. Works for any + // number, even negatives + + if ($number % 100 > 10 && $number %100 < 14): + $suffix = "th"; + else: + switch($number % 10) { + + case 0: + $suffix = "th"; + break; + + case 1: + $suffix = "st"; + break; + + case 2: + $suffix = "nd"; + break; + + case 3: + $suffix = "rd"; + break; + + default: + $suffix = "th"; + break; + } + + endif; + + return $suffix; +} + + +function RankImageOrText($pid, $name, $rank, $gid, $gamename, $mini = true, $format = NULL, $rankchange = NULL) { + + $points = 0; + if (empty($rank)) { + $r_rank = small_query("SELECT rank FROM uts_rank WHERE pid = '$pid' AND gid= '$gid';"); + if (!$r_rank) return(''); + $points = get_dp($r_rank['rank']); + $r_no = small_query("SELECT (COUNT(*) + 1) AS no FROM uts_rank WHERE gid = '$gid' and rank > ${points}9"); + $rank = $r_no['no']; + } + + $ranktext = $rank.ordinal($rank); + if (file_exists("images/ranks/$rank.png")) { + $width = ($mini) ? 14 : 16; + $height = ($mini) ? 10 : 13; + $img = ''. $rank .''; + } else { + $img = ''; + } + $moveimg = ''; + if ($rankchange !== NULL) { + $moveimg = ' '. RankMovement($rankchange); + } + + + if (empty($format)) { + if ($img) { + return($img.$moveimg); + } else { + return('('.$ranktext.$moveimg.')'); + } + } + $imageortext = ($img) ? $img : $ranktext; + $search = array('%RT%', '%RN%', '%RP%', '%RI%', '%GN%', '%PN%', '%IT%'); + $replace = array($ranktext, $rank, $points, $img, $gamename, $name, $imageortext); + return(str_replace($search, $replace, $format)); +} + + +function FormatPlayerName($country, $pid, $name, $gid = NULL, $gamename = NULL, $mini = true, $rankchange = NULL) { + static $cache = array(); + + if (isset($cache[$pid])) return($cache[$pid]); + + $ranktext = false; + if (!empty($gamename) and $pid !== NULL) { + $ranktext = RankImageOrText($pid, $name, 0, $gid, $gamename, $mini, NULL, $rankchange); + } + $ret = ''; + if (!empty($country)) $ret .= FlagImage($country, $mini) ." "; + $ret .= htmlentities($name); + if ($ranktext) $ret .= " " . $ranktext; + $cache[$pid] = $ret; + return($ret); +} + +function QuoteHintText($text) { + $search = array('\\', '\'', '(', ')'); + $replace = array('\\\\', '\\\'', '\\(', '\\)'); + 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(''); + if ($text === NULL) $text = $hint[$name]['text']; + if ($caption === NULL and isset($hint[$name]['caption'])) $caption = $hint[$name]['caption']; + $rv = 'onmouseover="return overlib(\''. QuoteHintText($text) .'\''; + if ($caption !== NULL) $rv .= ', CAPTION, \''. QuoteHintText($caption) .'\''; + $rv .= ');" '; + $rv .= 'onmouseout="return nd();"'; + return($rv); +} + +function debug_output($desc, $data) { + echo '
';
+	echo $desc .": ";
+
+	$len = strlen($data);
+	for ($i = 0; $i < $len; $i++) {
+		echo substr($data, $i, 1) .'  ';
+	}
+	echo "\n";
+	echo str_repeat(' ', (strlen($desc) + 2));
+	for ($i = 0; $i < $len; $i++) {
+		echo ord(substr($data, $i, 1)) .' ';
+	}
+	echo "
"; +} + +function check_extension($name) { + if (extension_loaded($name)) return(true); + if( !(bool)ini_get("enable_dl") or (bool)ini_get( "safe_mode" )) return(false); + $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : ''; + return(@dl($prefix . $name . PHP_SHLIB_SUFFIX)); +} + + +function compress_file($method, $in, $out, $stripx00) { + if ((!file_exists($out) and !is_writeable(dirname($out))) or (file_exists($out) and !is_writable($out))) return(false); + $blocksize = 8192; + + switch($method) { + case 'bz2': $suffix = '.bz2'; break; + case 'zlib': $suffix = '.gz'; break; + case 'none': $suffix = ''; break; + default: return(false); + } + + if (substr($out, strlen($out) - strlen($suffix)) != $suffix) $out .= $suffix; + + $fp_in = fopen($in, 'rb'); + if (!$fp_in) return(false); + switch($method) { + case 'bz2': $fp_out = @bzopen($out, 'wb'); break; + case 'zlib': $fp_out = @gzopen($out, 'wb6'); break; + case 'none': $fp_out = @fopen($out, 'wb'); break; + } + if (!$fp_out) return(false); + + while (!feof($fp_in)) { + $buffer = @fread($fp_in, $blocksize); + if ($buffer === false) return(false); + if ($stripx00) $buffer = preg_replace('/[\x00]/', '', $buffer); + switch($method) { + case 'bz2': $bytes = @bzwrite($fp_out, $buffer, strlen($buffer)); break; + case 'zlib': $bytes = @gzwrite($fp_out, $buffer, strlen($buffer)); break; + case 'none': $bytes = @fwrite($fp_out, $buffer, strlen($buffer)); break; + } + if ($bytes === false) return(false); + } + + + @fclose($fp_in); + switch($method) { + case 'bz2': @bzclose($fp_out); break; + case 'zlib': @gzclose($fp_out); break; + case 'none': @fclose($fp_out); break; + } + return(true); +} + +function backup_logfile($method, $filename, $backupfilename, $stripx00) { + switch($method) { + case 'compress': + if (!check_extension('bz2') or !compress_file('bz2', $filename, $backupfilename, $stripx00)) { + return(backup_logfile('gzip', $filename, $backupfilename, $stripx00)); + } + return('Succeeded (bz2)'); + break; + + case 'gzip': + if (!check_extension('zlib') or !compress_file('zlib', $filename, $backupfilename, $stripx00)) { + return(backup_logfile('yes', $filename, $backupfilename, $stripx00)); + } + return('Succeeded (gzip)'); + break; + + case 'no': + return('NO (disabled in config)'); + break; + + default: + if ($stripx00) { + if (compress_file('none', $filename, $backupfilename, $stripx00)) { + return('Succeeded (uncompressed)'); + } else { + return('FAILED' . (!empty($php_errormsg) ? ': '. $php_errormsg : '')); + } + } + if (@copy($filename, $backupfilename)) { + return('Succeeded (uncompressed)'); + } else { + return('FAILED' . (!empty($php_errormsg) ? ': '. $php_errormsg : '')); + } + } +} + +function purge_backups($dir, $maxage) { + if (empty($maxage) or rand(0, 5) != 0) return(NULL); + + // $maxage is days but we need seconds + $maxage = $maxage * 86400; + $deleted = 0; + + $dh = opendir($dir); + while (false !== ($filename = readdir($dh))) { + if ($filename == '.htaccess' or $filename == 'index.htm') continue; + $cna = $dir .'/'. $filename; + if (@is_file($cna) and (@filemtime($cna) + $maxage) < time()) { + unlink($cna); + $deleted++; + } + + } + closedir($dh); + + 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. + for ($i = 0; $filesize > 1024; $i++) $filesize /= 1024; + $file_size_info['size'] = ceil($filesize); + $file_size_info['type'] = $bytes[$i]; + return $file_size_info; +} + +function GetCurrentWatchlist() { + if (!isset($_COOKIE['uts_watchlist'])) return(array()); + $watchlist = @explode(',', $_COOKIE['uts_watchlist']); + if (!$watchlist or !is_array($watchlist)) return(array()); + foreach($watchlist as $key => $value) { + $watchlist[$key] = addslashes($value); + } + return($watchlist); +} + +function PlayerOnWatchlist($pid) { + $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]); + $status = 0; + } else { + $watchlist[] = $pid; + $status = 1; + } + setcookie('uts_watchlist', implode(',',$watchlist), time()+60*60*24*30*365*5); + return($status); +} + +function DeBugMessage($message) { + global $debug, $html; + if(!$debug) { + return; + } + + if ($html) echo '
'; + echo "Debugging Output:\n"; + if ($html) echo '
';
+	echo $message . "\n";
+	if ($html) echo '


'; +} + +?> diff --git a/html/includes/functions_admin.php b/html/includes/functions_admin.php new file mode 100755 index 0000000..b4a788b --- /dev/null +++ b/html/includes/functions_admin.php @@ -0,0 +1,332 @@ +', $valtmp2); + $values[$valtmp3[0]] = $valtmp3[1]; + } + } + if (isset($_REQUEST['submit']) and isset($_REQUEST['cur_var'])) { + $values[$_REQUEST['cur_var']] = $_REQUEST[$_REQUEST['cur_var']]; + unset($_REQUEST[$_REQUEST['cur_var']]); + if (isset($options['vars'][$i - 1]['exitif']) and $options['vars'][$i - 1]['exitif'] == $values[$_REQUEST['cur_var']]) $i = $maxsteps; + } + if ($i == $maxsteps) return($values); + echo ' + + + +
'.htmlentities($options['title']).'
Step '.$step.' of '.$maxsteps.'

'; + if ($step != $maxsteps and !isset($options['vars'][$i])) die("Something went wrong :("); + + echo '
'; + + echo ''; + if ($step == $maxsteps) { + echo ''; + } + + foreach($options['vars'] as $num => $var) { + if ((!isset($values[$var['name']]) and $num != $i) or $num > $i) continue; + echo ''; + + echo ''; + } + + $valstr = ''; + foreach($values as $key => $value) { + if (empty($key)) continue; + if (!empty($valstr)) $valstr .= ','; + $valstr .= "$key=>$value"; + } + + + $_REQUEST['step'] = ''; + $_REQUEST['values'] = ''; + foreach($_REQUEST as $key => $value) { + if (isset($_COOKIE[$key])) continue; + switch($key){ + case 'step': + $value = $step; break; + case 'values': + $value = $valstr; break; + case 'submit': + case 'back': + case 'cur_var': + case 'playerfilter': + case 'noop': + continue 2; + } + echo ''; + } + + echo ''; + $caption = ($step == $maxsteps) ? 'Finish' : 'Next >>'; + echo ''; + + echo '
Please Confirm!
'; + + if ($num == $i or !isset($var['caption'])) { + echo htmlentities($var['prompt']); + } else { + echo htmlentities($var['caption']); + } + + echo ''; + if ($num != $i) { + if (isset($var['extraoption']) and $values[$var['name']] == $var['extraoption']) { + echo htmlentities($values[$var['name']]); + } else { + switch($var['type']) { + case 'game': + $r_game = small_query("SELECT gamename, name FROM uts_games WHERE id = '". $values[$var['name']] ."'"); + echo htmlentities($r_game['name']) .' ('. htmlentities($r_game['gamename']) .')'; + break; + case 'server': + $r_server = small_query("SELECT servername, serverip FROM uts_match WHERE id = '". $values[$var['name']] ."'"); + echo htmlentities($r_server['servername']) .' ('. $r_server['serverip'] .')'; + break; + case 'player': + $r_player = small_query("SELECT name FROM uts_pinfo WHERE id = '". $values[$var['name']] ."'"); + echo htmlentities($r_player['name']); + break; + case 'match': + $r_match = small_query("SELECT id, time, serverip, mapfile FROM uts_match WHERE id = '". $values[$var['name']] ."'"); + echo htmlentities($r_match['id'].': '.mdate2($r_match['time']).' ('.un_ut($r_match['mapfile']).' on '.$r_match['serverip'].')'); + break; + case 'static': + case 'text': + echo htmlentities($values[$var['name']]); + break; + default: + echo 'Show: Don\'tknow what to do with type '. $var['type']; + } + } + } else { + if (isset($var['initialvalue']) and isset($values[$var['initialvalue']])) $values[$var['name']] = $values[$var['initialvalue']]; + echo ''; + switch($var['type']) { + case 'game': + echo ''; + break; + + + case 'server': + echo ''; + break; + + case 'player': + echo ''; + echo '    '; + echo 'Filter: '; + echo ' '; + break; + + case 'match': + echo ''; + break; + + case 'static': + echo ''; + break; + + case 'text': + $pval = (isset($values[$var['name']])) ? $values[$var['name']] : ''; + echo ''; + break; + + + default: + echo 'Select: Don\'tknow what to do with type '. $var['type']; + } + } + echo '
'; + if ($step != 1) echo ''; + echo '
'; + + + echo '
'; + require('includes/footer.php'); + exit; +} + + +?> \ No newline at end of file diff --git a/html/includes/geoip.inc b/html/includes/geoip.inc new file mode 100755 index 0000000..a095469 --- /dev/null +++ b/html/includes/geoip.inc @@ -0,0 +1,498 @@ + 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5, +"AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "AN" => 10, "AO" => 11, +"AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17, +"AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23, +"BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29, +"BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35, +"BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41, +"CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47, +"CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53, +"CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59, +"DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65, +"ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71, +"FM" => 72, "FO" => 73, "FR" => 74, "FX" => 75, "GA" => 76, "GB" => 77, +"GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83, +"GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89, +"GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95, +"HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101, +"IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107, +"IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113, +"KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119, +"KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125, +"LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131, +"LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137, +"MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143, +"MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149, +"MV" => 150, "MW" => 151, "MX" => 152, "MY" => 153, "MZ" => 154, "NA" => 155, +"NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161, +"NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167, +"PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173, +"PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179, +"PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185, +"RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191, +"SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197, +"SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203, +"SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209, +"TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215, +"TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221, +"UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227, +"VA" => 228, "VC" => 229, "VE" => 230, "VG" => 231, "VI" => 232, "VN" => 233, +"VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239, +"ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245, +"O1" => 246, "AX" => 247, "GG" => 248, "IM" => 249, "JE" => 250 +); + var $GEOIP_COUNTRY_CODES = array( +"", "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", +"AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", +"BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", +"CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", +"CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", +"EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB", +"GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", +"GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", +"IO", "IQ", "IR", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", +"KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", +"LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", +"MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", +"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", +"PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", +"QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", +"SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", +"TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO", "TL", "TR", "TT", "TV", "TW", +"TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", +"VU", "WF", "WS", "YE", "YT", "RS", "ZA", "ZM", "ME", "ZW", "A1", "A2", "O1", +"AX", "GG", "IM", "JE" +); + var $GEOIP_COUNTRY_CODES3 = array( +"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","AQ","ARG", +"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI", +"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BV","BWA","BLR","BLZ","CAN","CC", +"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV", +"CX","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH", +"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD", +"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","GS","GTM","GUM", +"GNB","GUY","HKG","HM","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IO", +"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA", +"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", +"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC", +"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL", +"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER", +"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT", +"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM", +"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","TF", +"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA", +"UKR","UGA","UM","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT", +"WLF","WSM","YEM","YT","SRB","ZAF","ZMB","MNE","ZWE","A1","A2","O1", +"ALA","GGY","IMN","JEY" + ); + var $GEOIP_COUNTRY_NAMES = array( +"", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates", +"Afghanistan", "Antigua and Barbuda", "Anguilla", "Albania", "Armenia", +"Netherlands Antilles", "Angola", "Antarctica", "Argentina", "American Samoa", +"Austria", "Australia", "Aruba", "Azerbaijan", "Bosnia and Herzegovina", +"Barbados", "Bangladesh", "Belgium", "Burkina Faso", "Bulgaria", "Bahrain", +"Burundi", "Benin", "Bermuda", "Brunei Darussalam", "Bolivia", "Brazil", +"Bahamas", "Bhutan", "Bouvet Island", "Botswana", "Belarus", "Belize", +"Canada", "Cocos (Keeling) Islands", "Congo, The Democratic Republic of the", +"Central African Republic", "Congo", "Switzerland", "Cote D'Ivoire", "Cook +Islands", "Chile", "Cameroon", "China", "Colombia", "Costa Rica", "Cuba", "Cape +Verde", "Christmas Island", "Cyprus", "Czech Republic", "Germany", "Djibouti", +"Denmark", "Dominica", "Dominican Republic", "Algeria", "Ecuador", "Estonia", +"Egypt", "Western Sahara", "Eritrea", "Spain", "Ethiopia", "Finland", "Fiji", +"Falkland Islands (Malvinas)", "Micronesia, Federated States of", "Faroe +Islands", "France", "France, Metropolitan", "Gabon", "United Kingdom", +"Grenada", "Georgia", "French Guiana", "Ghana", "Gibraltar", "Greenland", +"Gambia", "Guinea", "Guadeloupe", "Equatorial Guinea", "Greece", "South Georgia +and the South Sandwich Islands", "Guatemala", "Guam", "Guinea-Bissau", +"Guyana", "Hong Kong", "Heard Island and McDonald Islands", "Honduras", +"Croatia", "Haiti", "Hungary", "Indonesia", "Ireland", "Israel", "India", +"British Indian Ocean Territory", "Iraq", "Iran, Islamic Republic of", +"Iceland", "Italy", "Jamaica", "Jordan", "Japan", "Kenya", "Kyrgyzstan", +"Cambodia", "Kiribati", "Comoros", "Saint Kitts and Nevis", "Korea, Democratic +People's Republic of", "Korea, Republic of", "Kuwait", "Cayman Islands", +"Kazakstan", "Lao People's Democratic Republic", "Lebanon", "Saint Lucia", +"Liechtenstein", "Sri Lanka", "Liberia", "Lesotho", "Lithuania", "Luxembourg", +"Latvia", "Libyan Arab Jamahiriya", "Morocco", "Monaco", "Moldova, Republic +of", "Madagascar", "Marshall Islands", "Macedonia", +"Mali", "Myanmar", "Mongolia", "Macau", "Northern Mariana Islands", +"Martinique", "Mauritania", "Montserrat", "Malta", "Mauritius", "Maldives", +"Malawi", "Mexico", "Malaysia", "Mozambique", "Namibia", "New Caledonia", +"Niger", "Norfolk Island", "Nigeria", "Nicaragua", "Netherlands", "Norway", +"Nepal", "Nauru", "Niue", "New Zealand", "Oman", "Panama", "Peru", "French +Polynesia", "Papua New Guinea", "Philippines", "Pakistan", "Poland", "Saint +Pierre and Miquelon", "Pitcairn Islands", "Puerto Rico", "Palestinian Territory", +"Portugal", "Palau", "Paraguay", "Qatar", "Reunion", "Romania", +"Russian Federation", "Rwanda", "Saudi Arabia", "Solomon Islands", +"Seychelles", "Sudan", "Sweden", "Singapore", "Saint Helena", "Slovenia", +"Svalbard and Jan Mayen", "Slovakia", "Sierra Leone", "San Marino", "Senegal", +"Somalia", "Suriname", "Sao Tome and Principe", "El Salvador", "Syrian Arab +Republic", "Swaziland", "Turks and Caicos Islands", "Chad", "French Southern +Territories", "Togo", "Thailand", "Tajikistan", "Tokelau", "Turkmenistan", +"Tunisia", "Tonga", "Timor-Leste", "Turkey", "Trinidad and Tobago", "Tuvalu", +"Taiwan", "Tanzania, United Republic of", "Ukraine", +"Uganda", "United States Minor Outlying Islands", "United States", "Uruguay", +"Uzbekistan", "Holy See (Vatican City State)", "Saint Vincent and the +Grenadines", "Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.", +"Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte", +"Serbia", "South Africa", "Zambia", "Montenegro", "Zimbabwe", +"Anonymous Proxy","Satellite Provider","Other", +"Aland Islands","Guernsey","Isle of Man","Jersey" +); +} +function geoip_load_shared_mem ($file) { + + $fp = fopen($file, "rb"); + if (!$fp) { + print "error opening $file: $php_errormsg\n"; + exit; + } + $s_array = fstat($fp); + $size = $s_array['size']; + if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { + shmop_delete ($shmid); + shmop_close ($shmid); + } + $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); + shmop_write ($shmid, fread($fp, $size), 0); + shmop_close ($shmid); +} + +function _setup_segments($gi){ + $gi->databaseType = GEOIP_COUNTRY_EDITION; + $gi->record_length = STANDARD_RECORD_LENGTH; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $offset = @shmop_size ($gi->shmid) - 3; + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = @shmop_read ($gi->shmid, $offset, 3); + $offset += 3; + if ($delim == (chr(255).chr(255).chr(255))) { + $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); + $offset++; + + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| + ($gi->databaseType == GEOIP_CITY_EDITION_REV1) + || ($gi->databaseType == GEOIP_ORG_EDITION) + || ($gi->databaseType == GEOIP_ISP_EDITION) + || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ + $gi->databaseSegments = 0; + $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if (($gi->databaseType == GEOIP_ORG_EDITION)|| + ($gi->databaseType == GEOIP_ISP_EDITION)) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + $offset -= 4; + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + } else { + $filepos = ftell($gi->filehandle); + fseek($gi->filehandle, -3, SEEK_END); + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = fread($gi->filehandle,3); + if ($delim == (chr(255).chr(255).chr(255))){ + $gi->databaseType = ord(fread($gi->filehandle,1)); + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } + else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || + ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || + ($gi->databaseType == GEOIP_ORG_EDITION) || + ($gi->databaseType == GEOIP_ISP_EDITION) || + ($gi->databaseType == GEOIP_ASNUM_EDITION)){ + $gi->databaseSegments = 0; + $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if ($gi->databaseType == GEOIP_ORG_EDITION || + $gi->databaseType == GEOIP_ISP_EDITION) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + fseek($gi->filehandle, -4, SEEK_CUR); + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + fseek($gi->filehandle,$filepos,SEEK_SET); + } + return $gi; +} + +function geoip_open($filename, $flags) { + $gi = new GeoIP; + $gi->flags = $flags; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); + } else { + $gi->filehandle = fopen($filename,"rb"); + if ($gi->flags & GEOIP_MEMORY_CACHE) { + $s_array = fstat($gi->filehandle); + $gi->memory_buffer = fread($gi->filehandle, $s_array['size']); + } + } + + $gi = _setup_segments($gi); + return $gi; +} + +function geoip_close($gi) { + if ($gi->flags & GEOIP_SHARED_MEMORY) { + return true; + } + + return fclose($gi->filehandle); +} + +function geoip_country_id_by_name($gi, $name) { + $addr = gethostbyname($name); + if (!$addr || $addr == $name) { + return false; + } + return geoip_country_id_by_addr($gi, $addr); +} + +function geoip_country_code_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + return false; +} + +function geoip_country_name_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + return false; +} + +function geoip_country_id_by_addr($gi, $addr) { + $ipnum = ip2long($addr); + return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; +} + +function geoip_country_code_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + return $record->country_code; + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + } + return false; +} + +function geoip_country_name_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + return $record->country_name; + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + } + return false; +} + +function _geoip_seek_country($gi, $ipnum) { + $offset = 0; + for ($depth = 31; $depth >= 0; --$depth) { + if ($gi->flags & GEOIP_MEMORY_CACHE) { + $buf = substr($gi->memory_buffer, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length); + } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { + $buf = @shmop_read ($gi->shmid, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length ); + } else { + fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 + or die("fseek failed"); + $buf = fread($gi->filehandle, 2 * $gi->record_length); + } + $x = array(0,0); + for ($i = 0; $i < 2; ++$i) { + for ($j = 0; $j < $gi->record_length; ++$j) { + $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); + } + } + if ($ipnum & (1 << $depth)) { + if ($x[1] >= $gi->databaseSegments) { + return $x[1]; + } + $offset = $x[1]; + } else { + if ($x[0] >= $gi->databaseSegments) { + return $x[0]; + } + $offset = $x[0]; + } + } + trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); + return false; +} + +function _get_org($gi,$ipnum){ + $seek_org = _geoip_seek_country($gi,$ipnum); + if ($seek_org == $gi->databaseSegments) { + return NULL; + } + $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); + } else { + fseek($gi->filehandle, $record_pointer, SEEK_SET); + $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); + } + $org_buf = substr($org_buf, 0, strpos($org_buf, 0)); + return $org_buf; +} + +function geoip_org_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_org($gi, $ipnum); +} + +function _get_region($gi,$ipnum){ + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; + if ($seek_region >= 1000){ + $country_code = "US"; + $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; + $region = ""; + } + return array ($country_code,$region); + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; + //print $seek_region; + if ($seek_region < US_OFFSET){ + $country_code = ""; + $region = ""; + } else if ($seek_region < CANADA_OFFSET) { + $country_code = "US"; + $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); + } else if ($seek_region < WORLD_OFFSET) { + $country_code = "CA"; + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; + $region = ""; + } + return array ($country_code,$region); + } +} + +function geoip_region_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_region($gi, $ipnum); +} + +function getdnsattributes ($l,$ip){ + $r = new Net_DNS_Resolver(); + $r->nameservers = array("ws1.maxmind.com"); + $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); + $str = is_object($p->answer[0])?$p->answer[0]->string():''; + ereg("\"(.*)\"",$str,$regs); + $str = $regs[1]; + return $str; +} + +?> diff --git a/html/includes/header.php b/html/includes/header.php new file mode 100755 index 0000000..e84a63e --- /dev/null +++ b/html/includes/header.php @@ -0,0 +1,66 @@ + + + + Unreal Tournament Stats - Powered by UTStats + + + + + + + + + + + +'; + +include("includes/sidebar.php"); + + +echo' +
+ + + +
+ UTStats Logo +
+
+
+'; \ No newline at end of file diff --git a/html/includes/hints.php b/html/includes/hints.php new file mode 100755 index 0000000..b8da8de --- /dev/null +++ b/html/includes/hints.php @@ -0,0 +1,81 @@ + "Frags", + "text" => "A player's frag count is equal to their kills minus suicides. In team games team kills (not team suicides) are also subtracted from the player's kills." + ); + +$hint['K'] = array ( "caption" => "Kills", + "text" => "Number of times a player kills another player.
Note: UTStats only tracks human vs. human kills. Bot kills and other bot related events are not tracked." + ); + +$hint['D'] = array ( "caption" => "Deaths", + "text" => "Number of times a player gets killed by another player.
- This does not include environment induced deaths, like trap doors. These and self kills are counted separately, as suicides.
- Team based deaths are counted as team deaths." + ); + +$hint['S'] = array ( "caption" => "Suicides", + "text" => "Number of times a player dies due to action of their own cause. Suicides can be environment induced (drowning, getting crushed, falling) or weapon related (fatal splash damage from their own weapon)." + ); + +$hint['TK'] = array ( "caption" => "Team Kills", + "text" => "Number of times a player in a team based game kills someone on their own team.
Note: Team kills subtract from a player's personal frags and thus the team frags as a whole." + ); + +$hint['Multis'] = + array ( "caption" => "Multi Kills", + "text" => "Special event: If you manage to kill more 2 than people within a short space of time you get a Double Kill, 3 is a Multi Kill etc" + ); + +$hint['Sprees'] = + array ( "caption" => "Killing Sprees", + "text" => "Special event: If you manage to kill 5 or more opponents without dying yourself, you will be on a killing spree. If you kill more than 10 opponents, you are on a rampage, etc." + ); + +$hint['EFF'] = array ( "caption" => "Efficiency", + "text" => "A ratio that denotes the player's kill skill by comparing it with his overall performance. A perfect efficiency is equal to 1 (100%), anything less than 0.5 (50%) is below average.
Formula: Kills / (Kills + Deaths + Suicides [+Team Kills])" + ); + +$hint['ACC'] = array ( "caption" => "Accuracy", + "text" => "Overall accuracy when using all weapons. Most accurate in insta but also very accurate in normal weapons." + ); + +$hint['TTL'] = array ( "caption" => "Time to Live", + "text" => "The length of time a player is in a game in seconds divided by how many times he/she dies, thus giving an average time of how long he/she will live." + ); + +$hint['DK'] = array ( "caption" => "Double Kill", + "text" => "Killed 2 people in a short space of time without dying himself/herself" + ); + +$hint['MK'] = array ( "caption" => "Multi Kill", + "text" => "Killed 3 people in a short space of time without dying himself/herself" + ); + +$hint['UK'] = array ( "caption" => "Ultra Kill", + "text" => "Killed 4 people in a short space of time without dying himself/herself" + ); + +$hint['MOK'] = array ( "caption" => "Monster Kill", + "text" => "Killed 5 people in a short space of time without dying himself/herself" + ); + + +$hint['KS'] = array ( "caption" => "Killing Spree", + "text" => "Killed 5 people in a row without dying himself/herself" + ); + +$hint['RA'] = array ( "caption" => "Rampage", + "text" => "Killed 10 people in a row without dying himself/herself" + ); + +$hint['DO'] = array ( "caption" => "Dominating", + "text" => "Killed 15 people in a row without dying himself/herself" + ); + +$hint['US'] = array ( "caption" => "Unstoppable", + "text" => "Killed 20 people in a row without dying himself/herself" + ); + +$hint['GL'] = array ( "caption" => "God Like", + "text" => "Killed 25 people in a row without dying himself/herself" + ); + +?> \ No newline at end of file diff --git a/html/includes/index.htm b/html/includes/index.htm new file mode 100755 index 0000000..e69de29 diff --git a/html/includes/overlib_mini.js b/html/includes/overlib_mini.js new file mode 100755 index 0000000..704d123 --- /dev/null +++ b/html/includes/overlib_mini.js @@ -0,0 +1,322 @@ +//\///// +//\ overLIB 4.21 - You may not remove or change this notice. +//\ Copyright Erik Bosrup 1998-2004. All rights reserved. +//\ +//\ Contributors are listed on the homepage. +//\ This file might be old, always check for the latest version at: +//\ http://www.bosrup.com/web/overlib/ +//\ +//\ Please read the license agreement (available through the link above) +//\ before using overLIB. Direct any licensing questions to erik@bosrup.com. +//\ +//\ Do not sell this as your own work or remove this copyright notice. +//\ For full details on copying or changing this script please read the +//\ license agreement at the link above. Please give credit on sites that +//\ use overLIB and submit changes of the script so other people can use +//\ them as well. +//\///// +//\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL! +var olLoaded=0,pmStart=10000000,pmUpper=10001000,pmCount=pmStart+1,pmt='',pms=new Array(),olInfo=new Info('4.21',1),FREPLACE=0,FBEFORE=1,FAFTER=2,FALTERNATE=3,FCHAIN=4,olHideForm=0,olHautoFlag=0,olVautoFlag=0,hookPts=new Array(),postParse=new Array(),cmdLine=new Array(),runTime=new Array(); +registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass'); +if(typeof ol_fgcolor=='undefined')var ol_fgcolor="#CCCCFF";if(typeof ol_bgcolor=='undefined')var ol_bgcolor="#333399";if(typeof ol_textcolor=='undefined')var ol_textcolor="#000000";if(typeof ol_capcolor=='undefined')var ol_capcolor="#FFFFFF";if(typeof ol_closecolor=='undefined')var ol_closecolor="#9999FF";if(typeof ol_textfont=='undefined')var ol_textfont="Verdana,Arial,Helvetica";if(typeof ol_captionfont=='undefined')var ol_captionfont="Verdana,Arial,Helvetica";if(typeof ol_closefont=='undefined')var ol_closefont="Verdana,Arial,Helvetica";if(typeof ol_textsize=='undefined')var ol_textsize="1";if(typeof ol_captionsize=='undefined')var ol_captionsize="1";if(typeof ol_closesize=='undefined')var ol_closesize="1";if(typeof ol_width=='undefined')var ol_width="200";if(typeof ol_border=='undefined')var ol_border="1";if(typeof ol_cellpad=='undefined')var ol_cellpad=2;if(typeof ol_offsetx=='undefined')var ol_offsetx=10;if(typeof ol_offsety=='undefined')var ol_offsety=10;if(typeof ol_text=='undefined')var ol_text="Default Text";if(typeof ol_cap=='undefined')var ol_cap="";if(typeof ol_sticky=='undefined')var ol_sticky=0;if(typeof ol_background=='undefined')var ol_background="";if(typeof ol_close=='undefined')var ol_close="Close";if(typeof ol_hpos=='undefined')var ol_hpos=RIGHT;if(typeof ol_status=='undefined')var ol_status="";if(typeof ol_autostatus=='undefined')var ol_autostatus=0;if(typeof ol_height=='undefined')var ol_height=-1;if(typeof ol_snapx=='undefined')var ol_snapx=0;if(typeof ol_snapy=='undefined')var ol_snapy=0;if(typeof ol_fixx=='undefined')var ol_fixx=-1;if(typeof ol_fixy=='undefined')var ol_fixy=-1;if(typeof ol_relx=='undefined')var ol_relx=null;if(typeof ol_rely=='undefined')var ol_rely=null;if(typeof ol_fgbackground=='undefined')var ol_fgbackground="";if(typeof ol_bgbackground=='undefined')var ol_bgbackground="";if(typeof ol_padxl=='undefined')var ol_padxl=1;if(typeof ol_padxr=='undefined')var ol_padxr=1;if(typeof ol_padyt=='undefined')var ol_padyt=1;if(typeof ol_padyb=='undefined')var ol_padyb=1;if(typeof ol_fullhtml=='undefined')var ol_fullhtml=0;if(typeof ol_vpos=='undefined')var ol_vpos=BELOW;if(typeof ol_aboveheight=='undefined')var ol_aboveheight=0;if(typeof ol_capicon=='undefined')var ol_capicon="";if(typeof ol_frame=='undefined')var ol_frame=self;if(typeof ol_timeout=='undefined')var ol_timeout=0;if(typeof ol_function=='undefined')var ol_function=null;if(typeof ol_delay=='undefined')var ol_delay=0;if(typeof ol_hauto=='undefined')var ol_hauto=0;if(typeof ol_vauto=='undefined')var ol_vauto=0;if(typeof ol_closeclick=='undefined')var ol_closeclick=0;if(typeof ol_wrap=='undefined')var ol_wrap=0;if(typeof ol_followmouse=='undefined')var ol_followmouse=1;if(typeof ol_mouseoff=='undefined')var ol_mouseoff=0;if(typeof ol_closetitle=='undefined')var ol_closetitle='Close';if(typeof ol_compatmode=='undefined')var ol_compatmode=0;if(typeof ol_css=='undefined')var ol_css=CSSOFF;if(typeof ol_fgclass=='undefined')var ol_fgclass="";if(typeof ol_bgclass=='undefined')var ol_bgclass="";if(typeof ol_textfontclass=='undefined')var ol_textfontclass="";if(typeof ol_captionfontclass=='undefined')var ol_captionfontclass="";if(typeof ol_closefontclass=='undefined')var ol_closefontclass=""; +if(typeof ol_texts=='undefined')var ol_texts=new Array("Text 0","Text 1");if(typeof ol_caps=='undefined')var ol_caps=new Array("Caption 0","Caption 1"); +var o3_text="",o3_cap="",o3_sticky=0,o3_background="",o3_close="Close",o3_hpos=RIGHT,o3_offsetx=2,o3_offsety=2,o3_fgcolor="",o3_bgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",o3_width=100,o3_border=1,o3_cellpad=2,o3_status="",o3_autostatus=0,o3_height=-1,o3_snapx=0,o3_snapy=0,o3_fixx=-1,o3_fixy=-1,o3_relx=null,o3_rely=null,o3_fgbackground="",o3_bgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,o3_vpos=BELOW,o3_aboveheight=0,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="Verdana,Arial,Helvetica",o3_closefont="Verdana,Arial,Helvetica",o3_textsize="1",o3_captionsize="1",o3_closesize="1",o3_frame=self,o3_timeout=0,o3_timerid=0,o3_allowmove=0,o3_function=null,o3_delay=0,o3_delayid=0,o3_hauto=0,o3_vauto=0,o3_closeclick=0,o3_wrap=0,o3_followmouse=1,o3_mouseoff=0,o3_closetitle='',o3_compatmode=0,o3_css=CSSOFF,o3_fgclass="",o3_bgclass="",o3_textfontclass="",o3_captionfontclass="",o3_closefontclass=""; +var o3_x=0,o3_y=0,o3_showingsticky=0,o3_removecounter=0; +var over=null,fnRef,hoveringSwitch=false,olHideDelay; +var isMac=(navigator.userAgent.indexOf("Mac")!=-1),olOp=(navigator.userAgent.toLowerCase().indexOf('opera')>-1&&document.createTextNode),olNs4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4),olNs6=(document.getElementById)?true:false,olKq=(olNs6&&/konqueror/i.test(navigator.userAgent)),olIe4=(document.all)?true:false,olIe5=false,olIe55=false,docRoot='document.body'; +if(olNs4){var oW=window.innerWidth;var oH=window.innerHeight;window.onresize=function(){if(oW!=window.innerWidth||oH!=window.innerHeight)location.reload();}} +if(olIe4){var agent=navigator.userAgent;if(/MSIE/.test(agent)){var versNum=parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);if(versNum>=5){olIe5=true;olIe55=(versNum>=5.5&&!olOp)?true:false;if(olNs6)olNs6=false;}} +if(olNs6)olIe4=false;} +if(document.compatMode&&document.compatMode=='CSS1Compat'){docRoot=((olIe4&&!olOp)?'document.documentElement':docRoot);} +if(window.addEventListener)window.addEventListener("load",OLonLoad_handler,false);else if(window.attachEvent)window.attachEvent("onload",OLonLoad_handler); +var capExtent; +function overlib(){if(!olLoaded||isExclusive(overlib.arguments))return true;if(olCheckMouseCapture)olMouseCapture();if(over){over=(typeof over.id!='string')?o3_frame.document.all['overDiv']:over;cClick();} +olHideDelay=0;o3_text=ol_text;o3_cap=ol_cap;o3_sticky=ol_sticky;o3_background=ol_background;o3_close=ol_close;o3_hpos=ol_hpos;o3_offsetx=ol_offsetx;o3_offsety=ol_offsety;o3_fgcolor=ol_fgcolor;o3_bgcolor=ol_bgcolor;o3_textcolor=ol_textcolor;o3_capcolor=ol_capcolor;o3_closecolor=ol_closecolor;o3_width=ol_width;o3_border=ol_border;o3_cellpad=ol_cellpad;o3_status=ol_status;o3_autostatus=ol_autostatus;o3_height=ol_height;o3_snapx=ol_snapx;o3_snapy=ol_snapy;o3_fixx=ol_fixx;o3_fixy=ol_fixy;o3_relx=ol_relx;o3_rely=ol_rely;o3_fgbackground=ol_fgbackground;o3_bgbackground=ol_bgbackground;o3_padxl=ol_padxl;o3_padxr=ol_padxr;o3_padyt=ol_padyt;o3_padyb=ol_padyb;o3_fullhtml=ol_fullhtml;o3_vpos=ol_vpos;o3_aboveheight=ol_aboveheight;o3_capicon=ol_capicon;o3_textfont=ol_textfont;o3_captionfont=ol_captionfont;o3_closefont=ol_closefont;o3_textsize=ol_textsize;o3_captionsize=ol_captionsize;o3_closesize=ol_closesize;o3_timeout=ol_timeout;o3_function=ol_function;o3_delay=ol_delay;o3_hauto=ol_hauto;o3_vauto=ol_vauto;o3_closeclick=ol_closeclick;o3_wrap=ol_wrap;o3_followmouse=ol_followmouse;o3_mouseoff=ol_mouseoff;o3_closetitle=ol_closetitle;o3_css=ol_css;o3_compatmode=ol_compatmode;o3_fgclass=ol_fgclass;o3_bgclass=ol_bgclass;o3_textfontclass=ol_textfontclass;o3_captionfontclass=ol_captionfontclass;o3_closefontclass=ol_closefontclass; +setRunTimeVariables(); +fnRef=''; +o3_frame=ol_frame; +if(!(over=createDivContainer()))return false; +parseTokens('o3_',overlib.arguments);if(!postParseChecks())return false; +if(o3_delay==0){return runHook("olMain",FREPLACE);}else{o3_delayid=setTimeout("runHook('olMain',FREPLACE)",o3_delay);return false;}} +function nd(time){if(olLoaded&&!isExclusive()){hideDelay(time); +if(o3_removecounter>=1){o3_showingsticky=0 }; +if(o3_showingsticky==0){o3_allowmove=0;if(over!=null&&o3_timerid==0)runHook("hideObject",FREPLACE,over);}else{o3_removecounter++;}} +return true;} +function cClick(){if(olLoaded){runHook("hideObject",FREPLACE,over);o3_showingsticky=0;} +return false;} +function overlib_pagedefaults(){parseTokens('ol_',overlib_pagedefaults.arguments);} +function olMain(){var layerhtml,styleType;runHook("olMain",FBEFORE); +if(o3_background!=""||o3_fullhtml){ +layerhtml=runHook('ol_content_background',FALTERNATE,o3_css,o3_text,o3_background,o3_fullhtml);}else{ +styleType=(pms[o3_css-1-pmStart]=="cssoff"||pms[o3_css-1-pmStart]=="cssclass"); +if(o3_fgbackground!="")o3_fgbackground="background=\""+o3_fgbackground+"\"";if(o3_bgbackground!="")o3_bgbackground=(styleType?"background=\""+o3_bgbackground+"\"":o3_bgbackground); +if(o3_fgcolor!="")o3_fgcolor=(styleType?"bgcolor=\""+o3_fgcolor+"\"":o3_fgcolor);if(o3_bgcolor!="")o3_bgcolor=(styleType?"bgcolor=\""+o3_bgcolor+"\"":o3_bgcolor); +if(o3_height>0)o3_height=(styleType?"height=\""+o3_height+"\"":o3_height);else o3_height=""; +if(o3_cap==""){ +layerhtml=runHook('ol_content_simple',FALTERNATE,o3_css,o3_text);}else{ +if(o3_sticky){ +layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,o3_close);}else{ +layerhtml=runHook('ol_content_caption',FALTERNATE,o3_css,o3_text,o3_cap,"");}}} +if(o3_sticky){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;} +o3_showingsticky=1;o3_removecounter=0;} +if(!runHook("createPopup",FREPLACE,layerhtml))return false; +if(o3_autostatus>0){o3_status=o3_text;if(o3_autostatus>1)o3_status=o3_cap;} +o3_allowmove=0; +if(o3_timeout>0){if(o3_timerid>0)clearTimeout(o3_timerid);o3_timerid=setTimeout("cClick()",o3_timeout);} +runHook("disp",FREPLACE,o3_status);runHook("olMain",FAFTER); +return(olOp&&event&&event.type=='mouseover'&&!o3_status)?'':(o3_status!='');} +function ol_content_simple(text){var cpIsMultiple=/,/.test(o3_cellpad);var txt='
':((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'
'; +set_background("");return txt;} +function ol_content_caption(text,title,close){var nameId,txt,cpIsMultiple=/,/.test(o3_cellpad);var closing,closeevent; +closing="";closeevent="onmouseover";if(o3_closeclick==1)closeevent=(o3_closetitle?"title='"+o3_closetitle+"'":"")+" onclick";if(o3_capicon!=""){nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';if(typeof o3_dragimg!='undefined'&&o3_dragimg)nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';o3_capicon='';} +if(close!="") +closing=''+(o3_closefontclass?'':wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass?'':wrapStr(1,o3_closesize,'close'))+'';txt='
':'>')+(o3_captionfontclass?'':''+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass?'':wrapStr(1,o3_captionsize)+'')+''+closing+'
' :((!olNs4&&cpIsMultiple)?' style="'+setCellPadStr(o3_cellpad)+'">':'>'))+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'
'; +set_background("");return txt;} +function ol_content_background(text,picture,hasfullhtml){if(hasfullhtml){txt=text;}else{txt='
'+(o3_textfontclass?'':wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass?'':wrapStr(1,o3_textsize))+'
';} +set_background(picture);return txt;} +function set_background(pic){if(pic==""){if(olNs4){over.background.src=null;}else if(over.style){over.style.backgroundImage="none";} +}else{if(olNs4){over.background.src=pic;}else if(over.style){over.style.width=o3_width+'px';over.style.backgroundImage="url("+pic+")";}}} +var olShowId=-1; +function disp(statustext){runHook("disp",FBEFORE); +if(o3_allowmove==0){runHook("placeLayer",FREPLACE);(olNs6&&olShowId<0)?olShowId=setTimeout("runHook('showObject',FREPLACE,over)",1):runHook("showObject",FREPLACE,over);o3_allowmove=(o3_sticky||o3_followmouse==0)?0:1;} +runHook("disp",FAFTER); +if(statustext!="")self.status=statustext;} +function createPopup(lyrContent){runHook("createPopup",FBEFORE); +if(o3_wrap){var wd,ww,theObj=(olNs4?over:over.style);theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0);layerWrite(lyrContent);wd=(olNs4?over.clip.width:over.offsetWidth);if(wd>(ww=windowWidth())){lyrContent=lyrContent.replace(/\ /g,' ');o3_width=ww;o3_wrap=0;}} +layerWrite(lyrContent); +if(o3_wrap)o3_width=(olNs4?over.clip.width:over.offsetWidth); +runHook("createPopup",FAFTER,lyrContent); +return true;} +function placeLayer(){var placeX,placeY,widthFix=0; +if(o3_frame.innerWidth)widthFix=18;iwidth=windowWidth(); +winoffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollLeft'):o3_frame.pageXOffset; +placeX=runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix); +if(o3_frame.innerHeight){iheight=o3_frame.innerHeight;}else if(eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')){iheight=eval('o3_frame.'+docRoot+'.clientHeight');} +scrolloffset=(olIe4)?eval('o3_frame.'+docRoot+'.scrollTop'):o3_frame.pageYOffset;placeY=runHook('verticalPlacement',FCHAIN,iheight,scrolloffset); +repositionTo(over,placeX,placeY);} +function olMouseMove(e){var e=(e)?e:event; +if(e.pageX){o3_x=e.pageX;o3_y=e.pageY;}else if(e.clientX){o3_x=eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');o3_y=eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');} +if(o3_allowmove==1)runHook("placeLayer",FREPLACE); +if(hoveringSwitch&&!olNs4&&runHook("cursorOff",FREPLACE)){(olHideDelay?hideDelay(olHideDelay):cClick());hoveringSwitch=!hoveringSwitch;}} +function no_overlib(){return ver3fix;} +function olMouseCapture(){capExtent=document;var fN,str='',l,k,f,wMv,sS,mseHandler=olMouseMove;var re=/function[ ]*(\w*)\(/; +wMv=(!olIe4&&window.onmousemove);if(document.onmousemove||wMv){if(wMv)capExtent=window;f=capExtent.onmousemove.toString();fN=f.match(re);if(fN==null){str=f+'(e);';}else if(fN[1]=='anonymous'||fN[1]=='olMouseMove'||(wMv&&fN[1]=='onmousemove')){if(!olOp&&wMv){l=f.indexOf('{')+1;k=f.lastIndexOf('}');sS=f.substring(l,k);if((l=sS.indexOf('('))!=-1){sS=sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');if(eval("typeof "+sS+"=='undefined'"))window.onmousemove=null;else str=sS+'(e);';}} +if(!str){olCheckMouseCapture=false;return;} +}else{if(fN[1])str=fN[1]+'(e);';else{l=f.indexOf('{')+1;k=f.lastIndexOf('}');str=f.substring(l,k)+'\n';}} +str+='olMouseMove(e);';mseHandler=new Function('e',str);} +capExtent.onmousemove=mseHandler;if(olNs4)capExtent.captureEvents(Event.MOUSEMOVE);} +function parseTokens(pf,ar){ +var v,i,mode=-1,par=(pf!='ol_'),fnMark=(par&&!ar.length?1:0); +for(i=0;ipmStart&&ar[i]=pmCount||ar[i]==DONOTHING){continue;} +if(ar[i]==INARRAY){fnMark=0;eval(pf+'text=ol_texts['+ar[++i]+'].toString()');continue;} +if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+'].toString()');continue;} +if(ar[i]==STICKY){if(pf!='ol_')eval(pf+'sticky=1');continue;} +if(ar[i]==BACKGROUND){eval(pf+'background="'+ar[++i]+'"');continue;} +if(ar[i]==NOCLOSE){if(pf!='ol_')opt_NOCLOSE();continue;} +if(ar[i]==CAPTION){eval(pf+"cap='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==CENTER||ar[i]==LEFT||ar[i]==RIGHT){eval(pf+'hpos='+ar[i]);if(pf!='ol_')olHautoFlag=1;continue;} +if(ar[i]==OFFSETX){eval(pf+'offsetx='+ar[++i]);continue;} +if(ar[i]==OFFSETY){eval(pf+'offsety='+ar[++i]);continue;} +if(ar[i]==FGCOLOR){eval(pf+'fgcolor="'+ar[++i]+'"');continue;} +if(ar[i]==BGCOLOR){eval(pf+'bgcolor="'+ar[++i]+'"');continue;} +if(ar[i]==TEXTCOLOR){eval(pf+'textcolor="'+ar[++i]+'"');continue;} +if(ar[i]==CAPCOLOR){eval(pf+'capcolor="'+ar[++i]+'"');continue;} +if(ar[i]==CLOSECOLOR){eval(pf+'closecolor="'+ar[++i]+'"');continue;} +if(ar[i]==WIDTH){eval(pf+'width='+ar[++i]);continue;} +if(ar[i]==BORDER){eval(pf+'border='+ar[++i]);continue;} +if(ar[i]==CELLPAD){i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad'));continue;} +if(ar[i]==STATUS){eval(pf+"status='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==AUTOSTATUS){eval(pf+'autostatus=('+pf+'autostatus==1)?0:1');continue;} +if(ar[i]==AUTOSTATUSCAP){eval(pf+'autostatus=('+pf+'autostatus==2)?0:2');continue;} +if(ar[i]==HEIGHT){eval(pf+'height='+pf+'aboveheight='+ar[++i]);continue;} +if(ar[i]==CLOSETEXT){eval(pf+"close='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==SNAPX){eval(pf+'snapx='+ar[++i]);continue;} +if(ar[i]==SNAPY){eval(pf+'snapy='+ar[++i]);continue;} +if(ar[i]==FIXX){eval(pf+'fixx='+ar[++i]);continue;} +if(ar[i]==FIXY){eval(pf+'fixy='+ar[++i]);continue;} +if(ar[i]==RELX){eval(pf+'relx='+ar[++i]);continue;} +if(ar[i]==RELY){eval(pf+'rely='+ar[++i]);continue;} +if(ar[i]==FGBACKGROUND){eval(pf+'fgbackground="'+ar[++i]+'"');continue;} +if(ar[i]==BGBACKGROUND){eval(pf+'bgbackground="'+ar[++i]+'"');continue;} +if(ar[i]==PADX){eval(pf+'padxl='+ar[++i]);eval(pf+'padxr='+ar[++i]);continue;} +if(ar[i]==PADY){eval(pf+'padyt='+ar[++i]);eval(pf+'padyb='+ar[++i]);continue;} +if(ar[i]==FULLHTML){if(pf!='ol_')eval(pf+'fullhtml=1');continue;} +if(ar[i]==BELOW||ar[i]==ABOVE){eval(pf+'vpos='+ar[i]);if(pf!='ol_')olVautoFlag=1;continue;} +if(ar[i]==CAPICON){eval(pf+'capicon="'+ar[++i]+'"');continue;} +if(ar[i]==TEXTFONT){eval(pf+"textfont='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==CAPTIONFONT){eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==CLOSEFONT){eval(pf+"closefont='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==TEXTSIZE){eval(pf+'textsize="'+ar[++i]+'"');continue;} +if(ar[i]==CAPTIONSIZE){eval(pf+'captionsize="'+ar[++i]+'"');continue;} +if(ar[i]==CLOSESIZE){eval(pf+'closesize="'+ar[++i]+'"');continue;} +if(ar[i]==TIMEOUT){eval(pf+'timeout='+ar[++i]);continue;} +if(ar[i]==FUNCTION){if(pf=='ol_'){if(typeof ar[i+1]!='number'){v=ar[++i];ol_function=(typeof v=='function'?v:null);}}else{fnMark=0;v=null;if(typeof ar[i+1]!='number')v=ar[++i]; opt_FUNCTION(v);} continue;} +if(ar[i]==DELAY){eval(pf+'delay='+ar[++i]);continue;} +if(ar[i]==HAUTO){eval(pf+'hauto=('+pf+'hauto==0)?1:0');continue;} +if(ar[i]==VAUTO){eval(pf+'vauto=('+pf+'vauto==0)?1:0');continue;} +if(ar[i]==CLOSECLICK){eval(pf+'closeclick=('+pf+'closeclick==0)?1:0');continue;} +if(ar[i]==WRAP){eval(pf+'wrap=('+pf+'wrap==0)?1:0');continue;} +if(ar[i]==FOLLOWMOUSE){eval(pf+'followmouse=('+pf+'followmouse==1)?0:1');continue;} +if(ar[i]==MOUSEOFF){eval(pf+'mouseoff=('+pf+'mouseoff==0)?1:0');v=ar[i+1];if(pf!='ol_'&&eval(pf+'mouseoff')&&typeof v=='number'&&(vpmUpper))olHideDelay=ar[++i];continue;} +if(ar[i]==CLOSETITLE){eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'");continue;} +if(ar[i]==CSSOFF||ar[i]==CSSCLASS){eval(pf+'css='+ar[i]);continue;} +if(ar[i]==COMPATMODE){eval(pf+'compatmode=('+pf+'compatmode==0)?1:0');continue;} +if(ar[i]==FGCLASS){eval(pf+'fgclass="'+ar[++i]+'"');continue;} +if(ar[i]==BGCLASS){eval(pf+'bgclass="'+ar[++i]+'"');continue;} +if(ar[i]==TEXTFONTCLASS){eval(pf+'textfontclass="'+ar[++i]+'"');continue;} +if(ar[i]==CAPTIONFONTCLASS){eval(pf+'captionfontclass="'+ar[++i]+'"');continue;} +if(ar[i]==CLOSEFONTCLASS){eval(pf+'closefontclass="'+ar[++i]+'"');continue;} +i=parseCmdLine(pf,i,ar);}} +if(fnMark&&o3_function)o3_text=o3_function(); +if((pf=='o3_')&&o3_wrap){o3_width=0; +var tReg=/<.*\n*>/ig;if(!tReg.test(o3_text))o3_text=o3_text.replace(/[ ]+/g,' ');if(!tReg.test(o3_cap))o3_cap=o3_cap.replace(/[ ]+/g,' ');} +if((pf=='o3_')&&o3_sticky){if(!o3_close&&(o3_frame!=ol_frame))o3_close=ol_close;if(o3_mouseoff&&(o3_frame==ol_frame))opt_NOCLOSE(' ');}} +function layerWrite(txt){txt+="\n";if(olNs4){var lyr=o3_frame.document.layers['overDiv'].document +lyr.write(txt) +lyr.close() +}else if(typeof over.innerHTML!='undefined'){if(olIe5&&isMac)over.innerHTML='';over.innerHTML=txt;}else{range=o3_frame.document.createRange();range.setStartAfter(over);domfrag=range.createContextualFragment(txt); +while(over.hasChildNodes()){over.removeChild(over.lastChild);} +over.appendChild(domfrag);}} +function showObject(obj){runHook("showObject",FBEFORE); +var theObj=(olNs4?obj:obj.style);theObj.visibility='visible'; +runHook("showObject",FAFTER);} +function hideObject(obj){runHook("hideObject",FBEFORE); +var theObj=(olNs4?obj:obj.style);if(olNs6&&olShowId>0){clearTimeout(olShowId);olShowId=0;} +theObj.visibility='hidden';theObj.top=theObj.left=((olIe4&&!olOp)?0:-10000)+(!olNs4?'px':0); +if(o3_timerid>0)clearTimeout(o3_timerid);if(o3_delayid>0)clearTimeout(o3_delayid); +o3_timerid=0;o3_delayid=0;self.status=""; +if(obj.onmouseout||obj.onmouseover){if(olNs4)obj.releaseEvents(Event.MOUSEOUT||Event.MOUSEOVER);obj.onmouseout=obj.onmouseover=null;} +runHook("hideObject",FAFTER);} +function repositionTo(obj,xL,yL){var theObj=(olNs4?obj:obj.style);theObj.left=xL+(!olNs4?'px':0);theObj.top=yL+(!olNs4?'px':0);} +function cursorOff(){var left=parseInt(over.style.left);var top=parseInt(over.style.top);var right=left+(over.offsetWidth>=parseInt(o3_width)?over.offsetWidth:parseInt(o3_width));var bottom=top+(over.offsetHeight>=o3_aboveheight?over.offsetHeight:o3_aboveheight); +if(o3_xright||o3_ybottom)return true; +return false;} +function opt_FUNCTION(callme){o3_text=(callme?(typeof callme=='string'?(/.+\(.*\)/.test(callme)?eval(callme):callme):callme()):(o3_function?o3_function():'No Function')); +return 0;} +function opt_NOCLOSE(unused){if(!unused)o3_close=""; +if(olNs4){over.captureEvents(Event.MOUSEOUT||Event.MOUSEOVER);over.onmouseover=function(){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;} } +over.onmouseout=function(e){if(olHideDelay)hideDelay(olHideDelay);else cClick(e);} +}else{over.onmouseover=function(){hoveringSwitch=true;if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;} }} +return 0;} +function opt_MULTIPLEARGS(i,args,parameter){var k=i,re,pV,str=''; +for(k=i;kpmStart)break;str+=args[k]+',';} +if(str)str=str.substring(0,--str.length); +k--;pV=(olNs4&&/cellpad/i.test(parameter))?str.split(',')[0]:str;eval(parameter+'="'+pV+'"'); +return k;} +function nbspCleanup(){if(o3_wrap){o3_text=o3_text.replace(/\ /g,' ');o3_cap=o3_cap.replace(/\ /g,' ');}} +function escSglQuote(str){return str.toString().replace(/'/g,"\\'");} +function OLonLoad_handler(e){var re=/\w+\(.*\)[;\s]+/g,olre=/overlib\(|nd\(|cClick\(/,fn,l,i; +if(!olLoaded)olLoaded=1; +if(window.removeEventListener&&e.eventPhase==3)window.removeEventListener("load",OLonLoad_handler,false);else if(window.detachEvent){window.detachEvent("onload",OLonLoad_handler);var fN=document.body.getAttribute('onload');if(fN){fN=fN.toString().match(re);if(fN&&fN.length){for(i=0;i':''):'';else{fontStr='o3_'+whichString+'font';fontColor='o3_'+((whichString=='caption')? 'cap':whichString)+'color';return(hasDims&&!olNs4)?(isClose?'':'
'):'';}} +function quoteMultiNameFonts(theFont){var v,pM=theFont.split(',');for(var i=0;i0)clearTimeout(o3_timerid); +o3_timerid=setTimeout("cClick()",(o3_timeout=time));}} +function horizontalPlacement(browserWidth,horizontalScrollAmount,widthFix){var placeX,iwidth=browserWidth,winoffset=horizontalScrollAmount;var parsedWidth=parseInt(o3_width); +if(o3_fixx>-1||o3_relx!=null){ +placeX=(o3_relx!=null?( o3_relx<0?winoffset+o3_relx+iwidth-parsedWidth-widthFix:winoffset+o3_relx):o3_fixx);}else{ +if(o3_hauto==1){if((o3_x-winoffset)>(iwidth/2)){o3_hpos=LEFT;}else{o3_hpos=RIGHT;}} +if(o3_hpos==CENTER){placeX=o3_x+o3_offsetx-(parsedWidth/2); +if(placeX(winoffset+iwidth-widthFix)){placeX=iwidth+winoffset-parsedWidth-widthFix;if(placeX<0)placeX=0;}} +if(o3_hpos==LEFT){placeX=o3_x-o3_offsetx-parsedWidth;if(placeX1){var snapping=placeX % o3_snapx; +if(o3_hpos==LEFT){placeX=placeX-(o3_snapx+snapping);}else{ +placeX=placeX+(o3_snapx-snapping);} +if(placeX-1||o3_rely!=null){ +placeY=(o3_rely!=null?(o3_rely<0?scrolloffset+o3_rely+iheight-parsedHeight:scrolloffset+o3_rely):o3_fixy);}else{ +if(o3_vauto==1){if((o3_y-scrolloffset)>(iheight/2)&&o3_vpos==BELOW&&(o3_y+parsedHeight+o3_offsety-(scrolloffset+iheight)>0)){o3_vpos=ABOVE;}else if(o3_vpos==ABOVE&&(o3_y-(parsedHeight+o3_offsety)-scrolloffset<0)){o3_vpos=BELOW;}} +if(o3_vpos==ABOVE){if(o3_aboveheight==0)o3_aboveheight=parsedHeight; +placeY=o3_y-(o3_aboveheight+o3_offsety);if(placeY1){var snapping=placeY % o3_snapy; +if(o3_aboveheight>0&&o3_vpos==ABOVE){placeY=placeY-(o3_snapy+snapping);}else{placeY=placeY+(o3_snapy-snapping);} +if(placeY
');divContainer=layerReference(id);}else{divContainer=frm.document.createElement("DIV");divContainer.id=id;body.appendChild(divContainer);} +objRef=divContainer.style;} +objRef.position='absolute';objRef.visibility='hidden';objRef.zIndex=zValue;if(olIe4&&!olOp)objRef.left=objRef.top='0px';else objRef.left=objRef.top=-10000+(!olNs4?'px':0);} +return divContainer;} +function layerReference(id){return(olNs4?o3_frame.document.layers[id]:(document.all?o3_frame.document.all[id]:o3_frame.document.getElementById(id)));} +function isFunction(fnRef){var rtn=true; +if(typeof fnRef=='object'){for(var i=0;ijS){for(var k=jS;k-1){i=j;break;}}} +return i;} +function postParseChecks(pf,args){if(typeof postParse!='undefined'&&postParse.length){for(var k=0;k-1)hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef; +}else if(hookType==FBEFORE||hookType==FAFTER){var hookPt=(hookType==1?hookPt.before:hookPt.after); +if(typeof fnRef=='object'){hookPt=hookPt.concat(fnRef);}else{hookPt[hookPt.length++]=fnRef;} +if(optPm)hookPt=reOrder(hookPt,fnRef,optPm); +}else if(hookType==FALTERNATE){if(last=='number')hookPt.alt[pms[optPm-1-pmStart]]=fnRef;}else if(hookType==FCHAIN){hookPt=hookPt.chain;if(typeof fnRef=='object')hookPt=hookPt.concat(fnRef);else hookPt[hookPt.length++]=fnRef;} +return;}} +function registerRunTimeFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){runTime=runTime.concat(fn);}else{runTime[runTime.length++]=fn;}}} +function registerCmdLineFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){cmdLine=cmdLine.concat(fn);}else{cmdLine[cmdLine.length++]=fn;}}} +function registerPostParseFunction(fn){if(isFunction(fn)){if(typeof fn=='object'){postParse=postParse.concat(fn);}else{postParse[postParse.length++]=fn;}}} +function runHook(fnHookTo,hookType){var l=hookPts[fnHookTo],k,rtnVal=null,optPm,arS,ar=runHook.arguments; +if(hookType==FREPLACE){arS=argToString(ar,2); +if(typeof l=='undefined'||!(l=l.ovload))rtnVal=eval(fnHookTo+'('+arS+')');else rtnVal=eval('l('+arS+')'); +}else if(hookType==FBEFORE||hookType==FAFTER){if(typeof l!='undefined'){l=(hookType==1?l.before:l.after); +if(l.length){arS=argToString(ar,2);for(var k=0;k0;k--)if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0))break;} +return rtnVal;} +function FunctionReference(){this.ovload=null;this.before=new Array();this.after=new Array();this.alt=new Array();this.chain=new Array();} +function Info(version,prerelease){this.version=version;this.prerelease=prerelease; +this.simpleversion=Math.round(this.version*100);this.major=parseInt(this.simpleversion/100);this.minor=parseInt(this.simpleversion/10)-this.major * 10;this.revision=parseInt(this.simpleversion)-this.major * 100-this.minor * 10;this.meets=meets;} +function meets(reqdVersion){return(!reqdVersion)?false:this.simpleversion>=Math.round(100*parseFloat(reqdVersion));} +registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSOFF);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSOFF);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSOFF);registerHook("ol_content_simple",ol_content_simple,FALTERNATE,CSSCLASS);registerHook("ol_content_caption",ol_content_caption,FALTERNATE,CSSCLASS);registerHook("ol_content_background",ol_content_background,FALTERNATE,CSSCLASS);registerPostParseFunction(checkPositionFlags);registerHook("hideObject",nbspCleanup,FAFTER);registerHook("horizontalPlacement",horizontalPlacement,FCHAIN);registerHook("verticalPlacement",verticalPlacement,FCHAIN);if(olNs4||(olIe5&&isMac)||olKq)olLoaded=1;registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode'); +var olCheckMouseCapture=true;if((olNs4||olNs6||olIe4)){olMouseCapture();}else{overlib=no_overlib;nd=no_overlib;ver3fix=true;} diff --git a/html/includes/sidebar.php b/html/includes/sidebar.php new file mode 100755 index 0000000..e62e292 --- /dev/null +++ b/html/includes/sidebar.php @@ -0,0 +1,27 @@ + + UT Logo +
+

Home

+

Recent Matches

+

Rankings

+

Servers

+

Players

+

Maps

+

Totals

+

Watchlist

+

Import

+

Admin

+

Credits

+

Help

+

UTStats Forums

+
+ UT Character +
+ + +Spacing + +'; +?> \ No newline at end of file diff --git a/html/includes/teamstats.php b/html/includes/teamstats.php new file mode 100755 index 0000000..66e53ab --- /dev/null +++ b/html/includes/teamstats.php @@ -0,0 +1,177 @@ + + + '.htmlentities($title).' + '; + + + $sql_players = "SELECT pi.name, pi.banned, p.pid, p.team, p.country, p.gametime, p.gamescore, p.frags, p.deaths, p.suicides, p.teamkills, p.eff, p.accuracy, p.ttl, p.rank".(($extra) ? ', p.'.$extra.' AS '.$extra : '')." + FROM uts_player AS p, uts_pinfo AS pi WHERE p.pid = pi.id AND matchid = $mid + ORDER BY".(($teams) ? ' team ASC,' : '')." $order"; + $q_players = mysql_query($sql_players) or die(mysql_error()); + $header = true; + teamstats_init_totals($totals, $num); + while ($r_players = zero_out(mysql_fetch_array($q_players))) { + $r_players['dom_cp'] = $r_players['gamescore'] - $r_players['frags']; + + $r_players['team'] = intval($r_players['team']); + if ($teams and $oldteam != $r_players['team']) { + if ($r_players['team'] != 0) teamstats_team_totals($totals, $num, $teams, $extra, $teamscore[$oldteam]); + $oldteam = $r_players['team']; + teamstats_init_totals($totals, $num, $extra); + + switch(intval($r_players['team'])) { + case 0: $teamname = 'Red'; break; + case 1: $teamname = 'Blue'; break; + case 2: $teamname = 'Green'; break; + case 3: $teamname = 'Gold'; break; + } + echo'Team: '.$teamname.''; + $header = true; + } + if ($header) { + $header = false; + echo ' + + Player + Time + Score'; + if ($extra) echo' '.htmlentities($extratitle).''; + echo' + F + K + D + S'; + if ($teams) echo 'TK'; + echo ' + Eff. + Acc. + Avg TTL + '; + } + + $eff = get_dp($r_players['eff']); + $acc = get_dp($r_players['accuracy']); + $ttl = GetMinutes($r_players['ttl']); + $kills = $r_players['frags'] + $r_players['suicides']; + $pname = $r_players['name']; + + $totals['gamescore'] += $r_players['gamescore']; + if ($extra) $totals[$extra] += $r_players[$extra]; + $totals['frags'] += $r_players['frags']; + $totals['kills'] += $kills; + $totals['deaths'] += $r_players['deaths']; + $totals['suicides'] += $r_players['suicides']; + $totals['teamkills'] += $r_players['teamkills']; + $totals['eff'] += $r_players['eff']; + $totals['acc'] += $r_players['accuracy']; + $totals['ttl'] += $r_players['ttl']; + $num++; + + if ($r_players['banned'] == 'Y') { + $eff = '-'; + $acc = '-'; + $ttl = '-'; + $kills = '-'; + $r_players['gamescore'] = '-'; + $r_players[$extra] = '-'; + $r_players['frags'] = '-'; + $r_players['deaths'] = '-'; + $r_players['suicides'] = '-'; + $r_players['teamkills'] = '-'; + } + + + $class = ($num % 2) ? 'grey' : 'grey2'; + echo ''; + if ($r_players['banned'] != 'Y') { + echo ''.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).''; + } else { + echo ''.FormatPlayerName($r_players['country'], $r_players['pid'], $r_players['name'], $gid, $gamename, true, $r_players['rank']).''; + } + echo ''.GetMinutes($r_players[gametime]).''; + echo ''.$r_players[gamescore].''; + + if ($extra) echo ''.$r_players[$extra].''; + + echo ''.$r_players[frags].''; + echo ''.$kills.''; + echo ''.$r_players[deaths].''; + echo ''.$r_players[suicides].''; + + if ($teams) echo ''.$r_players[teamkills].''; + + echo ''.$eff.''; + echo ''.$acc.''; + echo ''.$ttl.''; + echo ''; + } + teamstats_team_totals($totals, $num, $teams, $extra, $teamscore[$oldteam]); + echo '
'; + +} + +function teamstats_init_totals(&$totals, &$num, $extra = null) { + $totals['gamescore'] = 0; + if ($extra) $totals[$extra] = 0; + $totals['frags'] = 0; + $totals['kills'] = 0; + $totals['deaths'] = 0; + $totals['suicides'] = 0; + $totals['teamkills'] = 0; + $totals['eff'] = 0; + $totals['acc'] = 0; + $totals['ttl'] = 0; + $num = 0; +} + +function teamstats_team_totals(&$totals, $num, $teams, $extra, $teamscore) { + if ($num == 0) $num = 1; + $eff = get_dp($totals['eff'] / $num); + $acc = get_dp($totals['acc'] / $num); + $ttl = GetMinutes($totals['ttl'] / $num); + + + echo ''; + echo 'Totals'; + echo ''; + if ($teams) { + echo ''.$teamscore.' ('.$totals[gamescore].')'; + } else { + echo ''.$totals[gamescore].''; + } + if ($extra) echo ''.$totals[$extra].''; + + echo ''.$totals[frags].''; + echo ''.$totals[kills].''; + echo ''.$totals[deaths].''; + echo ''.$totals[suicides].''; + + if ($teams) echo ''.$totals[teamkills].''; + + echo ''.$eff.''; + echo ''.$acc.''; + echo ''.$ttl.''; + echo ''; +} +?> diff --git a/html/includes/weaponstats.php b/html/includes/weaponstats.php new file mode 100755 index 0000000..872fa5a --- /dev/null +++ b/html/includes/weaponstats.php @@ -0,0 +1,216 @@ + 'Y'"; + + + if ($_pid == 0 and $_mid != 0) { + $sql_weapons = "SELECT w.matchid, + w.pid AS playerid, + w.weapon, + SUM(w.kills) AS kills, + SUM(w.shots) AS shots, + SUM(w.hits) AS hits, + SUM(w.damage) AS damage, + AVG(w.acc) AS acc, + pi.name AS playername, + pi.country AS country, + pi.banned AS banned, + wn.id AS weaponid, + wn.name AS weaponname, + wn.image AS weaponimg, + wn.sequence AS sequence, + wn.hide AS hideweapon +FROM uts_weapons AS wn, +uts_weaponstats AS w + LEFT JOIN uts_pinfo AS pi + ON w.pid = pi.id + WHERE w.matchid = '$_mid' + AND (wn.id = w.weapon) + AND wn.hide <> 'Y' + GROUP BY w.pid, + w.weapon"; + } + + $q_weapons = mysql_query($sql_weapons) or die(mysql_error()); + while ($r_weapons = zero_out(mysql_fetch_array($q_weapons))) { + $weaponid = intval($r_weapons['weaponid']); + $playerid = intval($r_weapons['playerid']); + // Don't include banned players + if ($r_weapons['banned'] != 'Y') $psort[$playerid] = strtolower($r_weapons['playername']); + + if ($r_weapons['damage'] > 1000000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; +// if ($r_weapons['damage'] > 1000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; + + $wd[$playerid]['playername'] = $r_weapons['playername']; + $wd[$playerid]['country'] = $r_weapons['country']; + $wd[$playerid]['banned'] = $r_weapons['banned']; + $wd[$playerid][$weaponid]['kills'] = $r_weapons['kills']; + $wd[$playerid][$weaponid]['shots'] = $r_weapons['shots']; + $wd[$playerid][$weaponid]['hits'] = $r_weapons['hits']; + $wd[$playerid][$weaponid]['damage'] = $r_weapons['damage']; + $wd[$playerid][$weaponid]['acc'] = ((!empty($r_weapons['acc'])) ? get_dp($r_weapons['acc']) : ''); + + if (!isset($wsort[$weaponid]) and $r_weapons['hideweapon'] != 'Y') { + $wsort[$weaponid] = intval($r_weapons['sequence']); + $weapons[$weaponid]['name'] = $r_weapons['weaponname']; + $weapons[$weaponid]['image'] = $r_weapons['weaponimg']; + $weapons[$weaponid]['sequence'] = $r_weapons['sequence']; + } + } + if (!isset($psort)) return; + + asort($psort); + asort($wsort); + + $playercol = 1; + if (count($wsort) < 3) { + $one = true; + $colspan = 5; + if (count($psort) == 1) { + $playercol = 0; + } + } else { + $one = false; + $colspan = 1; + } + + echo' + + + + + '; + + + if ($one) { + ws_header($wsort, $weapons, $colspan, $one, $playercol); + echo ''; + foreach($wsort as $wid => $bar) { + for ($i = 1; $i <= $colspan; $i++) { + switch($i) { + case 1: $extra = 'Kills'; break; + case 2: $extra = 'Shots'; break; + case 3: $extra = 'Hits'; break; + case 4: $extra = 'Acc'; break; + case 5: $extra = 'Dmg'; break; + } + $extra = ''. $extra .''; + echo ' + '; + } + } + echo ''; + + $i = 0; + foreach($psort as $pid => $foo) { + $i++; + echo ''; + if ($playercol) { + echo ' + '; + } + foreach($wsort as $wid => $bar) { + ws_cell($wd, $pid, $wid, 'kills', $i); + ws_cell($wd, $pid, $wid, 'shots', $i); + ws_cell($wd, $pid, $wid, 'hits', $i); + ws_cell($wd, $pid, $wid, 'acc', $i); + ws_cell($wd, $pid, $wid, 'damage', $i); + } + echo ''; + } + } + + if (!$one) { + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Kills', 'kills'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Shots', 'shots'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Hits', 'hits'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Damage', 'damage'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Accuracy', 'acc'); + } + + + echo '
'.htmlentities($title).'
'.$extra.'
'.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).'
'; +} + +function ws_header(&$wsort, &$weapons, $colspan, $one, $playercol) { + echo ''; + if ($playercol and $playercol != -1) echo 'Player'; + if ($playercol == -1) echo ' '; + foreach($wsort as $wid => $bar) { + if (!empty($weapons[$wid]['image'])) { + $content = ''.$weapons[$wid]['name'].''; + } else { + $content = ''.$weapons[$wid]['name'].''; + } + echo ''.$content.''; + + } + echo ''; +} + + +function ws_cell(&$wd, $pid, $wid, $field, $i) { + $content = ''; + if (isset($wd[$pid][$wid][$field])) $content = $wd[$pid][$wid][$field]; + $class = ($i % 2) ? 'grey' : 'grey2'; + echo ' + '.$content.''; +} + + + + +function ws_block(&$wd, &$weapons, &$wsort, &$psort, &$colspan, $playercol, $one,$_mid, $gamename, $caption, $field) { + global $gamename, $gid; + if (count($psort) != 1) { + echo ' + + + + + '.$caption.' + '; + ws_header($wsort, $weapons, $colspan, $one, $playercol); + } + if (count($psort) == 1) { + $playercol = -1; + if ($field == 'kills') ws_header($wsort, $weapons, $colspan, $one, $playercol); + } + + $i = 0; + foreach($psort as $pid => $foo) { + $i++; + echo ''; + if ($playercol and $playercol != -1) echo ''.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).''; + if ($playercol == -1) echo ''.$caption.''; + foreach($wsort as $wid => $bar) { + ws_cell($wd, $pid, $wid, $field, $i); + } + echo ''; + } +} +?> \ No newline at end of file -- cgit