Moved the Agents into their own repo. Kept the agent.pl just for reference

This commit is contained in:
Frank Harris 2025-09-11 13:27:32 -04:00
parent 22381be29a
commit 8680a02b13
18132 changed files with 0 additions and 2569420 deletions

View file

@ -1,4 +0,0 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule s-(.*)$ ../../index.php?m=dsi&p=image&type=cleared&s=$1 [NC]
</IfModule>

Binary file not shown.

View file

@ -1,168 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define("DSI_BASEPATH", "modules/dsi/");
require_once(DSI_BASEPATH . 'includes/functions_ui.php');
require_once('modules/config_games/server_config_parser.php');
function exec_ogp_module(){
global $db;
global $view;
echo "<h2>".get_lang("dsi_admin_long")."</h2>";
$server_homes = $db->getIpPorts();
if( $server_homes === FALSE )
{
// If there are no games, then there can not be any mods either.
print_failure(get_lang('no_game_homes_assigned'));
echo "<p><a href='?m=user_games&amp;p=assign&amp;user_id=$_SESSION[user_id]'>" .
get_lang("assign_game_homes") . "</a></p>";
return;
}
echo get_lang("dsi_select_server");
create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
if( isset($_GET['home_id-mod_id-ip-port']) and $_GET['home_id-mod_id-ip-port'] != "")
{
list( $home_id,
$mod_id,
$ip,
$port) = explode( "-", $_GET['home_id-mod_id-ip-port'] );
if( !is_numeric($home_id) or
!is_numeric($mod_id) or
!preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $ip) or
!is_numeric($port) )
return;
}
else
return;
foreach( $server_homes as $server_home )
{
if( $server_home['home_id'] == $home_id and
$server_home['mod_id'] == $mod_id and
$server_home['ip'] == $ip and
$server_home['port'] == $port )
{
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
$public_ip = checkDisplayPublicIP($server_home['display_public_ip'],$server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip']);
$mod = preg_replace("/[^a-z0-9_]/", "-", strtolower($server_home['mod_key']));
if ($server_xml->protocol == "gameq"){
$query_name = $server_xml->gameq_query_name;
}
elseif ($server_xml->protocol == "lgsl"){
$query_name = $server_xml->lgsl_query_name;
}
elseif ($server_xml->protocol == "teamspeak3"){
$query_name = 'ts3';
}
else{
$query_name = $mod; /* If query name does not exist use mod key instead. */
}
$title = $server_home['game_name']." (Mod: ".$mod.")";
$return = "";
if( isset($_POST) && isset($_FILES["file"]) )
{
$types = array();
if(isset($_POST['type1']))$types[] = $_POST['type1'];
if(isset($_POST['type2']))$types[] = $_POST['type2'];
if(isset($_POST['type3']))$types[] = $_POST['type3'];
if ( $_FILES["file"]["type"] == "image/png" && $_FILES["file"]["size"] < 200000 )
{
if ($_FILES["file"]["error"] > 0)
$return .= "Return Code: " . $_FILES["file"]["error"] . "<br />";
else
{
if(isset($types))
{
include( DSI_BASEPATH.'includes/SimpleImage.php' );
foreach($types as $type)
{
if( file_exists(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type") )
unlink(DSI_BASEPATH . "cache/$server_home[ip]_$server_home[port]-$type");
$bg_location = DSI_BASEPATH . "images/$query_name/";
$bg_filename = $mod."_".$type.".png";
if (file_exists($bg_location . $bg_filename))
{
unlink($bg_location . $bg_filename);
}
if( !file_exists($bg_location) )
mkdir($bg_location);
$image = new SimpleImage();
$image->load($_FILES["file"]["tmp_name"]);
if($type == "normal")
$image->resize(359,76);
elseif($type == "sky")
$image->resize(180,260);
elseif($type == "small")
$image->resize(359,25);
$image->save("$bg_location$bg_filename");
$return .= "<p style='color:green;'>Saved as: $bg_location$bg_filename.</p>";
}
}
unlink($_FILES["file"]["tmp_name"]);
}
}
else
$return .= "<p style='color:red;'>Invalid file, should be PNG format and file size should be less than 200Kb.</p>";
}
?>
<br />
<h2>Background for <?php echo $title; ?></h2>
<table class="center" >
<tr>
<td colspan="2" >
<br>
<form action="" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" accept="image/*" /><br />
<br>
<input type="checkbox" name="type1" value="normal" />Normal<br />
<input type="checkbox" name="type2" value="small" />Small<br />
<input type="checkbox" name="type3" value="sky" />Sky<br />
<br>
<input type="submit" name="submit" value="Submit" />
</form>
<?php
echo $return;
?>
<br>
</td>
</tr>
<?php
echo dsi_render_table($server_home["ip"], $server_home["port"], FALSE, FALSE, TRUE, FALSE, TRUE);
break;
}
}
?>
</table>
<?php
}
?>

View file

@ -1,175 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 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.
*
*/
define("DSI_BASEPATH", "modules/dsi/");
require_once(DSI_BASEPATH . 'includes/functions_ui.php');
require_once('modules/gamemanager/home_handling_functions.php');
require_once("modules/config_games/server_config_parser.php");
require_once('includes/lib_remote.php');
require_once('protocol/lgsl/lgsl_protocol.php');
require_once('protocol/GameQ/GameQ.php');
function exec_ogp_module(){
global $db;
$online = isset( $_POST['online'] ) ? TRUE : FALSE;
$server_homes = $db->getIpPorts();
echo "<h2>".get_lang("dsi_list")."</h2>\n";
if ( isset($_GET['home_id-mod_id-ip-port']) AND $_GET['home_id-mod_id-ip-port'] == "" )
unset( $_GET['home_id-mod_id-ip-port'] );
echo get_lang("dsi_select_server");
if (!isset($_GET['home_id-mod_id-ip-port']) and !$online)
{
create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
$show_all = TRUE;
}
else
{
create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
create_home_selector($_GET['m'], $_GET['p'], "show_all");
$show_all = FALSE;
}
$qty = count($server_homes);
$cols = 1;
if ( ( $qty >= 4 && $qty < 17 ) OR isset($_GET['home_id-mod_id-ip-port']) )
{
$cols = 4;
$type = "sky";
}
else
{
$type = "normal";
}
if ( $qty >= 17 ) $cols = 2;
$counter = 1;
echo $show_all ? "\n<form method='POST' >\n".
"\t<button name='online' onClick='this.form.submit()' >".
get_lang("online") .
"</button>\n".
"</form>\n".
"<br>\n" : "";
$servers = 0;
$servers_running = 0;
foreach ( $server_homes as $server_home )
{
$servers++;
// Get display IP
$public_ip = checkDisplayPublicIP($server_home['display_public_ip'],$server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip']);
$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
$screen_running = $remote->is_screen_running(OGP_SCREEN_TYPE_HOME,$server_home['home_id']) === 1;
if($screen_running) $servers_running++;
if( ( $online and $screen_running ) OR ( isset( $_GET['home_id-mod_id-ip-port'] )
and $_GET['home_id-mod_id-ip-port'] ==
$server_home['home_id'].'-'.$server_home['mod_id'].'-'.
$server_home['ip'].'-'.$server_home['port'] ) OR ( !$online and $show_all ) )
{
$port = $server_home['port'];
$url = false;
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
if ($server_xml->protocol == "lgsl"){
list($c_port, $q_port, $s_port) = lgsl_port_conversion($server_xml->lgsl_query_name, $port, "", "");
$url = lgsl_software_link($server_xml->lgsl_query_name, $public_ip, $c_port, $q_port, $s_port);
}
else if ($server_xml->protocol == "gameq"){
$query_port = get_query_port($server_xml, $port);
$gq = new \GameQ\GameQ();
$server = array(
'id' => 'server',
'type' => $server_xml->gameq_query_name,
'host' => $public_ip . ":" . $query_port,
);
$gq->addServer($server);
$gq->setOption('timeout', 1);
$gq->setOption('debug', FALSE);
$results = $gq->process();
if(isset($results['gq_joinlink']) and $results['gq_joinlink'] != "")
{
$url = $results['gq_joinlink'];
}
else
{
if($server_xml->installer == "steamcmd")
$url = "steam://connect/$public_ip:$port";
else
$url = "#Notavailable";
}
}
else if ($server_xml->protocol == "teamspeak3"){
$url = "ts3server://$public_ip:$port";
}
if ($cols != 4 && $cols != 1 && $counter == $cols)
{
$side = "left";
}
elseif ($cols != 4 && $cols != 1)
{
$side = "right";
}
else
{
$side = "center";
}
if( isset($_GET['home_id-mod_id-ip-port']) )
{
$side = "center";
}
if( isset($_GET['home_id-mod_id-ip-port']) )
{
$output .= dsi_render_table($server_home["ip"], $server_home["port"], $url, FALSE, TRUE);
}
else
{
$output .= dsi_render_table($server_home["ip"], $server_home["port"], $url, FALSE, FALSE, FALSE, $screen_running, TRUE, $type);
}
if ($counter == $cols)
{
$output .= "\t</tr>\n\t<tr>\n";
$counter = 1;
}
else
{
$counter++;
}
}
}
if( ($online and $servers_running > 0) OR ( !$online and $servers > 0) )
echo "<center>\n".
"<table class='center bloc' >\n".
$output .
"</table>\n".
"</center>\n";
}
?>

View file

@ -1,116 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define("DSI_BASEPATH", "modules/dsi/");
require_once(DSI_BASEPATH . 'includes/functions_ui.php');
require_once('modules/gamemanager/home_handling_functions.php');
require_once('modules/config_games/server_config_parser.php');
require_once('protocol/lgsl/lgsl_protocol.php');
require_once('protocol/GameQ/GameQ.php');
function exec_ogp_module(){
global $db;
echo "<h2>".get_lang("dsi_long")."</h2>";
$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
if ( $isAdmin )
$server_homes = $db->getIpPorts();
else
$server_homes = $db->getIpPortsForUser($_SESSION['user_id']);
if( $server_homes === FALSE )
{
// If there are no games, then there can not be any mods either.
print_failure( no_game_homes_assigned );
if ( $isAdmin )
{
echo "<p><a href='?m=user_games&amp;p=assign&amp;user_id=$_SESSION[user_id]'>".
get_lang('assign_game_homes')."</a></p>";
}
return;
}
echo dsi_select_server;
create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
if( isset($_GET['home_id-mod_id-ip-port']) and $_GET['home_id-mod_id-ip-port'] != "")
{
list( $home_id,
$mod_id,
$ip,
$port) = explode( "-", $_GET['home_id-mod_id-ip-port'] );
if( !is_numeric($home_id) or
!is_numeric($mod_id) or
!preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $ip) or
!is_numeric($port) )
return;
}
else
return;
echo "<br /><br />";
foreach( $server_homes as $server_home )
{
if( $server_home['home_id'] == $home_id and
$server_home['mod_id'] == $mod_id and
$server_home['ip'] == $ip and
$server_home['port'] == $port )
{
$public_ip = checkDisplayPublicIP($server_home['display_public_ip'], $server_home['ip']);
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
$url = false;
if ($server_xml->protocol == "lgsl"){
list($c_port, $q_port, $s_port) = lgsl_port_conversion($server_xml->lgsl_query_name, $server_home['port'], "", "");
$url = lgsl_software_link($server_xml->lgsl_query_name, $public_ip, $c_port, $q_port, $s_port);
}
else if ($server_xml->protocol == "gameq"){
$query_port = get_query_port($server_xml, $server_home['port']);
$gq = new GameQ();
$server = array(
'id' => 'server',
'type' => $server_xml->gameq_query_name,
'host' => $public_ip . ":" . $query_port,
);
$gq->addServer($server);
$gq->setOption('timeout', 1);
$gq->setOption('debug', FALSE);
$results = $gq->requestData();
if(isset($results['gq_joinlink']) and $results['gq_joinlink'] != "")
{
$url = $results['gq_joinlink'];
}
else
{
if($server_xml->installer == "steamcmd")
$url = "steam://connect/$public_ip:$server_home[port]";
else
$url = "#Notavailable";
}
}
else if ($server_xml->protocol == "teamspeak3"){
$url = "ts3server://$public_ip:$server_home[port]";
}
echo dsi_render_table($server_home["ip"], $server_home["port"], $public_ip, $url);
break;
}
}
}
?>

View file

@ -1,511 +0,0 @@
<?php
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* geoip.inc
*
* Copyright (C) 2016 MaxMind LLC
* This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com
*
* 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);
if (!function_exists('geoip_country_code_by_name'))
{
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);
if (!function_exists('geoip_country_code_by_name'))
{
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);
}
if (!function_exists('geoip_country_code_by_name'))
{
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;
}
}
if (!function_exists('geoip_country_name_by_name'))
{
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;
}
?>

View file

@ -1,244 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define("DSI_BASEPATH", "modules/dsi/");
require(DSI_BASEPATH . 'includes/functions_ui.php');
require(DSI_BASEPATH . 'includes/functions.php');
require("modules/gamemanager/home_handling_functions.php");
require('modules/config_games/server_config_parser.php');
function exec_ogp_module(){
global $db,$view,$settings;
if(isset($_GET["s"])){
$s = dsi_cleaninput($_GET["s"]);
//192.168.0.160_27015-sky.png
if (strpos($s, ".png")){ list($s, $extension) = explode(".png", $s, 2); }
//192.168.0.160_27015-sky
if (strpos($s, "-")){ list($s, $img_type) = explode("-", $s, 2); }
//192.168.0.160_27015
if (strpos($s, "_")){ $s = explode("_", $s, 2); }
if(empty($s) || empty($s[0]) || empty($s[1])){ unset($s); }
}
$valid_types = array("normal", "small", "sky");
if (!isset($img_type) || !in_array($img_type, $valid_types)){
$img_type = "normal";
}
if(!$s){ dsi_error_img(false, "No or incomplete server address given!", $img_type); }
/* Cache handler */
$cache = array();
$cache["life"] = 60;
$cache["file"] = DSI_BASEPATH."cache/".$s[0]."_".$s[1]."-".$img_type;
if( file_exists( $cache["file"] ) )
{
$cache["cache_expire"] = filemtime( $cache["file"] ) + $cache["life"];
if( time() >= $cache["cache_expire"])
$do_new = true;
else
$do_new = false;
}
else
$do_new = true;
if($do_new){
$server_home = $db->getGameHomeByIP($s[0], $s[1]);
if(!$server_home){ dsi_error_img("IP: ".$s[0].":".$s[1], "Server does not exist in DB.", $img_type); }
$cfghome = $db->getCfgHomeById($server_home['home_cfg_id']);
$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$cfghome['home_cfg_file']);
$name = "";
$players = "";
$playersmax = "";
$map = "";
if ($server_xml->protocol == "gameq"){
require_once('protocol/GameQ/functions.php');
require_once('protocol/GameQ/GameQMonitor.php');
$query_name = $server_xml->gameq_query_name;
}
else if ($server_xml->protocol == "lgsl"){
require_once('protocol/lgsl/LGSLMonitor.php');
$query_name = $server_xml->lgsl_query_name;
}
else if ($server_xml->protocol == "teamspeak3"){
ini_set('date.timezone', $settings['time_zone']);
require_once('protocol/TeamSpeak3/TS3Monitor.php');
$query_name = 'ts3';
$mod = 'ts3';
}
else {
$query_name = preg_replace("/[^a-z0-9_]/", "-", strtolower($server_xml->mods->mod['key']));
}
if(!isset($mod)){
$mod = preg_replace("/[^a-z0-9_]/", "-", strtolower($server_xml->mods->mod['key']));
}
if (file_exists(DSI_BASEPATH."geoip.inc.php")){
$geoip = false;
require_once DSI_BASEPATH."geoip.inc.php";
$gi = geoip_open( DSI_BASEPATH."GeoIP.dat", GEOIP_STANDARD );
$clookup = geoip_country_code_by_addr($gi, $s[0]);
if (empty($clookup)){ $clookup = geoip_country_code_by_name($gi, $s[0]); }
$clookup = strtolower($clookup);
$cimg = "images/countries/{$clookup}.png";
if (!file_exists($cimg)) { $cimg = "images/countries/noflag.png"; }
$cimage_info = getimagesize($cimg);
$cimage = imagecreatefrompng($cimg);
}
$icon_paths = array("images/icons/$mod.png",
"images/icons/$query_name.png",
"images/countries/noflag.png");
$icoimg = get_first_existing_file($icon_paths);
$icoimage_info = getimagesize($icoimg);
$icoimage = imagecreatefrompng($icoimg);
if($status == "half"){
$status = "offline";
$ip = $s[0];
$port = $s[1];
}
/* Start image */
$path = dsi_get_bg($query_name, $mod, $img_type);
$im = imagecreatefrompng($path);
/* Text formatting */
$text_font0 = DSI_BASEPATH."fonts/Cyberbas.ttf";
$size0 = 10; /* Normal */
$size2 = 9; /* Small */
$size4 = 10; /* Sky */
$text_font1 = DSI_BASEPATH."fonts/Sansation_Regular.ttf";
$size1 = 10; /* Normal */
$size3 = 10; /* Small */
$size5 = 9; /* Sky */
$name_type_vertical = false; /* Display the hostname vertically on sky image */
if (file_exists(DSI_BASEPATH."images/color_settings.php")){
require_once(DSI_BASEPATH."images/color_settings.php");
}
if($status == "offline")
{
$text_color0 = ImageColorAllocate($im,125,125,125);
$text_color1 = ImageColorAllocate($im,125,125,125);
}
else
{
$text_color0 = ImageColorAllocate($im,0,255,0);
$text_color1 = ImageColorAllocate($im,0,255,0);
}
if ( ! isset( $txt_outline ) ){
switch($img_type){
case "normal":
$txt_outline = true;
break;
case "small":
$txt_outline = true;
break;
case "sky":
$txt_outline = true;
break;
}
}
$ip = checkDisplayPublicIP($server_home['display_public_ip'],$server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip']);
/* Render types */
switch($img_type){
case "normal":
if($geoip){ imagecopyresampled($im, $cimage, 205, 35, 0, 0, 16, 11, $cimage_info[0], $cimage_info[1]); } // Country
imagecopyresampled($im, $icoimage, 5, 5, 0, 0, 16, 16, $icoimage_info[0], $icoimage_info[1]); // Gameicon
pretty_text_ttf($im,$size0,0,25,18,$text_color0,$text_font0,substr($name,0,47), $txt_outline); // Servername
pretty_text_ttf($im,$size1,0,65,45,$text_color0,$text_font1,$ip.":".$port, $txt_outline); // IP:PORT
pretty_text_ttf($im,$size1,0,65,63,$text_color0,$text_font1,$map, $txt_outline); // Map
pretty_text_ttf($im,$size1,0,292,45,$text_color0,$text_font1,$players."/".$playersmax, $txt_outline); // Players
pretty_text_ttf($im,$size1,0,293,63,$text_color0,$text_font1,$status, $txt_outline); // Status
break;
case "small":
if($geoip){ imagecopyresampled($im, $cimage, 315, 1, 0, 0, 16, 11, $cimage_info[0], $cimage_info[1]); } // Country
imagecopyresampled($im, $icoimage, 0, 0, 0, 0, 16, 16, $icoimage_info[0], $icoimage_info[1]); // Gameicon
pretty_text_ttf($im,$size2,0,18,10,$text_color0,$text_font0,substr($name,0,45), $txt_outline); // Servername
pretty_text_ttf($im,$size3,0,2,24,$text_color0,$text_font1,$ip.":".$port, $txt_outline); // IP:Port
pretty_text_ttf($im,$size3,0,135,24,$text_color0,$text_font1,$map, $txt_outline); // Map
pretty_text_ttf($im,$size3,0,240,24,$text_color0,$text_font1,$players."/".$playersmax, $txt_outline); // Players
pretty_text_ttf($im,$size3,0,295,24,$text_color0,$text_font1,$status, $txt_outline); // Status
break;
case "sky":
if($status != "offline"){
$mapFile = get_map_path($query_name, $mod, $map);
if(cURLEnabled()){
$img_map = curlCacheImage(DSI_BASEPATH, $mapFile);
}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'
)
)
);
$img_map = $mapFile;
}
}
else { $img_map = DSI_BASEPATH."images/offline_bg.png"; }
$im_map_info = getimagesize($img_map);
if ($im_map_info[2] == 1) { $im_map = imagecreatefromgif($img_map); }
if ($im_map_info[2] == 2) { $im_map = imagecreatefromjpeg($img_map); }
if ($im_map_info[2] == 3) { $im_map = imagecreatefrompng($img_map); }
$im_map_width = 130;
$im_map_height = 120;
$im_map_posx = 25;
$im_map_posy = 120;
$im_icon_width = 16;
$im_icon_height = 16;
$im_icon_posx = 26;
$im_icon_posy = 113;
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
imagecopyresampled($im, $icoimage, $im_icon_posx, $im_icon_posy, 0, 0, $im_icon_width, $im_icon_height, $icoimage_info[0], $icoimage_info[1]); // Gameicon
if($geoip){ imagecopyresampled($im, $cimage, $im_icon_posx + 112, $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($name,0,28), $txt_outline); } // Servername Vertical
else{ pretty_text_ttf($im,$size4,0,5,15,$text_color1,$text_font0,substr($name,0,23), $txt_outline); } // Servername
pretty_text_ttf($im,$size5,0,20,30,$text_color1,$text_font1,"IP:Port: ".$ip.":".$port, $txt_outline); // IP:Port
pretty_text_ttf($im,$size5,0,20,52,$text_color1,$text_font1,"Map : ".substr($map,0,19), $txt_outline); // Map
pretty_text_ttf($im,$size5,0,20,74,$text_color1,$text_font1,"Players: ".$players."/".$playersmax, $txt_outline); // Players
pretty_text_ttf($im,$size5,0,20,96,$text_color1,$text_font1,"Status : ".substr($status,0,19), $txt_outline); // Status
break;
}
dsi_make_img($im, false, $cache);
}
else{
dsi_make_img(false, true, $cache, true);
}
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,104 +0,0 @@
<?php
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* 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 (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/
class SimpleImage {
var $image;
var $image_type;
function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info['mime'];
if( $this->image_type == "image/jpeg" ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == "image/gif" ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == "image/png" ) {
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type=IMAGETYPE_PNG, $compression=75, $permissions=null) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image,$filename);
}
if( $permissions != null) {
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image);
}
}
function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}
function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width,$height);
}
function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width,$height);
}
function scale($scale) {
$width = $this->getWidth() * $scale/100;
$height = $this->getheight() * $scale/100;
$this->resize($width,$height);
}
function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
}
?>

View file

@ -1,135 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* Workaround for OGP function not included due to "echo". Needed by protocols *Monitor.php */
function print_player_list(){
return false;
}
/* DSi functions */
function dsi_cleaninput($input){
/* Some rules might be paranoid */
$remove = array("#\\\\+#", "#/+#", "#\\+#", "#\s+#", "#http+#", "#ftp+#", "#%00+#", "#\\0+#", "#\\x00+#", "#\(+#", "#\)+#", "#\{+#", "#\}+#");
$input = preg_replace($remove, "", $input);
$input = htmlspecialchars($input, ENT_QUOTES);
return $input;
}
function dsi_error_img($msg0 = false, $msg1 = false, $type = false){
if(empty($type)) { $type = "normal"; }
$bgimg = DSI_BASEPATH."images/default_".$type.".png";
$im = imagecreatefrompng($bgimg);
$text_color = ImageColorAllocate($im,255,0,0);
switch($type){
case "normal":
imagestring($im,6,2,5,"ERROR! ".$msg0,$text_color);
imagestring($im,5,2,20,$msg1,$text_color);
break;
case "small":
imagestring($im,6,2,0,"ERROR! ".$msg0,$text_color);
imagestring($im,5,2,10,$msg1,$text_color);
break;
case "sky":
$img_map = DSI_BASEPATH."images/offline_bg.png";
$im_map_info = getimagesize($img_map);
$im_map = imagecreatefrompng($img_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! ".$msg0,$text_color);
imagestring($im,1,6,45,$msg1,$text_color);
break;
}
dsi_make_img($im);
}
function dsi_make_img($im = false, $cache_on = false, $cache_data = false){
header("Content-type: image/png");
if($cache_on){
$expire = gmdate("D, d M Y H:i:s", $cache_data["cache_expire"])." GMT";
header("Expires: ".$expire);
readfile($cache_data["file"]);
}
else
{
imagepng($im, $cache_data["file"], 9);
readfile($cache_data["file"]);
}
imagedestroy($im);
exit;
}
function dsi_get_bg($query_name, $mod, $type){
$img = DSI_BASEPATH."images/".$query_name."/".$mod."_".$type.".png";
if(file_exists($img)){
return $img;
}
else{ return DSI_BASEPATH."images/default_".$type.".png"; }
}
function pretty_text($im, $fontsize, $x, $y, $string, $color, $outline = false) {
$black = imagecolorallocate($im, 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($im, 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;
}
?>

View file

@ -1,70 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* DSi functions */
function dsi_render_table($ip, $port, $url = false, $use_table = TRUE, $use_rows = TRUE, $show_codes = TRUE, $img_join_link = FALSE, $img_only = FALSE, $img_type = FALSE ){
$link = false;
$s = ( isset($_SERVER['HTTPS']) and get_true_boolean($_SERVER['HTTPS']) ) ? "s" : "";
$base_url = "http$s://".implode('/', (explode('/', $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], -1)));
if($url){
$link["bb_close"] = "[/url]";
$link["bb_type_a"] = "[url=".$url."]";
$link["bb_type_b"] = "[url=\"".$url."\"]";
$link["href"] = "<a href=\"".$url."\">";
$link["href_close"] = "</a>";
}
$types = array("normal", "small", "sky");
if($img_type)
$types = array($img_type);
$output = "";
if($use_table) $output .= "\n<table class='center' >\n";
$image_td_align = $img_only ? "center" : "left";
foreach($types as $type)
{
if($use_rows) $output .= "\t<tr>\n";
if(!$img_only) $output .= "\t\t<td align='right' width=30px >\n".
"\t\t\t<b>Banner $type</b>\n".
"\t\t</td>\n";
$output .= "\t\t<td align='$image_td_align' >\n";
if($img_join_link) $output .= "\t\t\t{$link['href']}\n";
$output .= "\t\t\t<img src='" . DSI_BASEPATH . "s-${ip}_${port}-${type}.png'/>\n";
if($img_join_link) $output .= "\t\t\t{$link['href_close']}\n";
$output .= "\t\t</td>\n";
if($show_codes)
$output .= "\t</tr>\n".
"\t<tr>\n".
"\t\t<td align='right' width=30px >\n".
"\t\t\t<b>Codes</b>".
"\t\t</td>\n".
"\t\t<td align='left' ><input type='text' readonly='readonly' style='width:100%;' onclick='select()' value='".$link["bb_type_a"]."[img]$base_url/" . DSI_BASEPATH . "s-${ip}_${port}-${type}.png[/img]".$link["bb_close"]."' /><br />\n".
"\t\t\t<input type='text' readonly='readonly' style='width:100%;' onclick='select()' value='".$link["bb_type_b"]."[img]$base_url/" . DSI_BASEPATH . "s-${ip}_${port}-${type}.png[/img]".$link["bb_close"]."' /><br />\n".
"\t\t\t<input type='text' readonly='readonly' style='width:100%;' onclick='select()' value='".$link["href"]."<img src=\"$base_url/" . DSI_BASEPATH . "s-${ip}_${port}-${type}.png\">".$link["href_close"]."' />\n".
"\t\t</td>\n";
if($use_rows) $output .= "\t</tr>\n";
}
if($use_table) $output .= "</table>\n";
return $output;
}
?>

View file

@ -1,31 +0,0 @@
<?php
/*
* Dynamic Server Image module for Open Game Panel
* Copyright (C) 2012 SpiffyTek
*
* http://spiffytek.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Module general information
$module_title = "Dynamic Server Image";
$module_version = "1.0.3";
$db_version = 0;
$module_required = false;
$module_menus = array(
array( 'subpage' => 'admin_dsi', 'name'=>'DSi Settings', 'group'=>'admin' )
);
?>

View file

@ -1,31 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 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_buttons = array(
"<a class='monitorbutton' href='?m=dsi&p=user_dsi&home_id-mod_id-ip-port=".$server_home['home_id']."-".$server_home['mod_id']."-".$server_home['ip']."-".$server_home['port']."'>
<img src='" . check_theme_image("images/dsi.png") . "' title='DSi'>
<span>DSi</span>
</a>"
);
?>

View file

@ -1,5 +0,0 @@
<navigation>
<page key="user_dsi" file="dsi_user.php" access="admin,user" />
<page key="admin_dsi" file="dsi_admin.php" access="admin" />
<page key="image" file="image.php" access="admin,user,guest" />
</navigation>