From 7a16fb299f7ce825d486b1a0bb733f6a433e3f02 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 12:56:23 +0000 Subject: [PATCH] fix: PHP 8 compatibility warnings and fatal errors Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/5ac91d14-7688-4ab2-9065-10d4a361750f Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- includes/functions.php | 3 ++- includes/lib_remote.php | 1 + modules/cron/user_cron.php | 8 ++++---- modules/dashboard/dashboard.php | 2 +- modules/user_games/admin_billing_migration.sql | 5 ----- modules/user_games/billing_integration.php | 1 - 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index bd374ceb..bd88b272 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -630,6 +630,7 @@ function get_game_selector($os, $game_cfgs, $home_cfg_id = FALSE) } function getClientIPAddress(){ + $ip = null; if(isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])){ $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; }else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ @@ -638,7 +639,7 @@ function getClientIPAddress(){ $ip = $_SERVER['HTTP_X_REAL_IP']; } - if(filter_var($ip, FILTER_VALIDATE_IP)){ + if(isset($ip) && filter_var($ip, FILTER_VALIDATE_IP)){ return $ip; } diff --git a/includes/lib_remote.php b/includes/lib_remote.php index 6b38b752..111dcbf6 100644 --- a/includes/lib_remote.php +++ b/includes/lib_remote.php @@ -869,6 +869,7 @@ class OGPRemoteLibrary if ( $retval > 0 ) { + $data_tmp = is_string($data_tmp) ? $data_tmp : ''; $lines = explode('\n',$data_tmp); foreach ((array)$lines as $line) { diff --git a/modules/cron/user_cron.php b/modules/cron/user_cron.php index 0744b088..0e4c6cab 100644 --- a/modules/cron/user_cron.php +++ b/modules/cron/user_cron.php @@ -80,16 +80,16 @@ function exec_ogp_module() switch ($_POST['action']) { case "stop": - $command = "wget -qO- \"${panelURL}/ogp_api.php?gamemanager/stop&token=${token}&ip=${ip}&port=${port}&mod_key=${mod_key}\" --no-check-certificate > /dev/null 2>&1"; + $command = "wget -qO- \"{$panelURL}/ogp_api.php?gamemanager/stop&token={$token}&ip={$ip}&port={$port}&mod_key={$mod_key}\" --no-check-certificate > /dev/null 2>&1"; break; case "start": - $command = "wget -qO- \"${panelURL}/ogp_api.php?gamemanager/start&token=${token}&ip=${ip}&port=${port}&mod_key=${mod_key}\" --no-check-certificate > /dev/null 2>&1"; + $command = "wget -qO- \"{$panelURL}/ogp_api.php?gamemanager/start&token={$token}&ip={$ip}&port={$port}&mod_key={$mod_key}\" --no-check-certificate > /dev/null 2>&1"; break; case "restart": - $command = "wget -qO- \"${panelURL}/ogp_api.php?gamemanager/restart&token=${token}&ip=${ip}&port=${port}&mod_key=${mod_key}\" --no-check-certificate > /dev/null 2>&1"; + $command = "wget -qO- \"{$panelURL}/ogp_api.php?gamemanager/restart&token={$token}&ip={$ip}&port={$port}&mod_key={$mod_key}\" --no-check-certificate > /dev/null 2>&1"; break; case "steam_auto_update": - $command = "wget -qO- \"${panelURL}/ogp_api.php?gamemanager/update&token=${token}&ip=${ip}&port=${port}&mod_key=${mod_key}&type=steam\" --no-check-certificate > /dev/null 2>&1"; + $command = "wget -qO- \"{$panelURL}/ogp_api.php?gamemanager/update&token={$token}&ip={$ip}&port={$port}&mod_key={$mod_key}&type=steam\" --no-check-certificate > /dev/null 2>&1"; break; } diff --git a/modules/dashboard/dashboard.php b/modules/dashboard/dashboard.php index 7665b3bd..564a7e3a 100644 --- a/modules/dashboard/dashboard.php +++ b/modules/dashboard/dashboard.php @@ -57,7 +57,7 @@ function exec_ogp_module() require_once("includes/refreshed.php"); $refresh = new refreshed(); - $OnlineServers .= "
Recent updates and changes
"; + $OnlineServers = "Recent updates and changes
"; ?>