Refine workshop validation checks and table-name sanitization

Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/1575c81b-f8a7-433a-8f3b-e068c0992c18

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-08 13:00:18 +00:00 committed by GitHub
parent 72668cdfbe
commit fff379edd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View file

@ -36,14 +36,19 @@ if (!function_exists('sw_module_db_prefix')) {
if (!function_exists('sw_module_table')) {
function sw_module_table($table)
{
return '`' . sw_module_db_prefix() . $table . '`';
return '`' . sw_module_table_name($table) . '`';
}
}
if (!function_exists('sw_module_table_name')) {
function sw_module_table_name($table)
{
return sw_module_db_prefix() . $table;
$prefix = preg_replace('/[^a-zA-Z0-9_]/', '', (string)sw_module_db_prefix());
$name = preg_replace('/[^a-zA-Z0-9_]/', '', (string)$table);
if ($prefix === '') {
$prefix = 'gsp_';
}
return $prefix . $name;
}
}