own3mall 5 лет назад
Родитель
Сommit
3ff4272038

+ 11 - 3
modules/TS3Admin/ts3webinterface.class.php

@@ -638,7 +638,11 @@ class TS3webinterface
 				}
 
 				$getPublicIp = $db->resultQuery("SELECT display_public_ip FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id=".$_SESSION['rserver_id']);
-				$display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
+				if($getPublicIp){
+					$display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
+				}else{
+					$display_ip = $this->serverIP;
+				}
 
 				$this->template->assign('IP', $this->serverIP);
 				$this->template->assign('display_public_ip', $display_ip);
@@ -832,7 +836,11 @@ class TS3webinterface
 					$this->template->assign('subusers_installed', $subusers_installed);
 
 					$getPublicIp = $db->resultQuery("SELECT display_public_ip FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id=".$_SESSION['rserver_id']);
-					$display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
+					if($getPublicIp){
+						$display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
+					}else{
+						$display_ip = $this->serverIP;
+					}
 
 					$this->template->assign('display_public_ip', $display_ip);
 
@@ -1228,4 +1236,4 @@ class TS3webinterface
 		return '';
 	}
 }
-?>
+?>

+ 8 - 6
modules/addonsmanager/addons_installer.php

@@ -261,11 +261,13 @@ function exec_ogp_module() {
 			<select name="addon_id">
 			<?php
 			$addons = $db->resultQuery("SELECT addon_id, name FROM OGP_DB_PREFIXaddons WHERE addon_type='".$addon_type."' AND home_cfg_id=" . $home_cfg_id . $query_groups . " ORDER BY name ASC");
-			foreach($addons as $addon) 
-			{
-			?>
-			<option value="<?php echo $addon['addon_id']; ?>"><?php echo $addon['name']; ?></option>
-			<?php 
+			if($addons){
+				foreach($addons as $addon) 
+				{
+				?>
+				<option value="<?php echo $addon['addon_id']; ?>"><?php echo $addon['name']; ?></option>
+				<?php 
+				}
 			}
 			?>
 			</select>
@@ -290,4 +292,4 @@ function exec_ogp_module() {
 <?php 
     }
 }
-?>
+?>

+ 3 - 3
modules/addonsmanager/addons_manager.php

@@ -73,7 +73,7 @@ function exec_ogp_module() {
 	if (isset($_POST['addon_id']) && (int)$_POST['addon_id'] > 0 && isset($_POST['edit']))
 	{
 		$addons_rows = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXaddons WHERE addon_id=".(int)$_POST['addon_id']);
-		$addon_info = $addons_rows[0];
+		$addon_info = $addons_rows ? $addons_rows[0] : array();
 		$name = isset($addon_info['name']) ? $addon_info['name'] : "";
 		$url = isset($addon_info['url']) ? $addon_info['url'] : "";
 		$path = isset($addon_info['path']) ? $addon_info['path'] : "";
@@ -346,7 +346,7 @@ function exec_ogp_module() {
 	foreach($groups as $group)
 		$group_names[$group['group_id']] = $group['group_name'];
 	
-	if (isset($result) and $result > 0)
+	if (isset($result) && $result && count($result) > 0)
 	{
 		foreach($result as $row)
 		{
@@ -376,4 +376,4 @@ function exec_ogp_module() {
 	</table>
 	<?php
 }
-?>
+?>

+ 3 - 3
modules/addonsmanager/monitor_buttons.php

@@ -32,8 +32,8 @@ if($_SESSION['users_role'] != "admin")
 	$query_groups .= "group_id=0 OR group_id IS NULL)";
 }
 $addons = $db->resultQuery("SELECT addon_id FROM OGP_DB_PREFIXaddons WHERE home_cfg_id=".$server_home['home_cfg_id'].$query_groups);
-$addons_qty = count($addons);
-if($addons and $addons_qty >= 1){
+$addons_qty = $addons ? count($addons) : 0;
+if($addons && $addons_qty >= 1){
 	$module_buttons = array(
 		"<a class='monitorbutton' href='?m=addonsmanager&amp;p=user_addons&amp;home_id=".
 			$server_home['home_id']."&amp;mod_id=".$server_home['mod_id'].
@@ -45,4 +45,4 @@ if($addons and $addons_qty >= 1){
 }
 else
 	$module_buttons = array();
-?>
+?>

+ 3 - 3
modules/addonsmanager/user_addons.php

@@ -54,7 +54,7 @@ function exec_ogp_module() {
 									"NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
 									"WHERE addon_type='plugin' ".
 									"AND home_cfg_id=".$home_cfg_id.$query_groups);
-		$plugins_qty = count($plugins);
+		$plugins_qty = $plugins ? count($plugins) : 0;
 		if($plugins and $plugins_qty >= 1)
 			echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
 				 "&amp;mod_id=".$mod_id."&amp;addon_type=plugin&amp;ip=".$ip.
@@ -65,7 +65,7 @@ function exec_ogp_module() {
 									 "NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
 									 "WHERE addon_type='mappack' ".
 									 "AND home_cfg_id=".$home_cfg_id.$query_groups);
-		$mappacks_qty = count($mappacks);
+		$mappacks_qty = $mappacks ? count($mappacks) : 0;
 		if($mappacks and $mappacks_qty >= 1){
 			echo "</td><td>";
 			echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
@@ -77,7 +77,7 @@ function exec_ogp_module() {
 									"NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
 									"WHERE addon_type='config' ".
 									"AND home_cfg_id=".$home_cfg_id.$query_groups);
-		$configs_qty = count($configs);
+		$configs_qty = $configs ? count($configs) : 0;
 		if($configs and $configs_qty >= 1){
 			echo "</td><td>";
 			echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.

+ 3 - 2
modules/update/blacklist.php

@@ -88,9 +88,10 @@ function exec_ogp_module()
 		
 		foreach($_POST['folder_files'] as $file)
 		{
-			if(is_array($current_blacklist) && in_array($file,$current_blacklist))
+			if(in_array($file,$current_blacklist))
 			{
-				if(is_array($_POST['blacklist']) && !in_array($file,$_POST['blacklist']))
+				$blacklisted = isset( $_POST['blacklist'] ) ? $_POST['blacklist'] : array();
+				if(!in_array($file,$blacklisted))
 				{
 					$file = $db->real_escape_string($file);
 					$db->query("DELETE FROM `OGP_DB_PREFIXupdate_blacklist` WHERE file_path='$file';");

+ 18 - 16
modules/user_games/edit_home.php

@@ -757,7 +757,7 @@ function exec_ogp_module()
 	if ( $isAdmin )
 	{
 		$master_server_home_id = $db->getMasterServer( $home_info['remote_server_id'], $home_info['home_cfg_id'] );
-		$expiration_date = !empty($home_info['server_expiration_date']) ? date( "d/m/Y H:i:s", $home_info['server_expiration_date'] ) : '';
+		$expiration_date = !empty($home_info['server_expiration_date']) && $home_info['server_expiration_date'] != 'X' ? date( "d/m/Y H:i:s", $home_info['server_expiration_date'] ) : '';
 		
 		if( $master_server_home_id != FALSE AND $master_server_home_id == $home_id )
 			$checked = 'checked ="checked"';
@@ -801,24 +801,26 @@ function exec_ogp_module()
 				{
 					$ip_id = $db->real_escape_string($_POST['ip']);
 					$ip_row = $db->resultQuery( "SELECT ip FROM OGP_DB_PREFIXremote_server_ips WHERE ip_id=".$ip_id );
-					$ip = $ip_row['0']['ip'];
-					$port = $_POST['port'];
-					$port = (int)(trim($port));
-					$home_id = $_POST['home_id'];
+					if($ip_row !== false){
+						$ip = $ip_row['0']['ip'];
+						$port = $_POST['port'];
+						$port = (int)(trim($port));
+						$home_id = $_POST['home_id'];
 
-					if ( !isPortValid($port) ) 
-					{
-						print_failure( get_lang("port_range_error") );
-					}
-					else
-					{
-						if ( $db->addGameIpPort($home_id, $ip_id, $port) === FALSE )
+						if ( !isPortValid($port) ) 
 						{
-							print_failure(get_lang_f('ip_port_already_in_use', $ip, $port));
+							print_failure( get_lang("port_range_error") );
 						}
-						else {
-							print_success(get_lang_f('successfully_assigned_ip_port_to_server_id', $ip, $port, $home_id));
-							$db->logger(get_lang_f('successfully_assigned_ip_port_to_server_id', $ip, $port, $home_id));
+						else
+						{
+							if ( $db->addGameIpPort($home_id, $ip_id, $port) === FALSE )
+							{
+								print_failure(get_lang_f('ip_port_already_in_use', $ip, $port));
+							}
+							else {
+								print_success(get_lang_f('successfully_assigned_ip_port_to_server_id', $ip, $port, $home_id));
+								$db->logger(get_lang_f('successfully_assigned_ip_port_to_server_id', $ip, $port, $home_id));
+							}
 						}
 					}
 				}

+ 2 - 2
ogp_api.php

@@ -113,7 +113,7 @@ if(function_exists($function))
 			$token = $_POST['token'];
 			$query = "SELECT user_id FROM ".API_TABLE." WHERE `token` = '".$db->real_escape_string($token)."';";
 			$result = $db->resultQuery($query);
-			if(isset($result[0]['user_id']))
+			if($result && isset($result[0]['user_id']))
 			{
 				$user_info = $db->getUserById($result[0]['user_id']);
 				if(isset($user_info['users_login']))
@@ -200,7 +200,7 @@ function api_token()
 		$token = isset($request[1])?$request[1]:$_POST['token'];
 		$query = "SELECT user_id FROM ".API_TABLE." WHERE `token` = '".$db->real_escape_string($token)."';";
 		$result = $db->resultQuery($query);
-		if(isset($result[0]['user_id']))
+		if($result && isset($result[0]['user_id']))
 		{
 			$user_info = $db->getUserById($result[0]['user_id']);
 			if(isset($user_info['users_login']))

+ 2 - 2
protocol/TeamSpeak3/functions.php

@@ -175,7 +175,7 @@ try
 									</form></td></tr>";
 
 			$ts3vservers = $db->resultQuery("SELECT * FROM OGP_DB_PREFIXts3_homes WHERE vserver_id='".$ts3_ServerInstance->getId()."' AND rserver_id=".$server_home['remote_server_id'] );
-			if($ts3vservers != 0)
+			if($ts3vservers)
 			{
 				$ts3vuserlist = "<b>TeamSpeak 3</b><br>";
 				foreach($ts3vservers as $ts3vserver)
@@ -218,4 +218,4 @@ catch(Exception $e)
 	$status = "half";
 	$order=2;
 }
-?>
+?>