Ver código fonte

Respect NAT Setting Only for Querying

own3mall 7 anos atrás
pai
commit
bdca11a21a

+ 7 - 7
includes/database_mysqli.php

@@ -1625,14 +1625,14 @@ class OGPDatabaseMySQL extends OGPDatabase
 					}
 					}
 				}
 				}
 			}
 			}
-			return adjustServerHomeIPDependingOnNATSetting($servers);
+			return $servers;
 		}
 		}
 		else
 		else
 		{
 		{
 			$query = sprintf($template,
 			$query = sprintf($template,
 				$this->table_prefix,
 				$this->table_prefix,
 				$this->realEscapeSingle($assign_id) );
 				$this->realEscapeSingle($assign_id) );
-			return adjustServerHomeIPDependingOnNATSetting($this->listQuery($query));
+			return $this->listQuery($query);
 		}
 		}
 	}
 	}
 	
 	
@@ -2002,14 +2002,14 @@ class OGPDatabaseMySQL extends OGPDatabase
 					}
 					}
 				}
 				}
 			}
 			}
-			return adjustServerHomeIPDependingOnNATSetting($servers);
+			return $servers;
 		}
 		}
 		else
 		else
 		{
 		{
 			$query = sprintf($template,
 			$query = sprintf($template,
 				$this->table_prefix,
 				$this->table_prefix,
 				$assign_id);
 				$assign_id);
-			return adjustServerHomeIPDependingOnNATSetting($this->listQuery($query));
+			return $this->listQuery($query);
 		}
 		}
 	}
 	}
 
 
@@ -2150,7 +2150,7 @@ class OGPDatabaseMySQL extends OGPDatabase
 			$this->table_prefix,
 			$this->table_prefix,
 			$this->realEscapeSingle($user_id) );
 			$this->realEscapeSingle($user_id) );
 							
 							
-		return adjustServerHomeIPDependingOnNATSetting($this->listQuery($query));
+		return $this->listQuery($query);
 	}
 	}
 	
 	
 	public function getIpPorts( $ip_id = 0 ) {
 	public function getIpPorts( $ip_id = 0 ) {
@@ -2210,7 +2210,7 @@ class OGPDatabaseMySQL extends OGPDatabase
 			) ORDER BY %1$shome_ip_ports.home_id ASC LIMIT '.$user_request_page.','.$limit_dashboardlist.';',
 			) ORDER BY %1$shome_ip_ports.home_id ASC LIMIT '.$user_request_page.','.$limit_dashboardlist.';',
 			$this->table_prefix );
 			$this->table_prefix );
 
 
-		return adjustServerHomeIPDependingOnNATSetting($this->listQuery($query));
+		return $this->listQuery($query);
 	}
 	}
 	
 	
 
 
@@ -3037,7 +3037,7 @@ class OGPDatabaseMySQL extends OGPDatabase
 		$query = sprintf('SELECT %1$sserver_homes.*,%1$sremote_servers.*, %1$sconfig_homes.*
 		$query = sprintf('SELECT %1$sserver_homes.*,%1$sremote_servers.*, %1$sconfig_homes.*
 			FROM `%1$sserver_homes` NATURAL JOIN `%1$sconfig_homes` NATURAL JOIN `%1$sremote_servers`;',
 			FROM `%1$sserver_homes` NATURAL JOIN `%1$sconfig_homes` NATURAL JOIN `%1$sremote_servers`;',
 			$this->table_prefix);
 			$this->table_prefix);
-		return adjustServerHomeIPDependingOnNATSetting($this->listQuery($query));
+		return $this->listQuery($query);
 	}
 	}
 	
 	
 	public function getGameHomes_limit($page_gameHomes, $limit_gameHomes, $searchType, $searchString) {
 	public function getGameHomes_limit($page_gameHomes, $limit_gameHomes, $searchType, $searchString) {

+ 0 - 24
includes/functions.php

@@ -896,28 +896,4 @@ function updateAllPanelModules(){
 		}
 		}
 	}
 	}
 }
 }
-
-function adjustServerHomeIPDependingOnNATSetting($homes){ // Can adjust one server_home or many server_homes
-	$finalHomes = $homes;
-	
-	if(is_array($homes)){
-		if(!is_array($homes[0]) && array_key_exists("ip", $homes)){
-			$homes = array($homes);
-		}
-	}
-	
-	if(is_array($homes) && is_array($homes[0]) && array_key_exists("ip", $homes[0])){
-		$finalHomes = array();
-		foreach($homes as $home){
-			if ($home['use_nat'] == 1){
-				$home['ip'] = $home['agent_ip'];
-			}else{
-				$home['ip'] = $home['ip'] != $home['agent_ip'] ? $home['ip'] : $home['agent_ip'];
-			}
-			$finalHomes[] = $home;
-		}
-	}
-	
-	return $finalHomes;
-}
 ?>
 ?>

+ 4 - 3
lang/English/modules/server.php

@@ -69,7 +69,7 @@ define('OGP_LANG_remote_server_settings_changed', "Changed settings for remote s
 define('OGP_LANG_save_settings', "Save Settings");
 define('OGP_LANG_save_settings', "Save Settings");
 define('OGP_LANG_set_ips', "Set IPs");
 define('OGP_LANG_set_ips', "Set IPs");
 define('OGP_LANG_remote_ip', "Remote IP");
 define('OGP_LANG_remote_ip', "Remote IP");
-define('OGP_LANG_remote_ips_for', "Remote IPs for server called '%s'");
+define('OGP_LANG_remote_ips_for', "IPs for Game Servers To Use on Agent Server '%s'");
 define('OGP_LANG_ips_set_for_server', "IPs set for server called '%s' successfully.");
 define('OGP_LANG_ips_set_for_server', "IPs set for server called '%s' successfully.");
 define('OGP_LANG_could_not_remove_ip', "Could not remove old IP's from database.");
 define('OGP_LANG_could_not_remove_ip', "Could not remove old IP's from database.");
 define('OGP_LANG_could_add_ip', "Could add remote server IP to database.");
 define('OGP_LANG_could_add_ip', "Could add remote server IP to database.");
@@ -96,7 +96,7 @@ define('OGP_LANG_failed_add_ip', "Failed to add IP");
 define('OGP_LANG_timeout', "Time Out");
 define('OGP_LANG_timeout', "Time Out");
 define('OGP_LANG_timeout_info', "The time limit in seconds to get response from this Agent.");
 define('OGP_LANG_timeout_info', "The time limit in seconds to get response from this Agent.");
 define('OGP_LANG_use_nat', "Use NAT");
 define('OGP_LANG_use_nat', "Use NAT");
-define('OGP_LANG_use_nat_info', "Activate if your remote server is using NAT rules.");
+define('OGP_LANG_use_nat_info', "Enable if your remote server is using NAT rules. Use this setting if your game servers are running on internal private LAN IP addresses so that the panel will use your real remote IP address to query the game servers.");
 define('OGP_LANG_arrange_ports', "Arrange ports");
 define('OGP_LANG_arrange_ports', "Arrange ports");
 define('OGP_LANG_assign_new_ports_range_for_ip', "Assign new ports range for IP %s");
 define('OGP_LANG_assign_new_ports_range_for_ip', "Assign new ports range for IP %s");
 define('OGP_LANG_assigned_port_ranges_for_ip', "Assigned port ranges for IP %s");
 define('OGP_LANG_assigned_port_ranges_for_ip', "Assigned port ranges for IP %s");
@@ -135,4 +135,5 @@ define('OGP_LANG_save_firewall_settings', "Save firewall settings");
 define('OGP_LANG_reset_firewall', "Reset Firewall");
 define('OGP_LANG_reset_firewall', "Reset Firewall");
 define('OGP_LANG_firewall_settings', "Firewall Settings");
 define('OGP_LANG_firewall_settings', "Firewall Settings");
 define('OGP_LANG_display_public_ip', "Display Public IP");
 define('OGP_LANG_display_public_ip', "Display Public IP");
-?>
+define('OGP_LANG_ips_can_be_internal_external', "Enter usable IP addresses.  Public IP addresses and internal LAN IP addresses (for NAT setups) can be used.");
+?>

+ 2 - 5
modules/dashboard/dashboard.php

@@ -140,11 +140,8 @@ function exec_ogp_module()
 				{
 				{
 					require_once("modules/config_games/server_config_parser.php");
 					require_once("modules/config_games/server_config_parser.php");
 					$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
 					$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
-					if ( $server_home['use_nat'] == 1 ){
-						$ip = $server_home['agent_ip'];
-					}else{
-						$ip = $server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip'];
-					}
+					
+					$ip = $server_home['ip'];
 					$ip = checkDisplayPublicIP($server_home['display_public_ip'],$ip);
 					$ip = checkDisplayPublicIP($server_home['display_public_ip'],$ip);
 
 
 					$port = $server_home['port'];
 					$port = $server_home['port'];

+ 2 - 5
modules/dashboard/query_ref.php

@@ -63,10 +63,7 @@ function exec_ogp_module()
 	$mod = "";
 	$mod = "";
 	$stats_players = 0;
 	$stats_players = 0;
 	$stats_maxplayers = 0;
 	$stats_maxplayers = 0;
-	if ( $server_home['use_nat'] == 1 )
-		$ip = $server_home['agent_ip'];
-	else
-		$ip = $server_home['ip'];
+	$ip = $server_home['ip'];
 	$port = $server_home['port'];
 	$port = $server_home['port'];
 	// Check if the screen running the server is running.
 	// Check if the screen running the server is running.
 	if ($server_xml->protocol == "gameq")
 	if ($server_xml->protocol == "gameq")
@@ -139,7 +136,7 @@ function exec_ogp_module()
 			 $server_home['port'] . "' ><img style='border:0;height:12px;' src='images/magnifglass.png'/>" . 
 			 $server_home['port'] . "' ><img style='border:0;height:12px;' src='images/magnifglass.png'/>" . 
 			 htmlentities($server_home['home_name']) . "</a></div>".
 			 htmlentities($server_home['home_name']) . "</a></div>".
 			 "<div><div style='font-size:8pt;' ></div> </div>".
 			 "<div><div style='font-size:8pt;' ></div> </div>".
-			 "<div id='gamelink' >$ip:$port</div>";
+			 "<div id='gamelink' >" . $server_home['ip'] . ":$port</div>";
 		if(isset($_SESSION[$server_key]['online_players']))
 		if(isset($_SESSION[$server_key]['online_players']))
 			unset($_SESSION[$server_key]['online_players']);
 			unset($_SESSION[$server_key]['online_players']);
 	}
 	}

+ 1 - 1
modules/gamemanager/mini_start.php

@@ -297,7 +297,7 @@ elseif($server_home['home_id'] == $_POST['home_id'])
 	$ip_port = $_POST['ip_port'];
 	$ip_port = $_POST['ip_port'];
 	list($ip, $port) = explode(":", $ip_port);
 	list($ip, $port) = explode(":", $ip_port);
 	
 	
-	if(($server_home['ip'] == $ip || ($ip == $server_home['agent_ip'] && $server_home['use_nat'] == 1)) && $server_home['port'] == $port) 
+	if($server_home['ip'] == $ip && $server_home['port'] == $port) 
 	{
 	{
 		$cli_param_data['IP'] = $ip;
 		$cli_param_data['IP'] = $ip;
 		$cli_param_data['PORT'] = $server_home['port'];
 		$cli_param_data['PORT'] = $server_home['port'];

+ 2 - 6
modules/gamemanager/server_monitor.php

@@ -296,7 +296,7 @@ function exec_ogp_module() {
 		
 		
 		if( $show_all 
 		if( $show_all 
 			OR ( isset( $_GET['home_id'] ) and $_GET['home_id'] == $server_home['home_id'] ) 
 			OR ( isset( $_GET['home_id'] ) and $_GET['home_id'] == $server_home['home_id'] ) 
-			OR ( isset( $_GET['home_id-mod_id-ip-port'] ) and $server_home['home_id'] == $post_home_id and $server_home['mod_id'] == $post_mod_id and ($post_ip == $server_home['ip'] || ($post_ip == $server_home['agent_ip'] && $server_home['use_nat'] == 1)) and $post_port == $server_home['port'] ) 
+			OR ( isset( $_GET['home_id-mod_id-ip-port'] ) and $server_home['home_id'] == $post_home_id and $server_home['mod_id'] == $post_mod_id and $post_ip == $server_home['ip'] and $post_port == $server_home['port'] ) 
 			OR ( isset( $_GET['home_cfg_id'] ) and $_GET['home_cfg_id'] == $server_home['home_cfg_id'] ) 
 			OR ( isset( $_GET['home_cfg_id'] ) and $_GET['home_cfg_id'] == $server_home['home_cfg_id'] ) 
 		  )
 		  )
 		{
 		{
@@ -405,11 +405,7 @@ function exec_ogp_module() {
 
 
 			if( $host_stat === 1)
 			if( $host_stat === 1)
 			{
 			{
-				if($server_home['use_nat'] == 1 ){
-					$ip = $server_home['agent_ip'];
-				}else{
-					$ip = $server_home['ip'] != $server_home['agent_ip'] ? $server_home['ip'] : $server_home['agent_ip'];
-				}
+				$ip = $server_home['ip'];
 				$query_ip = checkDisplayPublicIP($server_home['display_public_ip'],$ip);
 				$query_ip = checkDisplayPublicIP($server_home['display_public_ip'],$ip);
 				$address = $query_ip . ":" . $server_home['port'];
 				$address = $query_ip . ":" . $server_home['port'];
 
 

+ 1 - 1
modules/gamemanager/start_server.php

@@ -76,7 +76,7 @@ function exec_ogp_module()
 
 
 	{
 	{
 	
 	
-		if(($ip_ports_row['ip'] == $_REQUEST['ip'] || ($_REQUEST['ip'] == $ip_ports_row['agent_ip'] && $ip_ports_row['use_nat'] == 1)) && $ip_ports_row['port'] == $_REQUEST['port']) 
+		if($ip_ports_row['ip'] == $_REQUEST['ip'] && $ip_ports_row['port'] == $_REQUEST['port']) 
 		
 		
 		{
 		{
 		
 		

+ 1 - 0
modules/server/edit_server.php

@@ -150,6 +150,7 @@ function exec_ogp_module() {
 
 
         echo "<h2>".get_lang_f('remote_ips_for',$remote_server['remote_server_name'])."</h2>";
         echo "<h2>".get_lang_f('remote_ips_for',$remote_server['remote_server_name'])."</h2>";
         echo "<p class='info'>". get_lang("hint") .": ". get_lang("add_more_ips") ."</p>";
         echo "<p class='info'>". get_lang("hint") .": ". get_lang("add_more_ips") ."</p>";
+        echo "<p class='info'>" . get_lang("ips_can_be_internal_external") . "</p>";
 		
 		
         $remote_server_ips = $db->getRemoteServerIPs($remote_server['remote_server_id']);
         $remote_server_ips = $db->getRemoteServerIPs($remote_server['remote_server_id']);
         if ( !empty($remote_server_ips) )
         if ( !empty($remote_server_ips) )