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:
parent
72668cdfbe
commit
fff379edd8
3 changed files with 18 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue