Moved the Agents into their own repo. Kept the agent.pl just for reference
|
|
@ -1,161 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
require "modules/lgsl_with_img_mod/lgsl_files/lgsl_class.php";
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
$type = isset($_GET['lgsl_type'])? lgsl_string_html($_GET['lgsl_type']): "";
|
||||
$ip = isset($_GET['ip']) ? lgsl_string_html($_GET['ip']) : "";
|
||||
$c_port = isset($_GET['c_port']) ? intval($_GET['c_port']) : 0;
|
||||
$q_port = isset($_GET['q_port']) ? intval($_GET['q_port']) : 0;
|
||||
$s_port = isset($_GET['s_port']) ? intval($_GET['s_port']) : 0;
|
||||
$request = isset($_GET['request']) ? lgsl_string_html($_GET['request']) : "";
|
||||
$version = isset($_GET['version']) ? lgsl_string_html($_GET['version']) : "";
|
||||
$xml = isset($_GET['xml']) ? intval($_GET['xml']) : 0;
|
||||
$format = isset($_GET['format']) ? intval($_GET['format']) : 0;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// VALIDATE REQUEST
|
||||
|
||||
if (!$type || !$ip || !$c_port || !$q_port || !$request)
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: INCOMPLETE REQUEST"; return;
|
||||
}
|
||||
|
||||
if ($q_port > 99999 || $q_port < 1024)
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: INVALID QUERY PORT: '{$q_port}'"; return;
|
||||
}
|
||||
|
||||
if (preg_match("/[^0-9a-z\.\-\[\]\:]/i", $ip))
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: INVALID IP OR HOSTNAME: '{$ip}'"; return;
|
||||
}
|
||||
|
||||
if (preg_match("/[^a-z]/", $request))
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: INVALID REQUEST: '{$request}'"; return;
|
||||
}
|
||||
|
||||
if ($type == "test")
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: TYPE 'test' IS NOT ALLOWED"; return;
|
||||
}
|
||||
|
||||
$lgsl_protocol_list = lgsl_protocol_list();
|
||||
|
||||
if (!isset($lgsl_protocol_list[$type]))
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: ".($type ? "UNKNOWN TYPE '{$type}'" : "MISSING TYPE")." FOR {$ip} : {$c_port} : {$q_port} : {$s_port}"; return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// FILTER HOSTNAME AND IP FORMATS THAT PHP ACCEPTS BUT ARE NOT WANTED
|
||||
|
||||
if (preg_match("/(\[[0-9a-z\:]+\])/iU", $ip, $match)) { $ip = $match[1]; }
|
||||
elseif (preg_match("/([0-9a-z\.\-]+)/i", $ip, $match)) { $ip = $match[1]; }
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// CHECK PUBLIC FEED SETTING AND EITHER ADD [a] REQUEST OR ENSURE [a] IS REMOVED
|
||||
|
||||
$request = $lgsl_config['public_feed'] ? $request."a" : str_replace("a", "", $request);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// QUERY SERVER
|
||||
|
||||
$server = lgsl_query_cached($type, $ip, $c_port, $q_port, $s_port, $request);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// ADD THE FEED PROVIDER
|
||||
|
||||
if ($server['e']) { $server['e']['_feed_'] = "http://{$_SERVER['HTTP_HOST']}"; }
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// FEED USAGE LOGGING - 'logs' FOLDER MUST BE MANUALLY CREATED AND SET AS WRITABLE
|
||||
|
||||
if (is_dir("logs") && is_writable("logs"))
|
||||
{
|
||||
// $file_path = "logs/log_feed.html";
|
||||
$file_path = "logs/log_feed_{$_SERVER['REMOTE_ADDR']}.html";
|
||||
|
||||
if (filesize($file_path) > 1234567) { unlink($file_path); }
|
||||
|
||||
$file_handle = fopen($file_path, "a");
|
||||
|
||||
$file_string = "
|
||||
[ ".date("Y/m/d H:i:s")." ] {$type}:{$ip}:{$c_port}:{$q_port}:{$s_port}:{$request}
|
||||
[ <a href='http://".lgsl_string_html($_SERVER['REMOTE_ADDR']) ."'>".lgsl_string_html($_SERVER['REMOTE_ADDR']) ."</a> ]
|
||||
[ <a href='" .lgsl_string_html($_SERVER['HTTP_REFERER'])."'>".lgsl_string_html($_SERVER['HTTP_REFERER'])."</a> ]
|
||||
".($version ? " [ {$version} ] " : "")."
|
||||
".($xml ? " [ XML ] " : "")."
|
||||
<br />";
|
||||
|
||||
fwrite($file_handle, $file_string);
|
||||
|
||||
fclose($file_handle);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// SERIALIZED OUTPUT
|
||||
|
||||
if (!$xml)
|
||||
{
|
||||
if ($format == 0) { echo "_SLGSLF_".serialize($server)."_SLGSLF_"; return; } // LEGACY SYSTEM ( 5.6 AND OLDER )
|
||||
|
||||
if (($format == 3 || $format == 4) && function_exists("json_encode"))
|
||||
{
|
||||
if ($format == 4 && function_exists("gzcompress")) { echo "_F4_".base64_encode(gzcompress(json_encode($server)))."_F4_"; return; }
|
||||
else { echo "_F3_".base64_encode( json_encode($server)). "_F3_"; return; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($format == 2 && function_exists("gzcompress")) { echo "_F2_".base64_encode(gzcompress(serialize($server)))."_F2_"; return; }
|
||||
else { echo "_F1_".base64_encode( serialize($server)). "_F1_"; return; }
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// XML OUTPUT
|
||||
|
||||
header("content-type: text/xml");
|
||||
|
||||
echo "<?xml version='1.0' encoding='UTF-8' ?>\r\n<server>\r\n";
|
||||
|
||||
foreach ($server as $a => $b)
|
||||
{
|
||||
echo "<".lgsl_string_html($a, TRUE).">";
|
||||
|
||||
foreach ($b as $c => $d)
|
||||
{
|
||||
if (is_array($d))
|
||||
{
|
||||
echo "<player>\r\n";
|
||||
|
||||
foreach ($d as $e => $f)
|
||||
{
|
||||
echo "<".lgsl_string_html($e, TRUE).">".lgsl_string_html($f, TRUE)."</".lgsl_string_html($e, TRUE).">\r\n";
|
||||
}
|
||||
|
||||
echo "</player>\r\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<".lgsl_string_html($c, TRUE).">".lgsl_string_html($d, TRUE)."</".lgsl_string_html($c, TRUE).">\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "</".lgsl_string_html($a, TRUE).">\r\n";
|
||||
}
|
||||
|
||||
echo "</server>\r\n";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
|
@ -1,476 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// Basic Dynamic Server Image Status addon for LGSL by MadMakz (http://madmakz.com) for Cyber Games X24 (http://cgx24.com/).
|
||||
// Tested & written for LGSL v5.8 (Might work with older/newer versions too)
|
||||
// Version: 1.6-dev
|
||||
// Licence: Nobody cares anyway, use it for whatever you want as long you do not sell/re-sell or steal the credits it´s fine.
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
// CUSTOM FUNCTIONS
|
||||
|
||||
function pretty_text($im, $fontsize, $x, $y, $string, $color, $outline = false)
|
||||
{
|
||||
$black = imagecolorallocate($bgImg, 0, 0, 0);
|
||||
|
||||
// Black outline
|
||||
if($outline){
|
||||
imagestring($im, $fontsize, $x - 1, $y - 1, $string, $black);
|
||||
imagestring($im, $fontsize, $x - 1, $y, $string, $black);
|
||||
imagestring($im, $fontsize, $x - 1, $y + 1, $string, $black);
|
||||
imagestring($im, $fontsize, $x, $y - 1, $string, $black);
|
||||
imagestring($im, $fontsize, $x, $y + 1, $string, $black);
|
||||
imagestring($im, $fontsize, $x + 1, $y - 1, $string, $black);
|
||||
imagestring($im, $fontsize, $x + 1, $y, $string, $black);
|
||||
imagestring($im, $fontsize, $x + 1, $y + 1, $string, $black);
|
||||
}
|
||||
|
||||
// Your text
|
||||
imagestring($im, $fontsize, $x, $y, $string, $color);
|
||||
return $im;
|
||||
}
|
||||
|
||||
|
||||
function pretty_text_ttf($im, $fontsize, $angle, $x, $y, $color, $font, $string, $outline = false)
|
||||
{
|
||||
$black = imagecolorallocate($bgImg, 0, 0, 0);
|
||||
|
||||
// Black outline
|
||||
if($outline){
|
||||
imagettftext($im, $fontsize, $angle, $x - 1, $y - 1, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x - 1, $y, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x - 1, $y + 1, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x, $y - 1, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x, $y + 1, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x + 1, $y - 1, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x + 1, $y, $black, $font, $string);
|
||||
imagettftext($im, $fontsize, $angle, $x + 1, $y + 1, $black, $font, $string);
|
||||
}
|
||||
|
||||
// Your text
|
||||
imagettftext($im, $fontsize, $angle, $x, $y, $color, $font, $string);
|
||||
return $im;
|
||||
}
|
||||
|
||||
|
||||
function lgsl_lookup_ip($ip, $port)
|
||||
{
|
||||
global $db;
|
||||
$ip = $db->realEscapeSingle($ip);
|
||||
$port = $db->realEscapeSingle($port);
|
||||
|
||||
$result = $db->resultQuery("SELECT `id` FROM `OGP_DB_PREFIXlgsl` WHERE `ip`='{$ip}' AND c_port='{$port}' LIMIT 1");
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
|
||||
function error_img($msg, $id, $type)
|
||||
{
|
||||
if(empty($type)) { $type = "normal"; }
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default_{$type}.png";
|
||||
if (!file_exists($bgimg)) {
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default.png";
|
||||
}
|
||||
|
||||
$im = imagecreatefrompng($bgimg);
|
||||
$text_color = ImageColorAllocate($im,255,0,0);
|
||||
|
||||
switch($type){
|
||||
case "normal":
|
||||
imagestring($im,6,2,5,"ERROR! ID/IP: ".$id,$text_color);
|
||||
imagestring($im,5,2,20,$msg,$text_color);
|
||||
break;
|
||||
case "small":
|
||||
imagestring($im,6,2,0,"ERROR! ID/IP: ".$id,$text_color);
|
||||
imagestring($im,5,2,10,$msg,$text_color);
|
||||
break;
|
||||
case "sky":
|
||||
$misc['image_map'] = "modules/lgsl_with_img_mod/lgsl_files/other/map_no_response.jpg";
|
||||
$im_map_info = getimagesize($misc['image_map']);
|
||||
$im_map = imagecreatefromjpeg($misc['image_map']);
|
||||
$im_map_width = 130;
|
||||
$im_map_height = 120;
|
||||
$im_map_posx = 25;
|
||||
$im_map_posy = 112;
|
||||
|
||||
imagecopyresampled($im, $im_map, $im_map_posx, $im_map_posy, 0, 0, $im_map_width, $im_map_height, $im_map_info[0], $im_map_info[1]);
|
||||
imagestring($im,1,6,28,"ERROR! ID/IP: ".$id,$text_color);
|
||||
imagestring($im,1,6,45,$msg,$text_color);
|
||||
break;
|
||||
}
|
||||
make_img($im);
|
||||
}
|
||||
|
||||
|
||||
function make_img($im = false, $cache_on = false, $cache_data = false, $force_cached = false, $format = false)
|
||||
{
|
||||
header("Content-type: image/png");
|
||||
|
||||
if($cache_on && $cache_data["file"]){
|
||||
$expire = gmdate("D, d M Y H:i:s", $cache_data["cache_expire"])." GMT";
|
||||
//$last = gmdate("D, d M Y H:i:s", filemtime($cache_data["file"]))." GMT";
|
||||
|
||||
header("Expires: ".$expire);
|
||||
|
||||
if(!$force_cached){ imagepng($im, $cache_data["file"], 9); }
|
||||
readfile($cache_data["file"]);
|
||||
}
|
||||
else{ imagepng($im, null, 9); }
|
||||
|
||||
imagedestroy($im);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
function lgsl_cache_info($id)
|
||||
{
|
||||
global $db;
|
||||
$id = $db->realEscapeSingle($id);
|
||||
$result = $db->resultQuery("SELECT `cache_time` FROM `OGP_DB_PREFIXlgsl` WHERE `id`='{$id}' LIMIT 1");
|
||||
return empty($result[0]['cache_time']) ? array(0,0,0) : explode("_", $result[0]['cache_time']);
|
||||
}
|
||||
|
||||
|
||||
function cleaninput($input)
|
||||
{
|
||||
$remove = array("#\\\\+#", "#/+#", "#\\+#", "#\s+#", "#http+#", "#ftp+#", "#%00+#", "#\\0+#", "#\\x00+#", "#\(+#", "#\)+#", "#\{+#", "#\}+#");
|
||||
// Some rules might be paranoid
|
||||
|
||||
$input = preg_replace($remove, "", $input);
|
||||
$input = htmlspecialchars($input, ENT_QUOTES);
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// SETTINGS
|
||||
|
||||
$cache_enable = true; // true/false // Enable/Disable Caching of generated images
|
||||
$name_type_vertical = false; // false/true // Global default/fallback for printing the Servername verticaly on "Sky" images.
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// GET THE LGSL CORE
|
||||
|
||||
require_once "modules/lgsl_with_img_mod/lgsl_files/lgsl_class.php";
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
error_reporting(0);
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// GET THE SERVER DETAILS AND PREPARE IT FOR DISPLAY
|
||||
$s = cleaninput($_GET['s']);
|
||||
|
||||
if (strpos($s, ":")){
|
||||
$is_ip = true;
|
||||
$s2 = explode(":", $s, 2);
|
||||
}
|
||||
if (strpos($s, "_")){
|
||||
$is_ip = true;
|
||||
$s2 = explode("_", $s, 2);
|
||||
}
|
||||
|
||||
if ($is_ip){
|
||||
$lookup = lgsl_lookup_ip($s2[0], $s2[1]);
|
||||
$lgsl_server_id = $lookup['id'];
|
||||
if(!$lookup){
|
||||
$s2[0] = gethostbyname($s2[0]);
|
||||
$lookup = lgsl_lookup_ip($s2[0], $s2[1]);
|
||||
$lgsl_server_id = $lookup['id'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$lookup = $s;
|
||||
$lgsl_server_id = $s;
|
||||
}
|
||||
|
||||
if($lookup){
|
||||
$server = lgsl_query_cached("", "", "", "", "", "sep", $lgsl_server_id);
|
||||
$fields = lgsl_sort_fields($server, $fields_show, $fields_hide, $fields_other);
|
||||
$server = lgsl_sort_players($server);
|
||||
$server = lgsl_sort_extras($server);
|
||||
$misc = lgsl_server_misc($server);
|
||||
}
|
||||
|
||||
if(!$lookup || !$server){
|
||||
if(!$is_ip){ error_img("This server does not exist in Database", $s, cleaninput($_GET['img_type'])); }
|
||||
else { error_img("This server does not exist in Database", $s2[0].":".$s2[1], cleaninput($_GET['img_type'])); }
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// PREPARE THE IMAGE INFOS
|
||||
// WHAT BACKGROUND IMAGE WE USE. THE LAYOUT IS "image/<GAMETYPE>/<GAME>_<IMGTYPE>.png"
|
||||
|
||||
$type = cleaninput($_GET['img_type']);
|
||||
if (empty($type)){
|
||||
$type = "normal";
|
||||
}
|
||||
|
||||
$bgimg = cleaninput($_GET['bg']);
|
||||
if (empty($bgimg)){
|
||||
$bgimg = "{$server['b']['type']}/{$server['s']['game']}";
|
||||
}
|
||||
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/{$bgimg}_{$type}.png";
|
||||
|
||||
// IMAGE CACHE
|
||||
$cache_dir_prefix = "modules/lgsl_with_img_mod/lgsl_files/image";
|
||||
$cache_file = "modules/lgsl_with_img_mod/lgsl_files/image/cache/".$server['b']['ip']."_".$server['b']['c_port']."-".$type;
|
||||
$cache_time = lgsl_cache_info($lgsl_server_id);
|
||||
$cache_time_expire = $cache_time[0];
|
||||
$cache = array("file" => $cache_file, "cache_expire" => $cache_time_expire);
|
||||
|
||||
if($cache_enable && file_exists($cache["file"])){
|
||||
if((time() - filemtime($cache["file"]) < $lgsl_config['cache_time']) || $server['b']['pending']){
|
||||
make_img(false, true, $cache, true);
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK IF BACKGROUND IMAGE EXISTS, IF NOT USE DEFAULT
|
||||
if (!file_exists($bgimg)) {
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default_{$type}.png";
|
||||
if (!file_exists($bgimg)) {
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default.png";
|
||||
$type = "INVALID";
|
||||
}
|
||||
}
|
||||
if($server['disabled'] == 1){
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default_{$type}.png";
|
||||
if (!file_exists($bgimg)) {
|
||||
$bgimg = "modules/lgsl_with_img_mod/lgsl_files/image/default.png";
|
||||
$type = "INVALID";
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// GET THE REQUIRED VARIABLES FROM LGSL
|
||||
// Rename status "NO RESPONSE" into "OFFLINE"
|
||||
if ($misc['text_status']=="NO RESPONSE"){
|
||||
$misc['text_status'] = "Offline";
|
||||
}
|
||||
|
||||
// Dummies
|
||||
$string0 = "";
|
||||
$string1 = "";
|
||||
$string2 = "";
|
||||
$string3 = "";
|
||||
$string4 = "";
|
||||
|
||||
// If available; Strip Bots from current player and seperate true/total ammount.
|
||||
// Currently that only works on Sourcegames or any other game wich defines the bot ammount via "bots" tag in querry.
|
||||
// There are probably more games wich provide bot ammount info via querry, taged as "bots" or under other name.
|
||||
// Output format is: Trueplayers (Totalplayers)/Maxplayers
|
||||
$botinfo = true;
|
||||
$trueplayers = $server['s']['players'] - $server['e']['bots'];
|
||||
$slotusage = "{$server['s']['players']}/{$server['s']['playersmax']}";
|
||||
|
||||
if(!$server['e']||!$server['e']['bots']||$server['e']['bots']=""){ $botinfo = false; }
|
||||
|
||||
if($botinfo){
|
||||
$slotusage = "{$trueplayers} ({$server['s']['players']})/{$server['s']['playersmax']}";
|
||||
}
|
||||
|
||||
// And now for real, first we do a little exeption for Left4Dead/2 (and TF2) since they have long mapnames wich would blow out on "small" image type
|
||||
// as workarround we just remove the "Status" line
|
||||
if($server['disabled'] == 0){
|
||||
if ($server['s']['game']=="left4dead" || $server['s']['game']=="left4dead2" || $server['s']['game']=="tf" && $type=="small"){
|
||||
$string0 = $server['s']['name'];
|
||||
$string1 = "{$server['b']['ip']}:{$server['b']['c_port']}";
|
||||
$string2 = $server['s']['map'];
|
||||
$string4 = $slotusage;
|
||||
}
|
||||
else{
|
||||
$string0 = $server['s']['name'];
|
||||
$string1 = "{$server['b']['ip']}:{$server['b']['c_port']}";
|
||||
$string2 = $server['s']['map'];
|
||||
$string3 = $slotusage;
|
||||
$string4 = ucfirst(strtolower($misc['text_status']));
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// DEFINE CREATE IMAGE FROM IMAGE SOURCE
|
||||
|
||||
$im = imagecreatefrompng($bgimg);
|
||||
|
||||
// MAP
|
||||
if($server['disabled'] == 1){
|
||||
$misc['image_map'] = "modules/lgsl_with_img_mod/lgsl_files/other/map_no_response.jpg";
|
||||
}
|
||||
|
||||
// Adjust image map:
|
||||
if(cURLEnabled()){
|
||||
$misc['image_map'] = curlCacheImage($cache_dir_prefix, $misc['image_map']);
|
||||
}else{
|
||||
stream_context_set_default(
|
||||
array(
|
||||
'http' => array(
|
||||
'method' => 'GET',
|
||||
'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0',
|
||||
'header'=>'Referer: http://gametracker.com'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$im_map_info = getimagesize($misc['image_map']);
|
||||
if ($im_map_info[2] == 1) { $im_map = imagecreatefromgif($misc['image_map']); }
|
||||
if ($im_map_info[2] == 2) { $im_map = imagecreatefromjpeg($misc['image_map']); }
|
||||
if ($im_map_info[2] == 3) { $im_map = imagecreatefrompng($misc['image_map']); }
|
||||
|
||||
if($server['disabled'] == 0){
|
||||
// GAMEICON
|
||||
$im_icon_info = getimagesize($misc['icon_game']);
|
||||
if ($im_icon_info[2] == 1) { $im_icon = imagecreatefromgif($misc['icon_game']); }
|
||||
if ($im_icon_info[2] == 2) { $im_icon = imagecreatefromjpeg($misc['icon_game']); }
|
||||
if ($im_icon_info[2] == 3) { $im_icon = imagecreatefrompng($misc['icon_game']); }
|
||||
|
||||
// GEO IP (optional)
|
||||
if (file_exists("modules/lgsl_with_img_mod/lgsl_files/geoip.inc.php")){
|
||||
$geoip = true;
|
||||
require_once "modules/lgsl_with_img_mod/lgsl_files/geoip.inc.php";
|
||||
|
||||
$gi = geoip_open( "modules/lgsl_with_img_mod/lgsl_files/GeoIP.dat", GEOIP_STANDARD );
|
||||
$clookup = geoip_country_code_by_addr($gi, $server['b']['ip']);
|
||||
if (empty($clookup)){ $clookup = geoip_country_code_by_name($gi, $server['b']['ip']); }
|
||||
$clookup = strtolower($clookup);
|
||||
$cimg = "images/countries/{$clookup}.png";
|
||||
if (!file_exists($cimg)) { $cimg = "images/countries/noflag.png"; }
|
||||
$cimage_info = getimagesize($cimg);
|
||||
$cimage = imagecreatefrompng($cimg);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// TEXT COLOR & FORMATING. PLAY WITH IT!
|
||||
// WE USE 2 FONTS HERE, FIRST IS FOR THE HEADING/SERVERNAME (UTF-8), SECOND IS FOR THE CONTENT SUCH AS CURRENT MAP
|
||||
$text_font0 = "modules/lgsl_with_img_mod/lgsl_files/image/_font/Cyberbas.ttf";
|
||||
|
||||
$size0 = 10; //Normal
|
||||
$size2 = 12; //Small
|
||||
$size4 = 9; //Sky
|
||||
|
||||
$text_font1 = "modules/lgsl_with_img_mod/lgsl_files/image/_font/Sansation_Regular.ttf";
|
||||
|
||||
$size1 = 10; //Normal
|
||||
$size3 = 10; //Small
|
||||
$size5 = 9; //Sky
|
||||
|
||||
// TEXT SETTINGS
|
||||
if (file_exists("modules/lgsl_with_img_mod/lgsl_files/image/color_settings.php")){
|
||||
include_once "modules/lgsl_with_img_mod/lgsl_files/image/color_settings.php";
|
||||
}
|
||||
|
||||
// Fallback/default Textcolor
|
||||
if(!$text_color0){
|
||||
$text_color0 = ImageColorAllocate($im,245,250,1);
|
||||
}
|
||||
if(!$text_color1){
|
||||
$text_color1 = ImageColorAllocate($im,1,250,1);
|
||||
}
|
||||
|
||||
// Fallback/default for the Text outline
|
||||
if (!$txt_outline){
|
||||
switch($type){
|
||||
case "small":
|
||||
$txt_outline = false;
|
||||
break;
|
||||
case "normal":
|
||||
$txt_outline = false;
|
||||
break;
|
||||
case "sky":
|
||||
$txt_outline = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// LOCATIONS/TYPES
|
||||
|
||||
switch($type){
|
||||
case "normal":
|
||||
if ($geoip){ imagecopyresampled($im, $cimage, 245, 35, 0, 0, 16, 11, $cimage_info[0], $cimage_info[1]); } // Country
|
||||
pretty_text_ttf($im,$size4,0,2,15,$text_color1,$text_font0,substr($string0,0,60), $txt_outline); // Servername
|
||||
pretty_text_ttf($im,$size4,0,65,45,$text_color0,$text_font1,$string1, $txt_outline); // IP:PORT
|
||||
pretty_text_ttf($im,$size1,0,65,63,$text_color0,$text_font1,$string2, $txt_outline); // Map
|
||||
pretty_text_ttf($im,$size1,0,292,45,$text_color0,$text_font1,$string3, $txt_outline); // Players
|
||||
pretty_text_ttf($im,$size1,0,293,63,$text_color0,$text_font1,$string4, $txt_outline); // Status
|
||||
break;
|
||||
|
||||
case "small":
|
||||
if ($geoip){ imagecopyresampled($im, $cimage, 315, 1, 0, 0, 16, 11, $cimage_info[0], $cimage_info[1]); } // Country
|
||||
pretty_text_ttf($im,$size0,0,2,10,$text_color1,$text_font0,substr($string0,0,45), $txt_outline); // Servername
|
||||
pretty_text_ttf($im,$size3,0,2,24,$text_color0,$text_font1,substr($string1,0,20), $txt_outline); // IP:Port
|
||||
pretty_text_ttf($im,$size3,0,145,24,$text_color0,$text_font1,$string2, $txt_outline); // Map
|
||||
pretty_text_ttf($im,$size3,0,255,24,$text_color0,$text_font1,$string3, $txt_outline); // Players
|
||||
pretty_text_ttf($im,$size3,0,295,24,$text_color0,$text_font1,$string4, $txt_outline); // Status
|
||||
break;
|
||||
|
||||
case "sky":
|
||||
// DEFINE
|
||||
$im_map_width = 160;
|
||||
$im_map_height = 120;
|
||||
$im_map_posx = 10;
|
||||
$im_map_posy = 125;
|
||||
|
||||
$im_icon_width = 16;
|
||||
$im_icon_height = 16;
|
||||
$im_icon_posx = 16;
|
||||
$im_icon_posy = 127;
|
||||
|
||||
imagecopyresampled($im, $im_map, $im_map_posx, $im_map_posy, 0, 0, $im_map_width, $im_map_height, $im_map_info[0], $im_map_info[1]); // Mapimage
|
||||
if($server['disabled'] == 0){
|
||||
imagecopyresampled($im, $im_icon, $im_icon_posx, $im_icon_posy, 0, 0, $im_icon_width, $im_icon_height, $im_icon_info[0], $im_icon_info[1]); // Gameicon
|
||||
if ($geoip){ imagecopyresampled($im, $cimage, $im_icon_posx + 132, $im_icon_posy, 0, 0, 16, 11, $cimage_info[0], $cimage_info[1]); } // Country
|
||||
}
|
||||
if($name_type_vertical){ pretty_text_ttf($im,$size4,270,5,20,$text_color1,$text_font0,substr($string0,0,28), $txt_outline); } // Servername Vertical
|
||||
else{ pretty_text_ttf($im,$size4,0,10,15,$text_color1,$text_font0,substr($string0,0,26), $txt_outline); } // Servername
|
||||
pretty_text_ttf($im,$size5,0,5,30,$text_color0,$text_font1,"IP:Port: ".substr($string1,0,20), $txt_outline); // IP:Port
|
||||
pretty_text_ttf($im,$size5,0,5,52,$text_color0,$text_font1,"Map : ".substr($string2,0,20), $txt_outline); // Map
|
||||
pretty_text_ttf($im,$size5,0,5,74,$text_color0,$text_font1,"Players: ".$string3, $txt_outline); // Players
|
||||
pretty_text_ttf($im,$size5,0,5,96,$text_color0,$text_font1,"Status : ".substr($string4,0,20), $txt_outline); // Status
|
||||
break;
|
||||
|
||||
// WHATEVER HAPPENS, ALWAYS PRINT SOMETHING & HOPE THAT AT LEAST THE DEFAULT IMAGE EXISTS...
|
||||
default:
|
||||
$text_color0 = ImageColorAllocate($im,0,0,0);
|
||||
imagettftext($im,11,0,10,14,$text_color0,$text_font0,$string0);
|
||||
imagettftext($im,10,0,10,34,$text_color0,$text_font1,$string1);
|
||||
imagettftext($im,10,0,10,54,$text_color0,$text_font1,$string2);
|
||||
imagettftext($im,10,0,10,74,$text_color0,$text_font1,$string3);
|
||||
imagettftext($im,10,0,10,94,$text_color0,$text_font1,$string4);
|
||||
break;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// NOW LET THE MAGIC HAPPEN AND PULL ALL THAT INTO AN IMAGE.
|
||||
make_img($im, $cache_enable, $cache);
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
echo "<h2>LGSL</h2>";
|
||||
global $output, $lgsl_server_id;
|
||||
|
||||
$output = "";
|
||||
|
||||
$s = isset($_GET['s']) ? $_GET['s'] : "";
|
||||
|
||||
if (is_numeric($s)) { $lgsl_server_id = $s; require "lgsl_files/lgsl_details.php"; }
|
||||
elseif ($s == "add") { require "lgsl_files/lgsl_add.php"; }
|
||||
else { require "lgsl_files/lgsl_list.php"; }
|
||||
|
||||
echo $output;
|
||||
|
||||
unset($output);
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
function exec_ogp_module()
|
||||
{
|
||||
echo "<h2>LGSL Admin</h2>";
|
||||
require "modules/lgsl_with_img_mod/lgsl_files/lgsl_config.php";
|
||||
define("LGSL_ADMIN", TRUE);
|
||||
global $output;
|
||||
$output = "";
|
||||
require "modules/lgsl_with_img_mod/lgsl_files/lgsl_admin.php";
|
||||
echo $output;
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,499 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
|
||||
/* geoip.inc
|
||||
*
|
||||
* Copyright (C) 2007 MaxMind LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
define("GEOIP_COUNTRY_BEGIN", 16776960);
|
||||
define("GEOIP_STATE_BEGIN_REV0", 16700000);
|
||||
define("GEOIP_STATE_BEGIN_REV1", 16000000);
|
||||
define("GEOIP_STANDARD", 0);
|
||||
define("GEOIP_MEMORY_CACHE", 1);
|
||||
define("GEOIP_SHARED_MEMORY", 2);
|
||||
define("STRUCTURE_INFO_MAX_SIZE", 20);
|
||||
define("DATABASE_INFO_MAX_SIZE", 100);
|
||||
define("GEOIP_COUNTRY_EDITION", 106);
|
||||
define("GEOIP_PROXY_EDITION", 8);
|
||||
define("GEOIP_ASNUM_EDITION", 9);
|
||||
define("GEOIP_NETSPEED_EDITION", 10);
|
||||
define("GEOIP_REGION_EDITION_REV0", 112);
|
||||
define("GEOIP_REGION_EDITION_REV1", 3);
|
||||
define("GEOIP_CITY_EDITION_REV0", 111);
|
||||
define("GEOIP_CITY_EDITION_REV1", 2);
|
||||
define("GEOIP_ORG_EDITION", 110);
|
||||
define("GEOIP_ISP_EDITION", 4);
|
||||
define("SEGMENT_RECORD_LENGTH", 3);
|
||||
define("STANDARD_RECORD_LENGTH", 3);
|
||||
define("ORG_RECORD_LENGTH", 4);
|
||||
define("MAX_RECORD_LENGTH", 4);
|
||||
define("MAX_ORG_RECORD_LENGTH", 300);
|
||||
define("GEOIP_SHM_KEY", 0x4f415401);
|
||||
define("US_OFFSET", 1);
|
||||
define("CANADA_OFFSET", 677);
|
||||
define("WORLD_OFFSET", 1353);
|
||||
define("FIPS_RANGE", 360);
|
||||
define("GEOIP_UNKNOWN_SPEED", 0);
|
||||
define("GEOIP_DIALUP_SPEED", 1);
|
||||
define("GEOIP_CABLEDSL_SPEED", 2);
|
||||
define("GEOIP_CORPORATE_SPEED", 3);
|
||||
|
||||
class GeoIP {
|
||||
var $flags;
|
||||
var $filehandle;
|
||||
var $memory_buffer;
|
||||
var $databaseType;
|
||||
var $databaseSegments;
|
||||
var $record_length;
|
||||
var $shmid;
|
||||
var $GEOIP_COUNTRY_CODE_TO_NUMBER = array(
|
||||
"" => 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, "BL" => 251,
|
||||
"MF" => 252
|
||||
);
|
||||
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", "BL", "MF"
|
||||
);
|
||||
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","BLM","MAF"
|
||||
);
|
||||
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","Saint Barthelemy","Saint Martin"
|
||||
);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
// Custom
|
||||
switch($server['s']['game']){
|
||||
case "nucleardawn":
|
||||
switch($type){
|
||||
case "small":
|
||||
$txt_outline = true;
|
||||
$text_color0 = ImageColorAllocate($im, 255, 149, 56);
|
||||
break;
|
||||
case "normal":
|
||||
$txt_outline = true;
|
||||
$text_color0 = ImageColorAllocate($im, 255, 149, 56);
|
||||
break;
|
||||
case "sky":
|
||||
$name_type_vertical = true;
|
||||
$txt_outline = true;
|
||||
$text_color1 = ImageColorAllocate($im, 255, 149, 56);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
|
@ -1,396 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (!defined("LGSL_ADMIN")) { exit("DIRECT ACCESS ADMIN FILE NOT ALLOWED"); }
|
||||
|
||||
require "lgsl_class.php";
|
||||
|
||||
global $db;
|
||||
|
||||
$lgsl_type_list = lgsl_type_list(); asort($lgsl_type_list);
|
||||
$lgsl_protocol_list = lgsl_protocol_list();
|
||||
|
||||
$id = 0;
|
||||
$last_type = "source";
|
||||
$zone_list = array(0,1,2,3,4,5,6,7,8);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (!function_exists("fsockopen") && !$lgsl_config['feed']['method'])
|
||||
{
|
||||
if ((function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec")))
|
||||
{
|
||||
$output = "<div style='text-align:center'><br /><br /><b>FSOCKOPEN IS DISABLED - YOU MUST ENABLE THE FEED OPTION</b><br /><br /></div>".lgsl_help_info(); return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = "<div style='text-align:center'><br /><br /><b>FSOCKOPEN AND CURL ARE DISABLED - LGSL WILL NOT WORK ON THIS HOST</b><br /><br /></div>".lgsl_help_info(); return;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if ($_POST && get_magic_quotes_gpc()) { $_POST = lgsl_stripslashes_deep($_POST); }
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (!empty($_POST['lgsl_save_1']) || !empty($_POST['lgsl_save_2']))
|
||||
{
|
||||
if (!empty($_POST['lgsl_save_1']))
|
||||
{
|
||||
// LOAD SERVER CACHE INTO MEMORY
|
||||
$results = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl`");
|
||||
foreach($results as $row)
|
||||
{
|
||||
$servers["{$row['type']}:{$row['ip']}:{$row['q_port']}"] = array($row['status'], $row['cache'], $row['cache_time']);
|
||||
}
|
||||
}
|
||||
|
||||
// EMPTY SQL TABLE
|
||||
$db->query("TRUNCATE `OGP_DB_PREFIXlgsl`");
|
||||
|
||||
// CONVERT ADVANCED TO NORMAL DATA FORMAT
|
||||
if (!empty($_POST['lgsl_management']))
|
||||
{
|
||||
$form_lines = preg_split('/\r?\n|\r|(\\\r)?\\\n|\\\r/', $_POST['form_list']);
|
||||
|
||||
foreach ($form_lines as $form_key => $form_line)
|
||||
{
|
||||
list($_POST['form_type'] [$form_key],
|
||||
$_POST['form_ip'] [$form_key],
|
||||
$_POST['form_c_port'] [$form_key],
|
||||
$_POST['form_q_port'] [$form_key],
|
||||
$_POST['form_s_port'] [$form_key],
|
||||
$_POST['form_zone'] [$form_key],
|
||||
$_POST['form_disabled'][$form_key],
|
||||
$_POST['form_comment'] [$form_key]) = explode(":", "{$form_line}:::::::");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_POST['form_type'] as $form_key => $not_used)
|
||||
{
|
||||
// COMMENTS LEFT IN THEIR NATIVE ENCODING WITH JUST HTML SPECIAL CHARACTERS CONVERTED
|
||||
$_POST['form_comment'][$form_key] = lgsl_htmlspecialchars($_POST['form_comment'][$form_key]);
|
||||
|
||||
$type = $db->real_escape_string( strtolower(trim($_POST['form_type'] [$form_key])));
|
||||
$ip = $db->real_escape_string( trim($_POST['form_ip'] [$form_key]));
|
||||
$c_port = $db->real_escape_string( intval(trim($_POST['form_c_port'] [$form_key])));
|
||||
$q_port = $db->real_escape_string( intval(trim($_POST['form_q_port'] [$form_key])));
|
||||
$s_port = $db->real_escape_string( intval(trim($_POST['form_s_port'] [$form_key])));
|
||||
$zone = $db->real_escape_string( trim($_POST['form_zone'] [$form_key]));
|
||||
$disabled = isset($_POST['form_disabled'][$form_key])? intval(trim($_POST['form_disabled'][$form_key])) : "0";
|
||||
$comment = $db->real_escape_string( trim($_POST['form_comment'] [$form_key]));
|
||||
|
||||
// CACHE INDEXED BY TYPE:IP:Q_PORT SO IF THEY CHANGE THE CACHE IS IGNORED
|
||||
list($status, $cache, $cache_time) = isset($servers["{$type}:{$ip}:{$q_port}"]) ? $servers["{$type}:{$ip}:{$q_port}"] : array("0", "", "");
|
||||
|
||||
$status = $db->real_escape_string($status);
|
||||
$cache = $db->real_escape_string($cache);
|
||||
$cache_time = $db->real_escape_string($cache_time);
|
||||
|
||||
// THIS PREVENTS PORTS OR WHITESPACE BEING PUT IN THE IP WHILE ALLOWING IPv6
|
||||
if (preg_match("/(\[[0-9a-z\:]+\])/iU", $ip, $match)) { $ip = $match[1]; }
|
||||
elseif (preg_match("/([0-9a-z\.\-]+)/i", $ip, $match)) { $ip = $match[1]; }
|
||||
|
||||
list($c_port, $q_port, $s_port) = lgsl_port_conversion($type, $c_port, $q_port, $s_port);
|
||||
|
||||
// DISCARD SERVERS WITH AN EMPTY IP AND AUTO DISABLE SERVERS WITH SOMETHING WRONG
|
||||
if (!$ip) { continue; }
|
||||
elseif ($c_port < 1 || $c_port > 99999) { $disabled = 1; $c_port = 0; }
|
||||
elseif ($q_port < 1 || $q_port > 99999) { $disabled = 1; $q_port = 0; }
|
||||
elseif (!isset($lgsl_protocol_list[$type])) { $disabled = 1; }
|
||||
|
||||
$db->query("INSERT INTO `OGP_DB_PREFIXlgsl` (`type`,`ip`,`c_port`,`q_port`,`s_port`,`zone`,`disabled`,`comment`,`status`,`cache`,`cache_time`) VALUES ('{$type}','{$ip}','{$c_port}','{$q_port}','{$s_port}','{$zone}','{$disabled}','{$comment}','{$status}','{$cache}','{$cache_time}')");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (!empty($_POST['lgsl_map_image_paths']))
|
||||
{
|
||||
$server_list = lgsl_query_cached_all("s");
|
||||
|
||||
foreach ($server_list as $server)
|
||||
{
|
||||
if (!$server['b']['status']) { continue; }
|
||||
|
||||
$image_map = lgsl_image_map($server['b']['status'], $server['b']['type'], $server['s']['game'], $server['s']['map'], FALSE);
|
||||
|
||||
$output .= "
|
||||
<div>
|
||||
<a href='{$image_map}'> {$image_map} </a>
|
||||
</div>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
<form method='post' action=''>
|
||||
<div>
|
||||
<br />
|
||||
<br />
|
||||
<input type='hidden' name='lgsl_management' value='{$_POST['lgsl_management']}' />
|
||||
<input type='submit' name='lgsl_return' value='RETURN TO ADMIN' />
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
</form>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if ((!empty($_POST['lgsl_management']) && empty($_POST['lgsl_switch'])) || (empty($_POST['lgsl_management']) && !empty($_POST['lgsl_switch'])) || (!isset($_POST['lgsl_management']) && $lgsl_config['management']))
|
||||
{
|
||||
$output .= "
|
||||
<form method='post' action=''>
|
||||
<div style='text-align:center'>
|
||||
<b>TYPE : IP : C PORT : Q PORT : S PORT : ZONES : DISABLED : COMMENT</b>
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
<div style='text-align:center'>
|
||||
<textarea name='form_list' cols='90' rows='30' wrap='off' spellcheck='false' style='width:95%; height:500px; font-size:1.2em; font-family:courier new, monospace'>\r\n";
|
||||
|
||||
//---------------------------------------------------------+
|
||||
$result = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl` ORDER BY `id` ASC");
|
||||
|
||||
foreach($result as $row)
|
||||
{
|
||||
$output .=
|
||||
lgsl_string_html(str_pad($row['type'], 15, " ")).":".
|
||||
lgsl_string_html(str_pad($row['ip'], 30, " ")).":".
|
||||
lgsl_string_html(str_pad($row['c_port'], 6, " ")).":".
|
||||
lgsl_string_html(str_pad($row['q_port'], 6, " ")).":".
|
||||
lgsl_string_html(str_pad($row['s_port'], 7, " ")).":".
|
||||
lgsl_string_html(str_pad($row['zone'], 7, " ")).":".
|
||||
lgsl_string_html(str_pad($row['disabled'], 2, " ")).":".
|
||||
$row['comment'] ."\r\n";
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
$output .= "
|
||||
</textarea>
|
||||
</div>
|
||||
<div style='text-align:center'>
|
||||
<input type='hidden' name='lgsl_management' value='1' />
|
||||
<table cellspacing='20' cellpadding='0' style='text-align:center;margin:auto'>
|
||||
<tr>
|
||||
<td><input type='submit' name='lgsl_save_1' value='Save - Keep Cache' /> </td>
|
||||
<td><input type='submit' name='lgsl_save_2' value='Save - Reset Cache' /> </td>
|
||||
<td><input type='submit' name='lgsl_map_image_paths' value='Map Image Paths' /> </td>
|
||||
<td><input type='submit' name='lgsl_switch' value='Normal Management' /> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>";
|
||||
|
||||
$output .= lgsl_help_info();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<form method='post' action=''>
|
||||
<div style='text-align:center; overflow:auto'>
|
||||
<table cellspacing='5' cellpadding='0' style='margin:auto'>
|
||||
<tr>
|
||||
<td style='text-align:center; white-space:nowrap'>[ ID ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Game Type ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ IP ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Connection Port ]</td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Query Port ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Software Port ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Zones ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Disabled ] </td>
|
||||
<td style='text-align:center; white-space:nowrap'>[ Comment ] </td>
|
||||
</tr>";
|
||||
|
||||
//---------------------------------------------------------+
|
||||
|
||||
$result = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl` ORDER BY `id` ASC");
|
||||
|
||||
foreach($result as $row)
|
||||
{
|
||||
$id = $row['id']; // ID USED AS [] ONLY RETURNS TICKED CHECKBOXES
|
||||
|
||||
$output .= "
|
||||
<tr>
|
||||
<td>
|
||||
<a href='".lgsl_link($id)."' style='text-decoration:none'>{$id}</a>
|
||||
</td>
|
||||
<td>
|
||||
<select name='form_type[{$id}]'>";
|
||||
//---------------------------------------------------------+
|
||||
foreach ($lgsl_type_list as $type => $description)
|
||||
{
|
||||
$output .= "
|
||||
<option ".($type == $row['type'] ? "selected='selected'" : "")." value='{$type}'>{$description}</option>";
|
||||
}
|
||||
|
||||
if (!isset($lgsl_type_list[$row['type']]))
|
||||
{
|
||||
$output .= "
|
||||
<option selected='selected' value='".lgsl_string_html($row['type'])."'>".lgsl_string_html($row['type'])."</option>";
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
$output .= "
|
||||
</select>
|
||||
</td>
|
||||
<td style='text-align:center'><input type='text' name='form_ip[{$id}]' value='".lgsl_string_html($row['ip'])."' size='15' maxlength='255' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_c_port[{$id}]' value='".lgsl_string_html($row['c_port'])."' size='5' maxlength='5' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_q_port[{$id}]' value='".lgsl_string_html($row['q_port'])."' size='5' maxlength='5' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_s_port[{$id}]' value='".lgsl_string_html($row['s_port'])."' size='5' maxlength='5' /></td>
|
||||
<td>
|
||||
<select name='form_zone[$id]'>";
|
||||
//---------------------------------------------------------+
|
||||
foreach ($zone_list as $zone)
|
||||
{
|
||||
$output .= "
|
||||
<option ".($zone == $row['zone'] ? "selected='selected'" : "")." value='{$zone}'>{$zone}</option>";
|
||||
}
|
||||
|
||||
if (!isset($zone_list[$row['zone']]))
|
||||
{
|
||||
$output .= "
|
||||
<option selected='selected' value='".lgsl_string_html($row['zone'])."'>".lgsl_string_html($row['zone'])."</option>";
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
//---------------------------------------------------------+
|
||||
$output .= "
|
||||
</select>
|
||||
</td>
|
||||
<td style='text-align:center'><input type='checkbox' name='form_disabled[{$id}]' value='1' ".(empty($row['disabled']) ? "" : "checked='checked'")." /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_comment[{$id}]' value='{$row['comment']}' size='20' maxlength='255' /></td>
|
||||
</tr>";
|
||||
|
||||
$last_type = $row['type']; // SET LAST TYPE ( $row EXISTS ONLY WITHIN THE LOOP )
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
$id ++; // NEW SERVER ID CONTINUES ON FROM LAST
|
||||
|
||||
$output .= "
|
||||
<tr>
|
||||
<td>NEW</td>
|
||||
<td>
|
||||
<select name='form_type[{$id}]'>";
|
||||
//---------------------------------------------------------+
|
||||
foreach ($lgsl_type_list as $type => $description)
|
||||
{
|
||||
$output .= "
|
||||
<option ".($type == $last_type ? "selected='selected'" : "")." value='{$type}'>{$description}</option>";
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
$output .= "
|
||||
</select>
|
||||
</td>
|
||||
<td style='text-align:center'><input type='text' name='form_ip[{$id}]' value='' size='15' maxlength='255' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_c_port[{$id}]' value='' size='5' maxlength='5' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_q_port[{$id}]' value='' size='5' maxlength='5' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_s_port[{$id}]' value='0' size='5' maxlength='5' /></td>
|
||||
<td>
|
||||
<select name='form_zone[{$id}]'>";
|
||||
//---------------------------------------------------------+
|
||||
foreach ($zone_list as $zone)
|
||||
{
|
||||
$output .= "
|
||||
<option value='{$zone}'>{$zone}</option>";
|
||||
}
|
||||
//---------------------------------------------------------+
|
||||
$output .= "
|
||||
</select>
|
||||
</td>
|
||||
<td style='text-align:center'><input type='checkbox' name='form_disabled[{$id}]' value='' /></td>
|
||||
<td style='text-align:center'><input type='text' name='form_comment[{$id}]' value='' size='20' maxlength='255' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type='hidden' name='lgsl_management' value='0' />
|
||||
<table cellspacing='20' cellpadding='0' style='text-align:center;margin:auto'>
|
||||
<tr>
|
||||
<td><input type='submit' name='lgsl_save_1' value='Save - Keep Cache' /> </td>
|
||||
<td><input type='submit' name='lgsl_save_2' value='Save - Reset Cache' /> </td>
|
||||
<td><input type='submit' name='lgsl_map_image_paths' value='Map Image Paths' /> </td>
|
||||
<td><input type='submit' name='lgsl_switch' value='Advanced Management' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>";
|
||||
|
||||
$output .= lgsl_help_info();
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_help_info()
|
||||
{
|
||||
return "
|
||||
<div style='text-align:center; line-height:1em; font-size:1em;'>
|
||||
<br /><br />
|
||||
<a href='http://www.greycube.com/help/readme/lgsl/'>[ LGSL ONLINE README ]</a> <br /><br />
|
||||
- To remove a server, delete the IP, then click Save. <br /><br />
|
||||
- Leave the query port blank to have LGSL try to fill it in for you. <br /><br />
|
||||
- Software port is only needed for a few games so it being set 0 is normal. <br /><br />
|
||||
- Edit the lgsl_config.php to set the background colors and other options. <br /><br />
|
||||
<table cellspacing='10' cellpadding='0' style='border:1px solid; margin:auto; text-align:left'>
|
||||
<tr>
|
||||
<td> <a href='http://php.net/fsockopen'>FSOCKOPEN</a> </td>
|
||||
<td> Enabled: ".(function_exists("fsockopen") ? "YES" : "NO")." </td>
|
||||
<td> ( Required for direct querying of servers ) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href='http://php.net/curl'>CURL</a> </td>
|
||||
<td> Enabled: ".((function_exists("curl_init") && function_exists("curl_setopt") && function_exists("curl_exec")) ? "YES" : "NO")." </td>
|
||||
<td> ( Used for the feed when fsockopen is disabled ) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href='http://php.net/mbstring'>MBSTRING</a> </td>
|
||||
<td> Enabled: ".(function_exists("mb_convert_encoding") ? "YES" : "NO")." </td>
|
||||
<td> ( Used to show UTF-8 server and player names correctly ) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href='http://php.net/bzip2'>BZIP2</a> </td>
|
||||
<td> Enabled: ".(function_exists("bzdecompress") ? "YES" : "NO")." </td>
|
||||
<td> ( Used to show Source server settings over a certain size ) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <a href='http://php.net/zlib'>ZLIB</a> </td>
|
||||
<td> Enabled: ".(function_exists("gzuncompress") ? "YES" : "NO")." </td>
|
||||
<td> ( Required for America's Army 3 ) </td>
|
||||
</tr>
|
||||
</table>
|
||||
<br /><br />
|
||||
<br /><br />
|
||||
</div>";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_stripslashes_deep($value)
|
||||
{
|
||||
$value = is_array($value) ? array_map('lgsl_stripslashes_deep', $value) : stripslashes($value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_htmlspecialchars($string)
|
||||
{
|
||||
// PHP4 COMPATIBLE WAY OF CONVERTING SPECIAL CHARACTERS WITHOUT DOUBLE ENCODING EXISTING ENTITIES
|
||||
$string = str_replace("\x05\x06", "", $string);
|
||||
$string = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x05\x06$1", $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES);
|
||||
$string = str_replace("\x05\x06", "&", $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
|
@ -1,931 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (!function_exists('lgsl_url_path')) { // START OF DOUBLE LOAD PROTECTION
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if (file_exists('modules/lgsl_with_img_mod/lgsl_files/geoip.inc.php')) {
|
||||
include 'modules/lgsl_with_img_mod/lgsl_files/geoip.inc.php';
|
||||
}
|
||||
|
||||
function lgsl_bg($rotation_overide = "no")
|
||||
{
|
||||
global $lgsl_config;
|
||||
global $lgsl_bg_rotate;
|
||||
|
||||
if ($rotation_overide !== "no")
|
||||
{
|
||||
$lgsl_bg_rotate = $rotation_overide ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$lgsl_bg_rotate = $lgsl_bg_rotate ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
$background = $lgsl_bg_rotate ? $lgsl_config['background'][1] : $lgsl_config['background'][2];
|
||||
|
||||
return $background;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_link($s = "")
|
||||
{
|
||||
global $lgsl_config, $lgsl_url_path;
|
||||
|
||||
$index = $lgsl_config['direct_index'] ? "index.php" : "";
|
||||
|
||||
switch($lgsl_config['cms'])
|
||||
{
|
||||
case "e107":
|
||||
$link = $s ? e_PLUGIN."lgsl/{$index}?s={$s}" : e_PLUGIN."lgsl/{$index}";
|
||||
break;
|
||||
|
||||
case "joomla":
|
||||
$link = $s ? JRoute::_("index.php?option=com_lgsl&s={$s}") : JRoute::_("index.php?option=com_lgsl");
|
||||
break;
|
||||
|
||||
case "drupal":
|
||||
$link = $s ? url("LGSL/{$s}") : url("LGSL");
|
||||
break;
|
||||
|
||||
case "phpnuke":
|
||||
$link = $s ? "modules.php?name=LGSL&s={$s}" : "modules.php?name=LGSL";
|
||||
break;
|
||||
|
||||
default: // "sa"
|
||||
$link = $s ? "?m=lgsl_with_img_mod&p=lgsl&s={$s}" : "?m=lgsl_with_img_mod&p=lgsl";
|
||||
break;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_query_cached($type, $ip, $c_port, $q_port, $s_port, $request, $id = NULL)
|
||||
{
|
||||
global $db, $lgsl_config;
|
||||
|
||||
// LOOKUP SERVER
|
||||
|
||||
if ($id != NULL)
|
||||
{
|
||||
$id = intval($id);
|
||||
$result = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl` WHERE `id`='{$id}' LIMIT 1");
|
||||
if (!is_array($result)) { return FALSE; }
|
||||
$row = $result[0];
|
||||
list($type, $ip, $c_port, $q_port, $s_port) = array($row['type'], $row['ip'], $row['c_port'], $row['q_port'], $row['s_port']);
|
||||
}
|
||||
else
|
||||
{
|
||||
list($type, $ip, $c_port, $q_port, $s_port) = array($db->real_escape_string($type), $db->real_escape_string($ip), intval($c_port), intval($q_port), intval($s_port));
|
||||
|
||||
if (!$type || !$ip || !$c_port || !$q_port) { exit("LGSL PROBLEM: INVALID SERVER '{$type} : {$ip} : {$c_port} : {$q_port} : {$s_port}'"); }
|
||||
$result = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl` WHERE `type`='{$type}' AND `ip`='{$ip}' AND `q_port`='{$q_port}' LIMIT 1");
|
||||
$row = $result[0];
|
||||
|
||||
if (!is_array($result))
|
||||
{
|
||||
if (strpos($request, "a") === FALSE) { exit("LGSL PROBLEM: SERVER NOT IN DATABASE '{$type} : {$ip} : {$c_port} : {$q_port} : {$s_port}'"); }
|
||||
$db->query("INSERT INTO `OGP_DB_PREFIXlgsl` (`type`,`ip`,`c_port`,`q_port`,`s_port`,`cache`,`cache_time`) VALUES ('{$type}','{$ip}','{$c_port}','{$q_port}','{$s_port}','','')");
|
||||
$result = $db->resultQuery("SELECT * FROM `OGP_DB_PREFIXlgsl` WHERE `type`='{$type}' AND `ip`='{$ip}' AND `q_port`='{$q_port}' LIMIT 1");
|
||||
$row = $result[0];
|
||||
}
|
||||
}
|
||||
|
||||
// UNPACK CACHE AND CACHE TIMES
|
||||
|
||||
$cache = empty($row['cache']) ? array() : unserialize(base64_decode($row['cache']));
|
||||
$cache_time = empty($row['cache_time']) ? array(0,0,0) : explode("_", $row['cache_time']);
|
||||
|
||||
// SET THE SERVER AS OFFLINE AND PENDING WHEN THERE IS NO CACHE
|
||||
|
||||
if (empty($cache['b']) || !is_array($cache))
|
||||
{
|
||||
$cache = array();
|
||||
$cache['b'] = array();
|
||||
$cache['b']['status'] = 0;
|
||||
$cache['b']['pending'] = 1;
|
||||
}
|
||||
|
||||
// CONVERT HOSTNAME TO IP WHEN NEEDED
|
||||
|
||||
if ($lgsl_config['host_to_ip'])
|
||||
{
|
||||
$ip = gethostbyname($ip);
|
||||
}
|
||||
|
||||
// UPDATE CACHE WITH FIXED VALUES
|
||||
|
||||
$cache['b']['type'] = $type;
|
||||
$cache['b']['ip'] = $ip;
|
||||
$cache['b']['c_port'] = $c_port;
|
||||
$cache['b']['q_port'] = $q_port;
|
||||
$cache['b']['s_port'] = $s_port;
|
||||
$cache['o']['request'] = $request;
|
||||
$cache['o']['id'] = $row['id'];
|
||||
$cache['o']['zone'] = $row['zone'];
|
||||
$cache['o']['comment'] = $row['comment'];
|
||||
|
||||
// UPDATE CACHE WITH LOCATION
|
||||
|
||||
if (empty($cache['o']['location']))
|
||||
{
|
||||
$cache['o']['location'] = $lgsl_config['locations'] ? lgsl_query_location($ip) : "";
|
||||
}
|
||||
|
||||
// UPDATE CACHE WITH DEFAULT OFFLINE VALUES
|
||||
|
||||
if (!isset($cache['s']))
|
||||
{
|
||||
$cache['s'] = array();
|
||||
$cache['s']['game'] = $type;
|
||||
$cache['s']['name'] = $lgsl_config['text']['nnm'];
|
||||
$cache['s']['map'] = $lgsl_config['text']['nmp'];
|
||||
$cache['s']['players'] = 0;
|
||||
$cache['s']['playersmax'] = 0;
|
||||
$cache['s']['password'] = 0;
|
||||
}
|
||||
|
||||
if (!isset($cache['e'])) { $cache['e'] = array(); }
|
||||
if (!isset($cache['p'])) { $cache['p'] = array(); }
|
||||
|
||||
// CHECK AND GET THE NEEDED DATA
|
||||
|
||||
$needed = "";
|
||||
|
||||
if (strpos($request, "c") === FALSE) // CACHE ONLY REQUEST
|
||||
{
|
||||
if (strpos($request, "s") !== FALSE && time() > ($cache_time[0]+$lgsl_config['cache_time'])) { $needed .= "s"; }
|
||||
if (strpos($request, "e") !== FALSE && time() > ($cache_time[1]+$lgsl_config['cache_time'])) { $needed .= "e"; }
|
||||
if (strpos($request, "p") !== FALSE && time() > ($cache_time[2]+$lgsl_config['cache_time'])) { $needed .= "p"; }
|
||||
}
|
||||
|
||||
if ($needed)
|
||||
{
|
||||
// UPDATE CACHE TIMES BEFORE QUERY - PREVENTS OTHER INSTANCES FROM QUERY FLOODING THE SAME SERVER
|
||||
|
||||
$packed_times = time() + $lgsl_config['cache_time'] + 10;
|
||||
$packed_times = "{$packed_times}_{$packed_times}_{$packed_times}";
|
||||
$reuslt = $db->query("UPDATE `OGP_DB_PREFIXlgsl` SET `cache_time`='{$packed_times}' WHERE `id`='{$row['id']}' LIMIT 1");
|
||||
if(!$result) return;
|
||||
|
||||
// GET WHAT IS NEEDED
|
||||
|
||||
$live = lgsl_query_live($type, $ip, $c_port, $q_port, $s_port, $needed);
|
||||
|
||||
if (!$live['b']['status'] && $lgsl_config['retry_offline'] && !$lgsl_config['feed']['method'])
|
||||
{
|
||||
$live = lgsl_query_live($type, $ip, $c_port, $q_port, $s_port, $needed);
|
||||
}
|
||||
|
||||
// CHECK AND CONVERT TO UTF-8 WHERE NEEDED
|
||||
|
||||
$live = lgsl_charset_convert($live, lgsl_charset_detect($live));
|
||||
|
||||
// IF SERVER IS OFFLINE PRESERVE SOME OF THE CACHE AND CLEAR THE REST
|
||||
|
||||
if (!$live['b']['status'])
|
||||
{
|
||||
$live['s']['game'] = $cache['s']['game'];
|
||||
$live['s']['name'] = $cache['s']['name'];
|
||||
$live['s']['map'] = $cache['s']['map'];
|
||||
$live['s']['password'] = $cache['s']['password'];
|
||||
$live['s']['players'] = 0;
|
||||
$live['s']['playersmax'] = $cache['s']['playersmax'];
|
||||
$live['e'] = array();
|
||||
$live['p'] = array();
|
||||
}
|
||||
|
||||
// MERGE LIVE INTO CACHE
|
||||
|
||||
if (isset($live['b'])) { $cache['b'] = $live['b']; $cache['b']['pending'] = 0; }
|
||||
if (isset($live['s'])) { $cache['s'] = $live['s']; $cache_time[0] = time(); }
|
||||
if (isset($live['e'])) { $cache['e'] = $live['e']; $cache_time[1] = time(); }
|
||||
if (isset($live['p'])) { $cache['p'] = $live['p']; $cache_time[2] = time(); }
|
||||
|
||||
// UPDATE CACHE
|
||||
|
||||
$packed_cache = $db->real_escape_string(base64_encode(serialize($cache)));
|
||||
$packed_times = $db->real_escape_string(implode("_", $cache_time));
|
||||
$result = $db->query("UPDATE `OGP_DB_PREFIXlgsl` SET `status`='{$cache['b']['status']}',`cache`='{$packed_cache}',`cache_time`='{$packed_times}' WHERE `id`='{$row['id']}' LIMIT 1");
|
||||
if(!$result) return;
|
||||
}
|
||||
|
||||
// RETURN ONLY THE REQUESTED
|
||||
|
||||
if (strpos($request, "s") === FALSE) { unset($cache['s']); }
|
||||
if (strpos($request, "e") === FALSE) { unset($cache['e']); }
|
||||
if (strpos($request, "p") === FALSE) { unset($cache['p']); }
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//EXAMPLE USAGE: lgsl_query_group( array("request"=>"sep", "hide_offline"=>0, "random"=>0, "type"=>"source", "game"=>"cstrike") )
|
||||
|
||||
function lgsl_query_group($options = array())
|
||||
{
|
||||
if (!is_array($options)) { exit("LGSL PROBLEM: lgsl_query_group OPTIONS MUST BE ARRAY"); }
|
||||
|
||||
global $lgsl_config, $db;
|
||||
|
||||
$request = isset($options['request']) ? $options['request'] : "s";
|
||||
$zone = isset($options['zone']) ? intval($options['zone']) : 0;
|
||||
$hide_offline = isset($options['hide_offline']) ? intval($options['hide_offline']) : intval($lgsl_config['hide_offline'][$zone]);
|
||||
$random = isset($options['random']) ? intval($options['random']) : intval($lgsl_config['random'][$zone]);
|
||||
$type = empty($options['type']) ? "" : preg_replace("/[^a-z0-9_]/", "_", strtolower($options['type']));
|
||||
$game = empty($options['game']) ? "" : preg_replace("/[^a-z0-9_]/", "_", strtolower($options['game']));
|
||||
$order = empty($random) ? "`cache_time` ASC" : "rand()";
|
||||
$server_limit = empty($random) ? 0 : $random;
|
||||
|
||||
$where = array("`disabled`=0");
|
||||
if ($zone != 0) { $where[] = "FIND_IN_SET('{$zone}',`zone`)"; }
|
||||
if ($type != "") { $where[] = "`type`='{$type}'"; }
|
||||
|
||||
$result = $db->resultQuery("SELECT `id` FROM `OGP_DB_PREFIXlgsl` WHERE ".implode(" AND ", $where)." ORDER BY {$order}");
|
||||
$server_list = array();
|
||||
|
||||
foreach($result as $row)
|
||||
{
|
||||
if (strpos($request, "c") === FALSE && lgsl_timer("check")) { $request .= "c"; }
|
||||
|
||||
$server = lgsl_query_cached("", "", "", "", "", $request, $row['id']);
|
||||
|
||||
if ($hide_offline && empty($server['b']['status'])) { continue; }
|
||||
if ($game && $game != preg_replace("/[^a-z0-9_]/", "_", strtolower($server['s']['game']))) { continue; }
|
||||
|
||||
$server_list[] = $server;
|
||||
|
||||
if ($server_limit && count($server_list) >= $server_limit) { break; }
|
||||
}
|
||||
|
||||
return $server_list;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_group_totals($server_list = FALSE)
|
||||
{
|
||||
if (!is_array($server_list)) { $server_list = lgsl_query_group( array( "request"=>"sc" ) ); }
|
||||
|
||||
$total = array("players"=>0, "playersmax"=>0, "servers"=>0, "servers_online"=>0, "servers_offline"=>0);
|
||||
|
||||
foreach ($server_list as $server)
|
||||
{
|
||||
$total['players'] += $server['s']['players'];
|
||||
$total['playersmax'] += $server['s']['playersmax'];
|
||||
|
||||
$total['servers'] ++;
|
||||
if ($server['b']['status']) { $total['servers_online'] ++; }
|
||||
else { $total['servers_offline'] ++; }
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_query_cached_all($request) // LEGACY - DO NOT USE
|
||||
{
|
||||
return lgsl_query_group( array( "request"=>$request ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_query_cached_zone($request, $zone) // LEGACY - DO NOT USE
|
||||
{
|
||||
return lgsl_query_group( array( "request"=>$request, "zone"=>$zone ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_cached_totals() // LEGACY - DO NOT USE
|
||||
{
|
||||
return lgsl_group_totals();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_lookup_id($id) // LEGACY - DO NOT USE
|
||||
{
|
||||
global $db;
|
||||
$id = intval($id);
|
||||
$query = $db->resultQuery("SELECT `type`,`ip`,`c_port`,`q_port`,`s_port` FROM `OGP_DB_PREFIXlgsl` WHERE `id`='{$id}' LIMIT 1");
|
||||
if (!$query) { return FALSE; }
|
||||
return $query[0];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_timer($action)
|
||||
{
|
||||
global $lgsl_config;
|
||||
global $lgsl_timer;
|
||||
|
||||
if (!$lgsl_timer)
|
||||
{
|
||||
$microtime = microtime();
|
||||
$microtime = explode(' ', $microtime);
|
||||
$microtime = $microtime[1] + $microtime[0];
|
||||
$lgsl_timer = $microtime - 0.01;
|
||||
}
|
||||
|
||||
$time_limit = intval($lgsl_config['live_time']);
|
||||
$time_php = ini_get("max_execution_time");
|
||||
|
||||
if ($time_limit > $time_php)
|
||||
{
|
||||
@set_time_limit($time_limit + 5);
|
||||
|
||||
$time_php = ini_get("max_execution_time");
|
||||
|
||||
if ($time_limit > $time_php)
|
||||
{
|
||||
$time_limit = $time_php - 5;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "limit")
|
||||
{
|
||||
return $time_limit;
|
||||
}
|
||||
|
||||
$microtime = microtime();
|
||||
$microtime = explode(' ', $microtime);
|
||||
$microtime = $microtime[1] + $microtime[0];
|
||||
$time_taken = $microtime - $lgsl_timer;
|
||||
|
||||
if ($action == "check")
|
||||
{
|
||||
return ($time_taken > $time_limit) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return round($time_taken, 2);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_server_misc($server)
|
||||
{
|
||||
global $lgsl_url_path;
|
||||
|
||||
$misc['icon_details'] = $lgsl_url_path."other/icon_details.gif";
|
||||
$misc['icon_game'] = lgsl_icon_game($server['b']['type'], $server['s']['game']);
|
||||
$misc['icon_status'] = lgsl_icon_status($server['b']['status'], $server['s']['password'], $server['b']['pending']);
|
||||
$misc['icon_location'] = lgsl_icon_location($server['o']['location']);
|
||||
$misc['image_map'] = lgsl_image_map($server['b']['status'], $server['b']['type'], $server['s']['game'], $server['s']['map'], TRUE, $server['o']['id']);
|
||||
$misc['image_map_password'] = lgsl_image_map_password($server['b']['status'], $server['s']['password']);
|
||||
$misc['text_status'] = lgsl_text_status($server['b']['status'], $server['s']['password'], $server['b']['pending']);
|
||||
$misc['text_type_game'] = lgsl_text_type_game($server['b']['type'], $server['s']['game']);
|
||||
$misc['text_location'] = lgsl_text_location($server['o']['location']);
|
||||
$misc['name_filtered'] = lgsl_string_html($server['s']['name'], FALSE, 20); // LEGACY
|
||||
$misc['software_link'] = lgsl_software_link($server['b']['type'], $server['b']['ip'], $server['b']['c_port'], $server['b']['q_port'], $server['b']['s_port']);
|
||||
|
||||
return $misc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_icon_game($type, $game)
|
||||
{
|
||||
$type = preg_replace("/[^a-z0-9_]/", "_", strtolower($type));
|
||||
$game = preg_replace("/[^a-z0-9_]/", "_", strtolower($game));
|
||||
|
||||
$path_list = array(
|
||||
"images/icons/{$game}.gif",
|
||||
"images/icons/{$game}.png",
|
||||
"images/icons/{$type}.gif",
|
||||
"images/icons/{$type}.png");
|
||||
|
||||
foreach ($path_list as $path)
|
||||
{
|
||||
if (file_exists($path)) { return $path; }
|
||||
}
|
||||
|
||||
global $lgsl_url_path;
|
||||
return "{$lgsl_url_path}other/icon_unknown.gif";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_icon_status($status, $password, $pending = 0)
|
||||
{
|
||||
global $lgsl_url_path;
|
||||
|
||||
if ($pending) { return "{$lgsl_url_path}other/icon_unknown.gif"; }
|
||||
if (!$status) { return "{$lgsl_url_path}other/icon_no_response.gif"; }
|
||||
if ($password) { return "{$lgsl_url_path}other/icon_online_password.gif"; }
|
||||
|
||||
return "{$lgsl_url_path}other/icon_online.gif";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_icon_location($location)
|
||||
{
|
||||
global $lgsl_file_path, $lgsl_url_path;
|
||||
|
||||
if (!$location) { return "images/countries/noflag.png"; }
|
||||
|
||||
if ($location)
|
||||
{
|
||||
$location = "images/countries/".preg_replace("/[^a-zA-Z0-9_]/", "_", strtolower($location) ).".png";
|
||||
|
||||
if (file_exists($location)) { return $location; }
|
||||
}
|
||||
|
||||
return "images/countries/noflag.png";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_image_map($status, $type, $game, $map, $check_exists = TRUE, $id = 0)
|
||||
{
|
||||
$type = preg_replace("/[^a-z0-9_]/", "_", strtolower($type));
|
||||
$game = preg_replace("/[^a-z0-9_]/", "_", strtolower($game));
|
||||
$map = preg_replace("/[^a-z0-9_]/", "_", strtolower($map));
|
||||
if ($check_exists !== TRUE) {
|
||||
$protocalPath = "protocol/lgsl/maps/{$type}/{$game}/{$map}.jpg";
|
||||
$cachePath = "modules/lgsl_with_img_mod/lgsl_files/image/cache/{$map}.jpg";
|
||||
if(file_exists($protocalPath)){
|
||||
return $protocalPath;
|
||||
}else if(file_exists($cachePath)){
|
||||
return $cachePath;
|
||||
}
|
||||
}
|
||||
if ($status) return get_map_path($type,$game,$map);
|
||||
else return "modules/lgsl_with_img_mod/lgsl_files/other/map_no_response.jpg";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_image_map_password($status, $password)
|
||||
{
|
||||
global $lgsl_url_path;
|
||||
|
||||
if (!$password || !$status) { return "{$lgsl_url_path}other/map_overlay.gif"; }
|
||||
|
||||
return "{$lgsl_url_path}other/map_overlay_password.gif";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_text_status($status, $password, $pending = 0)
|
||||
{
|
||||
global $lgsl_config;
|
||||
|
||||
if ($pending) { return $lgsl_config['text']['pen']; }
|
||||
if (!$status) { return $lgsl_config['text']['nrs']; }
|
||||
if ($password) { return $lgsl_config['text']['onp']; }
|
||||
|
||||
return $lgsl_config['text']['onl'];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_text_type_game($type, $game)
|
||||
{
|
||||
global $lgsl_config;
|
||||
|
||||
return "[ {$lgsl_config['text']['typ']} {$type} ] [ {$lgsl_config['text']['gme']} {$game} ]";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_text_location($location)
|
||||
{
|
||||
global $lgsl_config;
|
||||
|
||||
return $location ? "{$lgsl_config['text']['loc']} {$location}" : "";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers($server_list)
|
||||
{
|
||||
global $lgsl_config;
|
||||
|
||||
if (!is_array($server_list)) { return $server_list; }
|
||||
|
||||
if ($lgsl_config['sort']['servers'] == "id") { usort($server_list, "lgsl_sort_servers_by_id"); }
|
||||
elseif ($lgsl_config['sort']['servers'] == "zone") { usort($server_list, "lgsl_sort_servers_by_zone"); }
|
||||
elseif ($lgsl_config['sort']['servers'] == "type") { usort($server_list, "lgsl_sort_servers_by_type"); }
|
||||
elseif ($lgsl_config['sort']['servers'] == "status") { usort($server_list, "lgsl_sort_servers_by_status"); }
|
||||
elseif ($lgsl_config['sort']['servers'] == "players") { usort($server_list, "lgsl_sort_servers_by_players"); }
|
||||
|
||||
return $server_list;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_fields($server, $fields_show, $fields_hide, $fields_other)
|
||||
{
|
||||
$fields_list = array();
|
||||
|
||||
if (!is_array($server['p'])) { return $fields_list; }
|
||||
|
||||
foreach ($server['p'] as $player)
|
||||
{
|
||||
foreach ($player as $field => $value)
|
||||
{
|
||||
if ($value === "") { continue; }
|
||||
if (in_array($field, $fields_list)) { continue; }
|
||||
if (in_array($field, $fields_hide)) { continue; }
|
||||
$fields_list[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
$fields_show = array_intersect($fields_show, $fields_list);
|
||||
|
||||
if ($fields_other == FALSE) { return $fields_show; }
|
||||
|
||||
$fields_list = array_diff($fields_list, $fields_show);
|
||||
|
||||
return array_merge($fields_show, $fields_list);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers_by_id($server_a, $server_b)
|
||||
{
|
||||
if ($server_a['o']['id'] == $server_b['o']['id']) { return 0; }
|
||||
|
||||
return ($server_a['o']['id'] > $server_b['o']['id']) ? 1 : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers_by_zone($server_a, $server_b)
|
||||
{
|
||||
if ($server_a['o']['zone'] == $server_b['o']['zone']) { return 0; }
|
||||
|
||||
return ($server_a['o']['zone'] > $server_b['o']['zone']) ? 1 : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers_by_type($server_a, $server_b)
|
||||
{
|
||||
$result = strcasecmp($server_a['b']['type'], $server_b['b']['type']);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
$result = strcasecmp($server_a['s']['game'], $server_b['s']['game']);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers_by_status($server_a, $server_b)
|
||||
{
|
||||
if ($server_a['b']['status'] == $server_b['b']['status']) { return 0; }
|
||||
|
||||
return ($server_a['b']['status'] < $server_b['b']['status']) ? 1 : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_servers_by_players($server_a, $server_b)
|
||||
{
|
||||
if ($server_a['s']['players'] == $server_b['s']['players']) { return 0; }
|
||||
|
||||
return ($server_a['s']['players'] < $server_b['s']['players']) ? 1 : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_extras($server)
|
||||
{
|
||||
if (!is_array($server['e'])) { return $server; }
|
||||
|
||||
ksort($server['e']);
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_players($server)
|
||||
{
|
||||
global $lgsl_config;
|
||||
|
||||
if (!is_array($server['p'])) { return $server; }
|
||||
|
||||
if ($lgsl_config['sort']['players'] == "name") { usort($server['p'], "lgsl_sort_players_by_name"); }
|
||||
elseif ($lgsl_config['sort']['players'] == "score") { usort($server['p'], "lgsl_sort_players_by_score"); }
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_players_by_score($player_a, $player_b)
|
||||
{
|
||||
if ($player_a['score'] == $player_b['score']) { return 0; }
|
||||
|
||||
return ($player_a['score'] < $player_b['score']) ? 1 : -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_sort_players_by_name($player_a, $player_b)
|
||||
{
|
||||
// REMOVE NON ALPHA NUMERIC ASCII WHILE LEAVING UPPER UTF-8 CHARACTERS
|
||||
$name_a = preg_replace("/[\x{00}-\x{2F}\x{3A}-\x{40}\x{5B}-\x{60}\x{7B}-\x{7F}]/", "", $player_a['name']);
|
||||
$name_b = preg_replace("/[\x{00}-\x{2F}\x{3A}-\x{40}\x{5B}-\x{60}\x{7B}-\x{7F}]/", "", $player_b['name']);
|
||||
|
||||
if (function_exists("mb_convert_case"))
|
||||
{
|
||||
$name_a = @mb_convert_case($name_a, MB_CASE_LOWER, "UTF-8");
|
||||
$name_b = @mb_convert_case($name_b, MB_CASE_LOWER, "UTF-8");
|
||||
return strcmp($name_a, $name_b);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strcasecmp($name_a, $name_b);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_charset_detect($server)
|
||||
{
|
||||
if (!function_exists("mb_detect_encoding")) { return "AUTO"; }
|
||||
|
||||
$test = "";
|
||||
|
||||
if (isset($server['s']['name'])) { $test .= " {$server['s']['name']} "; }
|
||||
|
||||
if (isset($server['p']) && $server['p'])
|
||||
{
|
||||
foreach ($server['p'] as $player)
|
||||
{
|
||||
if (isset($player['name'])) { $test .= " {$player['name']} "; }
|
||||
}
|
||||
}
|
||||
|
||||
$charset = @mb_detect_encoding($server['s']['name'], "UTF-8, Windows-1252, ISO-8859-1, ISO-8859-15");
|
||||
|
||||
return $charset ? $charset : "AUTO";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_charset_convert($server, $charset)
|
||||
{
|
||||
if (!function_exists("mb_convert_encoding")) { return $server; }
|
||||
|
||||
if (is_array($server))
|
||||
{
|
||||
foreach ($server as $key => $value)
|
||||
{
|
||||
$server[$key] = lgsl_charset_convert($value, $charset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$server = @mb_convert_encoding($server, "UTF-8", $charset);
|
||||
}
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_server_html($server, $word_wrap = 20)
|
||||
{
|
||||
foreach ($server as $key => $value)
|
||||
{
|
||||
$server[$key] = is_array($value) ? lgsl_server_html($value, $word_wrap) : lgsl_string_html($value, FALSE, $word_wrap);
|
||||
}
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_string_html($string, $xml_feed = FALSE, $word_wrap = 0)
|
||||
{
|
||||
if ($word_wrap) { $string = lgsl_word_wrap($string, $word_wrap); }
|
||||
|
||||
if ($xml_feed != FALSE)
|
||||
{
|
||||
$string = htmlspecialchars($string, ENT_QUOTES);
|
||||
}
|
||||
elseif (function_exists("mb_convert_encoding"))
|
||||
{
|
||||
$string = htmlspecialchars($string, ENT_QUOTES);
|
||||
$string = @mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8");
|
||||
}
|
||||
else
|
||||
{
|
||||
$string = htmlentities($string, ENT_QUOTES, "UTF-8");
|
||||
}
|
||||
|
||||
if ($word_wrap) { $string = lgsl_word_wrap($string); }
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_word_wrap($string, $length_limit = 0)
|
||||
{
|
||||
if (!$length_limit)
|
||||
{
|
||||
// http://www.quirksmode.org/oddsandends/wbr.html
|
||||
// return str_replace("\x05\x06", " ", $string); // VISIBLE
|
||||
// return str_replace("\x05\x06", "­", $string); // FF2 VISIBLE AND DIV NEEDED
|
||||
return str_replace("\x05\x06", "​", $string); // IE6 VISIBLE
|
||||
}
|
||||
|
||||
$word_list = explode(" ", $string);
|
||||
|
||||
foreach ($word_list as $key => $word)
|
||||
{
|
||||
$word_length = function_exists("mb_strlen") ? mb_strlen($word, "UTF-8") : strlen($word);
|
||||
|
||||
if ($word_length < $length_limit) { continue; }
|
||||
|
||||
$word_new = "";
|
||||
|
||||
for ($i=0; $i<$word_length; $i+=$length_limit)
|
||||
{
|
||||
$word_new .= function_exists("mb_substr") ? mb_substr($word, $i, $length_limit, "UTF-8") : substr($word, $i, $length_limit);
|
||||
$word_new .= "\x05\x06";
|
||||
}
|
||||
|
||||
$word_list[$key] = $word_new;
|
||||
}
|
||||
|
||||
return implode(" ", $word_list);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_query_location($ip)
|
||||
{
|
||||
global $lgsl_config;
|
||||
if ($lgsl_config['locations'] !== 1 || !function_exists('geoip_open')) {
|
||||
return $lgsl_config['locations'];
|
||||
}
|
||||
|
||||
$gi = geoip_open('modules/lgsl_with_img_mod/lgsl_files/GeoIP.dat', GEOIP_STANDARD);
|
||||
$ip = gethostbyname($ip);
|
||||
|
||||
return strtolower(geoip_country_code_by_addr($gi, $ip));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_realpath($path)
|
||||
{
|
||||
// WRAPPER SO IT CAN BE DISABLED
|
||||
|
||||
global $lgsl_config;
|
||||
|
||||
return $lgsl_config['no_realpath'] ? $path : realpath($path);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_file_path()
|
||||
{
|
||||
// GET THE LGSL_CLASS.PHP PATH
|
||||
|
||||
$lgsl_path = __FILE__;
|
||||
|
||||
// SHORTEN TO JUST THE FOLDERS AND ADD TRAILING SLASH
|
||||
|
||||
$lgsl_path = dirname($lgsl_path)."/";
|
||||
|
||||
// CONVERT WINDOWS BACKSLASHES TO FORWARDSLASHES
|
||||
|
||||
$lgsl_path = str_replace("\\", "/", $lgsl_path);
|
||||
|
||||
return $lgsl_path;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
function lgsl_url_path()
|
||||
{
|
||||
// CHECK IF PATH HAS BEEN SET IN CONFIG
|
||||
|
||||
global $lgsl_config;
|
||||
|
||||
if ($lgsl_config['url_path'])
|
||||
{
|
||||
return $lgsl_config['url_path'];
|
||||
}
|
||||
|
||||
// USE FULL DOMAIN PATH TO AVOID ALIAS PROBLEMS
|
||||
|
||||
$host_path = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != "on") ? "http://" : "https://";
|
||||
$host_path .= $_SERVER['HTTP_HOST'];
|
||||
|
||||
// GET FULL PATHS ( EXTRA CODE FOR WINDOWS AND IIS - NO DOCUMENT_ROOT - BACKSLASHES - DOUBLESLASHES - ETC )
|
||||
|
||||
if ($_SERVER['DOCUMENT_ROOT'])
|
||||
{
|
||||
$base_path = lgsl_realpath($_SERVER['DOCUMENT_ROOT']);
|
||||
$base_path = str_replace("\\", "/", $base_path);
|
||||
$base_path = str_replace("//", "/", $base_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_path = $_SERVER['SCRIPT_NAME'];
|
||||
$file_path = str_replace("\\", "/", $file_path);
|
||||
$file_path = str_replace("//", "/", $file_path);
|
||||
|
||||
$base_path = $_SERVER['PATH_TRANSLATED'];
|
||||
$base_path = str_replace("\\", "/", $base_path);
|
||||
$base_path = str_replace("//", "/", $base_path);
|
||||
$base_path = substr($base_path, 0, -strlen($file_path));
|
||||
}
|
||||
|
||||
$lgsl_path = dirname(lgsl_realpath(__FILE__));
|
||||
$lgsl_path = str_replace("\\", "/", $lgsl_path);
|
||||
|
||||
// REMOVE ANY TRAILING SLASHES
|
||||
|
||||
if (substr($base_path, -1) == "/") { $base_path = substr($base_path, 0, -1); }
|
||||
if (substr($lgsl_path, -1) == "/") { $lgsl_path = substr($lgsl_path, 0, -1); }
|
||||
|
||||
// USE THE DIFFERENCE BETWEEN PATHS
|
||||
|
||||
if (substr($lgsl_path, 0, strlen($base_path)) == $base_path)
|
||||
{
|
||||
$url_path = substr($lgsl_path, strlen($base_path));
|
||||
|
||||
return $host_path.$url_path."/";
|
||||
}
|
||||
|
||||
return "/#LGSL_PATH_PROBLEM#{$base_path}#{$lgsl_path}#/";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
} // END OF DOUBLE LOAD PROTECTION
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
global $lgsl_file_path, $lgsl_url_path;
|
||||
|
||||
$lgsl_file_path = lgsl_file_path();
|
||||
|
||||
if (isset($_GET['lgsl_debug']))
|
||||
{
|
||||
echo "<hr /><pre>".print_r($_SERVER, TRUE)."</pre>
|
||||
<hr />#d0# ".__FILE__."
|
||||
<hr />#d1# ".@realpath(__FILE__)."
|
||||
<hr />#d2# ".dirname(__FILE__)."
|
||||
<hr />#d3# {$lgsl_file_path}
|
||||
<hr />#d4# {$_SERVER['DOCUMENT_ROOT']}
|
||||
<hr />#d5# ".@realpath($_SERVER['DOCUMENT_ROOT']);
|
||||
}
|
||||
require $lgsl_file_path."lgsl_config.php";
|
||||
require "protocol/lgsl/lgsl_protocol.php";
|
||||
|
||||
$lgsl_url_path = lgsl_url_path();
|
||||
|
||||
if (isset($_GET['lgsl_debug']))
|
||||
{
|
||||
echo "<hr />#d6# {$lgsl_url_path}
|
||||
<hr />#c0# {$lgsl_config['url_path']}
|
||||
<hr />#c1# {$lgsl_config['no_realpath']}
|
||||
<hr />#c2# {$lgsl_config['feed']['method']}
|
||||
<hr />#c3# {$lgsl_config['feed']['url']}
|
||||
<hr />#c4# {$lgsl_config['cache_time']}
|
||||
<hr />#c5# {$lgsl_config['live_time']}
|
||||
<hr />#c6# {$lgsl_config['timeout']}
|
||||
<hr />#c7# {$lgsl_config['cms']}
|
||||
<hr />";
|
||||
}
|
||||
|
||||
if (!isset($lgsl_config['locations']))
|
||||
{
|
||||
exit("LGSL PROBLEM: lgsl_config.php FAILED TO LOAD OR MISSING ENTRIES");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
<?php
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ PREPARE CONFIG - DO NOT CHANGE OR MOVE THIS ]
|
||||
|
||||
global $lgsl_config; $lgsl_config = array();
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ BACKGROUND COLORS: TEXT HARD TO READ ? CHANGE THESE TO CONTRAST THE FONT COLOR / www.colorpicker.com ]
|
||||
|
||||
$lgsl_config['background'][1] = "background-color:#e4eaf2";
|
||||
$lgsl_config['background'][2] = "background-color:#f4f7fa";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ SHOW LOCATION FLAGS: 0=OFF 1=GEO-IP "GB"=MANUALLY SET COUNTRY CODE FOR SPEED ]
|
||||
|
||||
$lgsl_config['locations'] = 1;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ SHOW TOTAL SERVERS AND PLAYERS AT BOTTOM OF LIST: 0=OFF 1=ON ]
|
||||
|
||||
$lgsl_config['list']['totals'] = 1;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ SORTING OPTIONS ]
|
||||
|
||||
$lgsl_config['sort']['servers'] = "id"; // OPTIONS: id type zone players status
|
||||
$lgsl_config['sort']['players'] = "name"; // OPTIONS: name score
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// [ HIDE OFFLINE SERVERS: 0=SHOW 1=HIDE
|
||||
|
||||
$lgsl_config['hide_offline'][0] = 0;
|
||||
$lgsl_config['hide_offline'][1] = 0;
|
||||
$lgsl_config['hide_offline'][2] = 0;
|
||||
$lgsl_config['hide_offline'][3] = 0;
|
||||
$lgsl_config['hide_offline'][4] = 0;
|
||||
$lgsl_config['hide_offline'][5] = 0;
|
||||
$lgsl_config['hide_offline'][6] = 0;
|
||||
$lgsl_config['hide_offline'][7] = 0;
|
||||
$lgsl_config['hide_offline'][8] = 0;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ HOSTING FIXES ]
|
||||
|
||||
$lgsl_config['direct_index'] = 0; // 1=link to index.php instead of the folder
|
||||
$lgsl_config['no_realpath'] = 0; // 1=do not use the realpath function
|
||||
$lgsl_config['url_path'] = ""; // full url to /lgsl_files/ for when auto detection fails
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ ADVANCED SETTINGS ]
|
||||
|
||||
$lgsl_config['management'] = 0; // 1=show advanced management in the admin by default
|
||||
$lgsl_config['host_to_ip'] = 0; // 1=show the servers ip instead of its hostname
|
||||
$lgsl_config['public_add'] = 2; // 1=servers require approval OR 2=servers shown instantly
|
||||
$lgsl_config['public_feed'] = 1; // 1=feed requests can add new servers to your list
|
||||
$lgsl_config['cache_time'] = 10; // seconds=time before a server needs updating
|
||||
$lgsl_config['live_time'] = 5; // seconds=time allowed for updating servers per page load
|
||||
$lgsl_config['timeout'] = 0; // 1=gives more time for servers to respond but adds loading delay
|
||||
$lgsl_config['retry_offline'] = 0; // 1=repeats query when there is no response but adds loading delay
|
||||
$lgsl_config['cms'] = "sa"; // sets which CMS specific code to use
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
//[ TRANSLATION ]
|
||||
if( isset($_SESSION['users_lang']) and $_SESSION['users_lang'] != "-" )
|
||||
define("LANG", $_SESSION['users_lang']);
|
||||
elseif( isset($GLOBALS['panel_language']) )
|
||||
define("LANG",$GLOBALS['panel_language']);
|
||||
else
|
||||
define("LANG","English");
|
||||
|
||||
if( LANG == "Spanish" )
|
||||
{
|
||||
// SPANISH
|
||||
$lgsl_config['text']['vsd'] = "PULSE AQUI PARA VER LOS DETALLES DEL SERVIDOR";
|
||||
$lgsl_config['text']['slk'] = "CONECTAR AL SERVIDOR";
|
||||
$lgsl_config['text']['sts'] = "Estado:";
|
||||
$lgsl_config['text']['adr'] = "Dirección:";
|
||||
$lgsl_config['text']['cpt'] = "Puerto:";
|
||||
$lgsl_config['text']['qpt'] = "Peticiones:";
|
||||
$lgsl_config['text']['typ'] = "Tipo:";
|
||||
$lgsl_config['text']['gme'] = "Juego:";
|
||||
$lgsl_config['text']['map'] = "Mapa:";
|
||||
$lgsl_config['text']['plr'] = "Jugadores:";
|
||||
$lgsl_config['text']['npi'] = "NO HAY INFO DE JUGADORES";
|
||||
$lgsl_config['text']['nei'] = "NO HAY INFO EXTRA";
|
||||
$lgsl_config['text']['ehs'] = "Configuración";
|
||||
$lgsl_config['text']['ehv'] = "Valor";
|
||||
$lgsl_config['text']['onl'] = "EN LINEA";
|
||||
$lgsl_config['text']['onp'] = "EN LINEA CON CONTRASEÑA";
|
||||
$lgsl_config['text']['nrs'] = "NO HAY RESPUESTA";
|
||||
$lgsl_config['text']['pen'] = "PETICION EN CURSO";
|
||||
$lgsl_config['text']['zpl'] = "JUGADORES:";
|
||||
$lgsl_config['text']['mid'] = "IDENTIFICADOR INVALIDO";
|
||||
$lgsl_config['text']['nnm'] = "--";
|
||||
$lgsl_config['text']['nmp'] = "--";
|
||||
$lgsl_config['text']['tns'] = "Servidores:";
|
||||
$lgsl_config['text']['tnp'] = "Jugadores:";
|
||||
$lgsl_config['text']['tmp'] = "Max Jugadores:";
|
||||
$lgsl_config['text']['asd'] = "LA ADICION DE SERVIDORES PUBLICA ESTA DEHABILITADA";
|
||||
$lgsl_config['text']['awm'] = "ESTE AREA TE PERMITE PROBAR Y AÑADIR SERVIDORES DE JUEGOS A LA LISTA";
|
||||
$lgsl_config['text']['ats'] = "Probar servidor";
|
||||
$lgsl_config['text']['aaa'] = "YA SE AÑADIO EL SERVIDOR Y ESTA EN ESPERA DE SER APROBADO";
|
||||
$lgsl_config['text']['aan'] = "YA SE AÑADIO EL SERVIDOR";
|
||||
$lgsl_config['text']['anr'] = "NO RESPONDE - ASEGURESE DE HABER INTRODUCIDO LA INFORMACION CORRECTA";
|
||||
$lgsl_config['text']['ada'] = "EL SERVIDOR SE AÑADIO POR APROVACION DE UN ADMINISTRADOR";
|
||||
$lgsl_config['text']['adn'] = "SERVIDOR AÑADIDO";
|
||||
$lgsl_config['text']['asc'] = "CORRECTO - PORFAVOR CONFIRME EL SERVIDOR";
|
||||
$lgsl_config['text']['aas'] = "Añadir Servidor";
|
||||
$lgsl_config['text']['loc'] = "Hubicación:";
|
||||
}
|
||||
elseif( LANG == "French" )
|
||||
{
|
||||
// FRENCH
|
||||
$lgsl_config['text']['vsd'] = "CLIQUER POUR VOIR LES DETAILS";
|
||||
$lgsl_config['text']['slk'] = "REJOINDRE LE SERVEUR";
|
||||
$lgsl_config['text']['sts'] = "Statut:";
|
||||
$lgsl_config['text']['adr'] = "Adresse:";
|
||||
$lgsl_config['text']['cpt'] = "Connection Port:";
|
||||
$lgsl_config['text']['qpt'] = "Query Port:";
|
||||
$lgsl_config['text']['typ'] = "Type:";
|
||||
$lgsl_config['text']['gme'] = "Jeu:";
|
||||
$lgsl_config['text']['map'] = "Carte:";
|
||||
$lgsl_config['text']['plr'] = "Joueurs:";
|
||||
$lgsl_config['text']['npi'] = "PAS D'INFO JOUEUR";
|
||||
$lgsl_config['text']['nei'] = "PAS D'INFO EXTRA";
|
||||
$lgsl_config['text']['ehs'] = "Paramètres";
|
||||
$lgsl_config['text']['ehv'] = "Valeur";
|
||||
$lgsl_config['text']['onl'] = "EN LIGNE";
|
||||
$lgsl_config['text']['onp'] = "EN LIGNE AVEC MOT DE PASSE";
|
||||
$lgsl_config['text']['nrs'] = "PAS DE RÉPONSE";
|
||||
$lgsl_config['text']['pen'] = "EN ATTENTE DE REQUÊTE";
|
||||
$lgsl_config['text']['zpl'] = "JOUEURS:";
|
||||
$lgsl_config['text']['mid'] = "ID SERVEUR INVALIDE";
|
||||
$lgsl_config['text']['nnm'] = "--";
|
||||
$lgsl_config['text']['nmp'] = "--";
|
||||
$lgsl_config['text']['tns'] = "Serveurs:";
|
||||
$lgsl_config['text']['tnp'] = "Joueurs:";
|
||||
$lgsl_config['text']['tmp'] = "Joueurs Max:";
|
||||
$lgsl_config['text']['asd'] = "AJOUT PUBLIQUE DE SERVEUR DÉSACTIVÉ";
|
||||
$lgsl_config['text']['awm'] = "CETTE ZONE VOUS PERMET DE TESTER ET ENSUITE D'AJOUTER DES SERVEURS EN LIGNE À LA LISTE";
|
||||
$lgsl_config['text']['ats'] = "Tester Serveur";
|
||||
$lgsl_config['text']['aaa'] = "SERVEUR DÉJÀ AJOUTÉ EN ATTENTE D'APPROBATION D'UN ADMIN";
|
||||
$lgsl_config['text']['aan'] = "SERVEUR DÉJÀ AJOUTÉ";
|
||||
$lgsl_config['text']['anr'] = "PAS DE RÉPONSE - VEUILLEZ ÊTRE SÛR D'AJOUTER LES BONNES INFORMATIONS";
|
||||
$lgsl_config['text']['ada'] = "SERVEUR AJOUTÉ POUR APPROBATION D'UN ADMIN";
|
||||
$lgsl_config['text']['adn'] = "SERVEUR AJOUTÉ";
|
||||
$lgsl_config['text']['asc'] = "RÉUSSI - VEUILLEZ CONFIRMER QU'IL S'AGIT DU BON SERVEUR";
|
||||
$lgsl_config['text']['aas'] = "Ajouter un serveur";
|
||||
$lgsl_config['text']['loc'] = "Localisation:";
|
||||
}
|
||||
else
|
||||
{
|
||||
// ENGLISH
|
||||
$lgsl_config['text']['vsd'] = "CLICK TO VIEW SERVER DETAILS";
|
||||
$lgsl_config['text']['slk'] = "GAME LINK";
|
||||
$lgsl_config['text']['sts'] = "Status:";
|
||||
$lgsl_config['text']['adr'] = "Address:";
|
||||
$lgsl_config['text']['cpt'] = "Connection Port:";
|
||||
$lgsl_config['text']['qpt'] = "Query Port:";
|
||||
$lgsl_config['text']['typ'] = "Type:";
|
||||
$lgsl_config['text']['gme'] = "Game:";
|
||||
$lgsl_config['text']['map'] = "Map:";
|
||||
$lgsl_config['text']['plr'] = "Players:";
|
||||
$lgsl_config['text']['npi'] = "NO PLAYER INFO";
|
||||
$lgsl_config['text']['nei'] = "NO EXTRA INFO";
|
||||
$lgsl_config['text']['ehs'] = "Setting";
|
||||
$lgsl_config['text']['ehv'] = "Value";
|
||||
$lgsl_config['text']['onl'] = "ONLINE";
|
||||
$lgsl_config['text']['onp'] = "ONLINE WITH PASSWORD";
|
||||
$lgsl_config['text']['nrs'] = "NO RESPONSE";
|
||||
$lgsl_config['text']['pen'] = "WAITING TO BE QUERIED";
|
||||
$lgsl_config['text']['zpl'] = "PLAYERS:";
|
||||
$lgsl_config['text']['mid'] = "INVALID SERVER ID";
|
||||
$lgsl_config['text']['nnm'] = "--";
|
||||
$lgsl_config['text']['nmp'] = "--";
|
||||
$lgsl_config['text']['tns'] = "Servers:";
|
||||
$lgsl_config['text']['tnp'] = "Players:";
|
||||
$lgsl_config['text']['tmp'] = "Max Players:";
|
||||
$lgsl_config['text']['asd'] = "PUBLIC ADDING OF SERVERS IS DISABLED";
|
||||
$lgsl_config['text']['awm'] = "THIS AREA ALLOWS YOU TO TEST AND THEN ADD ONLINE GAME SERVERS TO THE LIST";
|
||||
$lgsl_config['text']['ats'] = "Test Server";
|
||||
$lgsl_config['text']['aaa'] = "SERVER ALREADY ADDED AND NEEDS ADMIN APPROVAL";
|
||||
$lgsl_config['text']['aan'] = "SERVER ALREADY ADDED";
|
||||
$lgsl_config['text']['anr'] = "NO RESPONSE - MAKE SURE YOU ENTERED THE CORRECT DETAILS";
|
||||
$lgsl_config['text']['ada'] = "SERVER HAS BEEN ADDED FOR ADMIN APPROVAL";
|
||||
$lgsl_config['text']['adn'] = "SERVER HAS BEEN ADDED";
|
||||
$lgsl_config['text']['asc'] = "SUCCESS - PLEASE CONFIRM ITS THE CORRECT SERVER";
|
||||
$lgsl_config['text']['aas'] = "Add Server";
|
||||
$lgsl_config['text']['loc'] = "Location:";
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
|
@ -1,270 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
|-------------------------------------------------------------------------------------------------------------
|
||||
| [ EDITOR STYLE SETTINGS: LUCIDA CONSOLE, SIZE 10, TAB = 2 SPACES, BOLD GLOBALLY TURNED OFF ] |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
require "lgsl_class.php";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// THIS ALLOWS YOU TO CONTROL THE FIELDS DISPLAYED AND THEIR ORDER
|
||||
|
||||
$fields_show = array("name", "score", "deaths", "team", "ping", "bot", "time"); // THESE FIELDS ARE ORDERED FIRST
|
||||
$fields_hide = array("teamindex", "pid", "pbguid"); // THESE FIELDS ARE REMOVED
|
||||
$fields_other = TRUE; // FALSE WILL HIDE FIELDS NOT IN $fields_show
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// GET THE SERVER DETAILS AND PREPARE IT FOR DISPLAY
|
||||
|
||||
$lookup = lgsl_lookup_id($_GET['s']);
|
||||
|
||||
if (!$lookup)
|
||||
{
|
||||
$output .= "<div style='margin:auto; text-align:center'> {$lgsl_config['text']['mid']} </div>"; return;
|
||||
}
|
||||
|
||||
$server = lgsl_query_cached($lookup['type'], $lookup['ip'], $lookup['c_port'], $lookup['q_port'], $lookup['s_port'], "sep");
|
||||
$fields = lgsl_sort_fields($server, $fields_show, $fields_hide, $fields_other);
|
||||
$server = lgsl_sort_players($server);
|
||||
$server = lgsl_sort_extras($server);
|
||||
$misc = lgsl_server_misc($server);
|
||||
$server = lgsl_server_html($server);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='margin:auto; text-align:center'>";
|
||||
$output .= create_back_button($_GET['m'],$_GET['p']);
|
||||
$output .="
|
||||
<div style='".lgsl_bg(TRUE)."; width:90%; margin:auto; text-align:center; height:6px; border:1px solid'><br /></div>
|
||||
<div style='height:10px'><br /></div>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// SHOW THE STANDARD INFO
|
||||
|
||||
$output .= "
|
||||
<table cellpadding='2' cellspacing='2' style='margin:auto'>
|
||||
<tr>
|
||||
<td colspan='3' style='text-align:center'>
|
||||
<b> {$server['s']['name']} </b><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center'>
|
||||
<table cellpadding='4' cellspacing='2' style='width:100%; margin:auto'>
|
||||
<tr><td style='".lgsl_bg(TRUE)."; text-align:center'><a href='{$misc['software_link']}'>{$lgsl_config['text']['slk']}</a></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td rowspan='2' style='text-align:center' >
|
||||
<div style='background-image:url({$misc['image_map']}); background-repeat:no-repeat; background-position:center'>
|
||||
<img alt='' src='{$misc['image_map_password']}' style='border:none; width:auto; background:url({$misc['icon_game']}); background-repeat:no-repeat; background-position:4px 4px' />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='text-align:center'>
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['sts']} </b></td><td style='white-space:nowrap'> {$misc['text_status']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['adr']} </b></td><td style='white-space:nowrap'> {$server['b']['ip']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['cpt']} </b></td><td style='white-space:nowrap'> {$server['b']['c_port']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['qpt']} </b></td><td style='white-space:nowrap'> {$server['b']['q_port']} </td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td style='text-align:center'>
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['typ']} </b></td><td style='white-space:nowrap'> {$server['b']['type']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['gme']} </b></td><td style='white-space:nowrap'> {$server['s']['game']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['map']} </b></td><td style='white-space:nowrap'> {$server['s']['map']} </td></tr>
|
||||
<tr style='".lgsl_bg().";white-space:nowrap'><td> <b> {$lgsl_config['text']['plr']} </b></td><td style='white-space:nowrap'> {$server['s']['players']} / {$server['s']['playersmax']} </td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='height:10px'><br /></div>
|
||||
<div style='".lgsl_bg(TRUE)."; width:90%; margin:auto; text-align:center; height:6px; border:1px solid'><br /></div>
|
||||
<div style='height:10px'><br /></div>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// SHOW THE PLAYERS
|
||||
|
||||
$output .= "
|
||||
<div style='margin:auto; overflow:auto; text-align:center; padding:10px'>";
|
||||
|
||||
if (!$server['p'] || !is_array($server['p']))
|
||||
{
|
||||
$output .= "
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg(FALSE)."'>
|
||||
<td> {$lgsl_config['text']['npi']} </td>
|
||||
</tr>
|
||||
</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg(FALSE)."'>";
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$field = ucfirst($field);
|
||||
$output .= "
|
||||
<td> <b>{$field}</b> </td>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</tr>";
|
||||
|
||||
foreach ($server['p'] as $player_key => $player)
|
||||
{
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg()."'>";
|
||||
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$output .= "<td> {$player[$field]} </td>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</table>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</div>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='height:10px'><br /></div>
|
||||
<div style='".lgsl_bg(TRUE)."; width:90%; margin:auto; text-align:center; height:6px; border:1px solid'><br /></div>
|
||||
<div style='height:20px'><br /></div>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
// SHOW THE SETTINGS
|
||||
|
||||
if (!$server['e'] || !is_array($server['e']))
|
||||
{
|
||||
$output .= "
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg(FALSE)."'>
|
||||
<td> {$lgsl_config['text']['nei']} </td>
|
||||
</tr>
|
||||
</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg(FALSE)."'>
|
||||
<td> <b>{$lgsl_config['text']['ehs']}</b> </td>
|
||||
<td> <b>{$lgsl_config['text']['ehv']}</b> </td>
|
||||
</tr>";
|
||||
|
||||
foreach ($server['e'] as $field => $value)
|
||||
{
|
||||
$color = lgsl_bg();
|
||||
|
||||
$output .= "
|
||||
<tr>
|
||||
<td style='{$color}'> {$field} </td>
|
||||
<td style='{$color}'> {$value} </td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</table>";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='height:10px'><br /></div>
|
||||
<div style='".lgsl_bg(TRUE)."; width:90%; margin:auto; text-align:center; height:6px; border:1px solid'><br /></div>
|
||||
<div style='height:20px'><br /></div>";
|
||||
|
||||
$output .= "
|
||||
</div>";
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
$scheme = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "https://" : "http://";
|
||||
$index_link = $scheme . implode('/', (explode('/', $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], -1))) . "/index.php";
|
||||
$output .= "
|
||||
<table cellpadding='4' cellspacing='2' style='margin:auto'>
|
||||
<tr style='".lgsl_bg(TRUE)."' align='center'>
|
||||
<td><b>Banner</b></td>
|
||||
<td><img src='index.php?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."'/></td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg(FALSE)."' align='center'>
|
||||
<td><b>Codes</b></td>
|
||||
<td>
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\"][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='<a href=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\" target=\"_blank\" ><img src=\"".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."\" /></a>' />
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg(TRUE)."' align='center'>
|
||||
<td><b>Banner</b></td>
|
||||
<td><img src='index.php?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=small'/></td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg(FALSE)."' align='center'>
|
||||
<td><b>Codes</b></td>
|
||||
<td>
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=small[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\"][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=small[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='<a href=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\" target=\"_blank\" ><img src=\"".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=small\" /></a>' />
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg(TRUE)."' align='center'>
|
||||
<td><b>Banner</b></td>
|
||||
<td><img src='index.php?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=sky'/></td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg(FALSE)."' align='center'>
|
||||
<td><b>Codes</b></td>
|
||||
<td>
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=sky[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='[url=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\"][img]".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=sky[/img][/url]' /><br />
|
||||
<input type='text' readonly='readonly' size='55' onclick='select()' value='<a href=\"".$index_link."?m=lgsl_with_img_mod&p=lgsl&s=".$_GET['s']."\" target=\"_blank\" ><img src=\"".$index_link."?m=lgsl_with_img_mod&p=image&type=cleared&s=".$_GET['s']."&img_type=sky\" /></a>' />
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$output .= "
|
||||
</table>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='height:10px'><br /></div>
|
||||
<div style='".lgsl_bg(TRUE)."; width:90%; margin:auto; text-align:center; height:6px; border:1px solid'><br /></div>
|
||||
<div style='height:20px'><br /></div>";
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
//------ PLEASE MAKE A DONATION OR SIGN THE GUESTBOOK AT GREYCUBE.COM IF YOU REMOVE THIS CREDIT ---------------------------------------------------------------------------------------------------+
|
||||
$output .= "<a href='http://www.greycube.com' style='text-decoration:none'>".lgsl_version()."</a>|<a href='http://cgx24.com/' style='text-decoration:none'>Image Mod By CGX24</a><br /></div>";
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
?>
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
<?php
|
||||
function get_true_boolean($bool)
|
||||
{
|
||||
if ( (int) $bool > 0 )
|
||||
$ret = true;
|
||||
else
|
||||
{
|
||||
$lowered_bool = strtolower($bool); // that could be 'True' or 'true' or 'TRUE', etc...
|
||||
if( $lowered_bool === "true" || $lowered_bool === "on" || $lowered_bool === "yes" )
|
||||
$ret = true;
|
||||
else
|
||||
$ret = false;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$request_string = "";
|
||||
|
||||
foreach($_GET as $key => $val)
|
||||
{
|
||||
if($key == "type") $key = "lgsl_type";
|
||||
$request_string .= "&$key=$val";
|
||||
}
|
||||
|
||||
$scheme = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "https://" : "http://";
|
||||
$index_link = $scheme . implode('/', (explode('/', $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], -4))) . "/index.php";
|
||||
$lgsl_feed_error = 0;
|
||||
if (function_exists('curl_init') && function_exists('curl_setopt') && function_exists('curl_exec'))
|
||||
{
|
||||
$lgsl_curl = curl_init();
|
||||
|
||||
curl_setopt($lgsl_curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($lgsl_curl, CURLOPT_HTTPGET, 1);
|
||||
curl_setopt($lgsl_curl, CURLOPT_TIMEOUT, 6);
|
||||
curl_setopt($lgsl_curl, CURLOPT_ENCODING, "");
|
||||
curl_setopt($lgsl_curl, CURLOPT_FORBID_REUSE, 1);
|
||||
curl_setopt($lgsl_curl, CURLOPT_FRESH_CONNECT, 1);
|
||||
curl_setopt($lgsl_curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($lgsl_curl, CURLOPT_CONNECTTIMEOUT, 6);
|
||||
if($scheme == "https://")
|
||||
{
|
||||
curl_setopt($lgsl_curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($lgsl_curl, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
}
|
||||
curl_setopt($lgsl_curl, CURLOPT_URL, "$index_link?m=lgsl_with_img_mod&p=feed&type=cleared$request_string");
|
||||
|
||||
$http_reply = curl_exec($lgsl_curl);
|
||||
|
||||
if (curl_error($lgsl_curl))
|
||||
{
|
||||
$lgsl_feed_error = 1;
|
||||
}
|
||||
|
||||
curl_close($lgsl_curl);
|
||||
}
|
||||
elseif (function_exists('fsockopen'))
|
||||
{
|
||||
$ssl = $scheme == "https://" ? "ssl://" : "";
|
||||
$lgsl_fp = @fsockopen($ssl.$_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT'], $errno, $errstr, 6);
|
||||
|
||||
if (!$lgsl_fp)
|
||||
{
|
||||
$lgsl_feed_error = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_set_timeout($lgsl_fp, 6, 0);
|
||||
stream_set_blocking($lgsl_fp, TRUE);
|
||||
$host = parse_url("$index_link?m=lgsl_with_img_mod&p=feed&type=cleared$request_string");
|
||||
$http_send = "GET {$host['path']}?{$host['query']} HTTP/1.0\r\n";
|
||||
$http_send .= "Host: {$host['host']}\r\n";
|
||||
$http_send .= "Port: {$host['port']}\r\n";
|
||||
$http_send .= "Pragma: no-cache\r\n";
|
||||
$http_send .= "Cache-Control: max-age=0\r\n";
|
||||
$http_send .= "Accept-Encoding: \r\n";
|
||||
$http_send .= "Accept-Language: en-us,en;q=0.5\r\n";
|
||||
$http_send .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n";
|
||||
$http_send .= "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";
|
||||
$http_send .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.4) Gecko/20091028\r\n";
|
||||
$http_send .= "Connection: Close\r\n\r\n";
|
||||
|
||||
fwrite($lgsl_fp, $http_send);
|
||||
|
||||
$http_reply = "";
|
||||
|
||||
while (!feof($lgsl_fp))
|
||||
{
|
||||
$http_chunk = fread($lgsl_fp, 4096);
|
||||
if ($http_chunk === "") { break; }
|
||||
$http_reply .= $http_chunk;
|
||||
}
|
||||
|
||||
@fclose($lgsl_fp);
|
||||
$http_reply = substr($http_reply, strpos($http_reply,"\r\n\r\n")+4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "LGSL FEED PROBLEM: NO CURL OR FSOCKOPEN SUPPORT"; return;
|
||||
}
|
||||
if (!$lgsl_feed_error)
|
||||
{
|
||||
echo trim($http_reply);
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------------------------------\
|
||||
| |
|
||||
| [ LIVE GAME SERVER LIST ] [ © RICHARD PERRY FROM GREYCUBE.COM ] |
|
||||
| |
|
||||
| Released under the terms and conditions of the GNU General Public License Version 3 (http://gnu.org) |
|
||||
| |
|
||||
\-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
require "lgsl_class.php";
|
||||
|
||||
$server_list = lgsl_query_group();
|
||||
$server_list = lgsl_sort_servers($server_list);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
$output .= "
|
||||
<div style='text-align:center'>
|
||||
<table style='margin:auto' cellpadding='4' cellspacing='2'>";
|
||||
|
||||
foreach ($server_list as $server)
|
||||
{
|
||||
$misc = lgsl_server_misc($server);
|
||||
$server = lgsl_server_html($server);
|
||||
|
||||
$output .= "
|
||||
<tr style='".lgsl_bg()."; table-layout:fixed'>
|
||||
|
||||
<td style='white-space:nowrap; text-align:center'>
|
||||
<img alt='' src='{$misc['icon_status']}' title='{$misc['text_status']}' style='vertical-align:middle' />
|
||||
<img alt='' src='{$misc['icon_game']}' title='{$misc['text_type_game']}' style='vertical-align:middle' />
|
||||
</td>
|
||||
|
||||
<td title='{$lgsl_config['text']['slk']}' style='text-align:right'>
|
||||
<a href='{$misc['software_link']}' style='text-decoration:none'>
|
||||
{$server['b']['ip']}:{$server['b']['c_port']}
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td title='{$server['s']['name']}' style='text-align:left'>
|
||||
<div style='width:100%; overflow:hidden; height:1.3em; line-height:1.3em'>
|
||||
{$misc['name_filtered']}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td style='white-space:nowrap; text-align:left'>
|
||||
{$server['s']['map']}
|
||||
</td>
|
||||
|
||||
<td style='white-space:nowrap; text-align:right'>
|
||||
{$server['s']['players']} / {$server['s']['playersmax']}
|
||||
</td>
|
||||
|
||||
<td style='white-space:nowrap; text-align:center'>";
|
||||
|
||||
if ($lgsl_config['locations'])
|
||||
{
|
||||
$output .= "<img alt='' src='{$misc['icon_location']}' title='{$misc['text_location']}' style='vertical-align:middle; border:none' />";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
<a href='".lgsl_link($server['o']['id'])."' style='text-decoration:none'>
|
||||
<img alt='' src='{$misc['icon_details']}' title='{$lgsl_config['text']['vsd']}' style='vertical-align:middle; border:none' />
|
||||
</a>
|
||||
</td>
|
||||
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$output .= "
|
||||
</table>
|
||||
</div>";
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
if ($lgsl_config['list']['totals'])
|
||||
{
|
||||
$total = lgsl_group_totals($server_list);
|
||||
|
||||
$output .= "
|
||||
<div>
|
||||
<br />
|
||||
</div>
|
||||
<div style='text-align:center'>
|
||||
<table style='margin:auto' cellpadding='4' cellspacing='2'>
|
||||
<tr style='".lgsl_bg()."'>
|
||||
<td> {$lgsl_config['text']['tns']} {$total['servers']} </td>
|
||||
<td> {$lgsl_config['text']['tnp']} {$total['players']} </td>
|
||||
<td> {$lgsl_config['text']['tmp']} {$total['playersmax']} </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
//------ PLEASE MAKE A DONATION OR SIGN THE GUESTBOOK AT GREYCUBE.COM IF YOU REMOVE THIS CREDIT ----------------------------------------------------------------------------------------------------+
|
||||
$output .= "<a href='http://www.greycube.com' style='text-decoration:none'>".lgsl_version()."</a>";
|
||||
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
Before Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 277 B |
|
Before Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 266 B |
|
Before Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 868 B |
|
Before Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 6 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 358 B |
|
|
@ -1,29 +0,0 @@
|
|||
body
|
||||
{
|
||||
background-color:#9f9ca5;
|
||||
font-size:11px;
|
||||
font-family:verdana,tahoma,arial;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
a:link
|
||||
{
|
||||
text-decoration:none;
|
||||
color:#c00000;
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
text-decoration:none;
|
||||
color:#c00000;
|
||||
}
|
||||
|
||||
a:hover
|
||||
{
|
||||
color:#7500c0;
|
||||
}
|
||||
|
||||
a:active
|
||||
{
|
||||
color:#7500c0;
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
*
|
||||
* OGP - Open Game Panel
|
||||
* Copyright (C) 2008 - 2017 The OGP Development Team
|
||||
*
|
||||
* http://www.opengamepanel.org/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// Module general information
|
||||
$module_title = "LGSL";
|
||||
$module_version = "0.2";
|
||||
$db_version = 0;
|
||||
$module_required = FALSE;
|
||||
$module_menus = array( array( 'subpage' => 'lgsl', 'name'=>'LGSL', 'group'=>'user' ),
|
||||
array( 'subpage' => 'lgsl', 'name'=>'LGSL', 'group'=>'guest' ),
|
||||
array( 'subpage' => 'lgsl_admin', 'name'=>'LGSL Admin', 'group'=>'admin' ));
|
||||
|
||||
$install_queries = array();
|
||||
$install_queries[0] = array(
|
||||
"CREATE TABLE IF NOT EXISTS ".OGP_DB_PREFIX."lgsl
|
||||
(
|
||||
|
||||
`id` INT (11) NOT NULL auto_increment,
|
||||
`type` VARCHAR (50) NOT NULL DEFAULT '',
|
||||
`ip` VARCHAR (255) NOT NULL DEFAULT '',
|
||||
`c_port` VARCHAR (5) NOT NULL DEFAULT '0',
|
||||
`q_port` VARCHAR (5) NOT NULL DEFAULT '0',
|
||||
`s_port` VARCHAR (5) NOT NULL DEFAULT '0',
|
||||
`zone` VARCHAR (255) NOT NULL DEFAULT '',
|
||||
`disabled` TINYINT (1) NOT NULL DEFAULT '0',
|
||||
`comment` VARCHAR (255) NOT NULL DEFAULT '',
|
||||
`status` TINYINT (1) NOT NULL DEFAULT '0',
|
||||
`cache` TEXT NOT NULL,
|
||||
`cache_time` TEXT NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;"
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<navigation>
|
||||
<page key="lgsl" file="lgsl.php" access="admin,user,guest" />
|
||||
<page key="lgsl_admin" file="lgsl_admin.php" access="admin" />
|
||||
<page key="image" file="image.php" access="admin,user,guest" />
|
||||
<page key="feed" file="feed.php" access="admin,user,guest" />
|
||||
</navigation>
|
||||