Browse Source

Fix for https://www.opengamepanel.org/forum/viewthread.php?thread_id=7362

own3mall 6 years ago
parent
commit
0c2a7611f8
2 changed files with 9 additions and 4 deletions
  1. 1 1
      includes/database_mysqli.php
  2. 8 3
      modules/gamemanager/home_handling_functions.php

+ 1 - 1
includes/database_mysqli.php

@@ -3792,7 +3792,7 @@ class OGPDatabaseMySQL extends OGPDatabase
 									{
 										require_once("modules/gamemanager/home_handling_functions.php");
 										require_once("modules/config_games/server_config_parser.php");
-										exec_operation('stop', $home_id, FALSE, $address['ip'], $address['port']);
+										exec_operation('stop', $home_id, FALSE, $address['ip'], $address['port'], true);
 									}
 								}
 							}

+ 8 - 3
modules/gamemanager/home_handling_functions.php

@@ -208,7 +208,7 @@ function get_start_cmd($remote,$server_xml,$home_info,$mod_id,$ip,$port,$db)
 }
 
 // This function is used to batch stop/restart servers in background.
-function exec_operation( $action, $home_id, $mod_id, $ip, $port )
+function exec_operation( $action, $home_id, $mod_id, $ip, $port, $override = false )
 {
     if(!is_numeric($port))
 		return FALSE;
@@ -216,8 +216,13 @@ function exec_operation( $action, $home_id, $mod_id, $ip, $port )
 		return FALSE;
 	
 	global $db;
-	$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
-	if($isAdmin) 
+	
+	$isAdmin = false;
+	if(hasValue($_SESSION) && hasValue($_SESSION['user_id'])){
+		$isAdmin = $db->isAdmin($_SESSION['user_id']);
+	}
+	
+	if($override || $isAdmin) 
 		$home_info = $db->getGameHome($home_id);
 	else
 		$home_info = $db->getUserGameHome($_SESSION['user_id'],$home_id);