fix: address code review nits - table name escaping, prefix fallback, gamemanager default, admin.php site vars

Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/35af6b7c-2518-4105-b4d2-ba1f3fe754cd

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-02 19:43:35 +00:00 committed by GitHub
parent d8972fee16
commit ffece9ba57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 7 deletions

View file

@ -4,8 +4,25 @@ require_once(__DIR__ . '/includes/admin_auth.php');
require_once(__DIR__ . '/includes/config_loader.php');
// Ensure site variables are defined regardless of which config was loaded.
// The panel config (loaded first by config_loader) does not define these, so
// we fall back to safe defaults when they are absent.
// The panel config (loaded first by config_loader) does not define these billing-specific
// variables. Try loading them from the billing config.inc.php if not already set.
if (!isset($SITE_BASE_URL) || !isset($SITE_DATA_DIR)) {
$billingLocalCfg = __DIR__ . '/includes/config.inc.php';
if (is_readable($billingLocalCfg) && defined('BILLING_CONFIG_PATH') && BILLING_CONFIG_PATH !== $billingLocalCfg) {
// Panel config was loaded; read billing config vars without re-running DB setup.
// Use a temporary scope to avoid overwriting DB credentials.
$__billing_cfg_vars = (static function() use ($billingLocalCfg) {
$SITE_BASE_URL = '';
$SITE_DATA_DIR = '';
@include $billingLocalCfg;
return ['base' => $SITE_BASE_URL ?? '', 'data' => $SITE_DATA_DIR ?? ''];
})();
if (!isset($SITE_BASE_URL)) $SITE_BASE_URL = $__billing_cfg_vars['base'];
if (!isset($SITE_DATA_DIR)) $SITE_DATA_DIR = $__billing_cfg_vars['data'];
unset($__billing_cfg_vars, $billingLocalCfg);
}
}
// Final safe defaults if still not set.
if (!isset($SITE_BASE_URL)) {
$SITE_BASE_URL = '';
}