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>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-01 12:56:23 +00:00 committed by GitHub
parent 4571837eeb
commit 7a16fb299f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 12 deletions

View file

@ -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;
}

View file

@ -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)
{

View file

@ -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;
}

View file

@ -57,7 +57,7 @@ function exec_ogp_module()
require_once("includes/refreshed.php");
$refresh = new refreshed();
$OnlineServers .= "<p>Recent updates and changes</p>";
$OnlineServers = "<p>Recent updates and changes</p>";
?>
<div style="margin-top:20px;">
<?php

View file

@ -6,8 +6,3 @@
ALTER TABLE `gsp_billing_orders`
ADD COLUMN IF NOT EXISTS `created_by_admin` TINYINT(1) NOT NULL DEFAULT 0
COMMENT 'Set to 1 when an admin manually created this server via the panel';
-- Track whether an order is a renewal/extension (already referenced by create_servers.php)
ALTER TABLE `gsp_billing_orders`
ADD COLUMN IF NOT EXISTS `extended` TINYINT(1) NOT NULL DEFAULT 0
COMMENT 'Set to 1 when this order is a renewal of an existing server';

View file

@ -134,7 +134,6 @@ if (!function_exists('admin_register_server_in_billing')) {
'payment_txid' => 'admin-created',
'paid_ts' => $now,
'coupon_id' => 0,
'extended' => 0,
);
$order_id = $db->resultInsertId('billing_orders', $order_fields);