mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
Fix SQLite backtick translation, add service-switch SSE streaming, Fail2Ban management page
- DB.php: fix backtick-quoted column names in ON DUPLICATE KEY UPDATE VALUES() regex - DB.php: add global backtick→double-quote identifier strip - system.php: add service-switch SSE streaming endpoint for web/mail/ftp/dns server changes - system.php: simplify save-option to DB save only (no inline shell) - firewall.php: add f2b-config-get, f2b-config-save, f2b-log, f2b-jail, f2b-ban, f2b-unban, f2b-ignoreip-* actions - admin.js: Fail2Ban dedicated management page with jail table, global settings, whitelist, log viewer - admin.js: soSave() now uses streaming terminal overlay instead of blocking spinner - admin/index.php: split Firewall (UFW) and Fail2Ban into separate sidebar entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-4
@@ -34,11 +34,12 @@ class DB {
|
||||
function (array $m): string {
|
||||
$pairs = preg_split('/,\s*/', trim($m[1]));
|
||||
$sets = array_map(function (string $pair): string {
|
||||
if (preg_match('/(\w+)\s*=\s*VALUES\s*\(\s*(\w+)\s*\)/i', $pair, $pm)) {
|
||||
return "{$pm[1]}=excluded.{$pm[2]}";
|
||||
// Match plain or backtick-quoted column names: `col`=VALUES(`col`) or col=VALUES(col)
|
||||
if (preg_match('/`?(\w+)`?\s*=\s*VALUES\s*\(\s*`?(\w+)`?\s*\)/i', $pair, $pm)) {
|
||||
return "\"{$pm[1]}\"=excluded.\"{$pm[2]}\"";
|
||||
}
|
||||
// col=? or col=expr — keep as-is
|
||||
return $pair;
|
||||
// col=? or col=expr — strip backticks, keep as-is
|
||||
return preg_replace('/`(\w+)`/', '"$1"', $pair);
|
||||
}, $pairs);
|
||||
return 'ON CONFLICT DO UPDATE SET ' . implode(', ', $sets);
|
||||
},
|
||||
@@ -95,6 +96,9 @@ class DB {
|
||||
// IFNULL → COALESCE (SQLite supports both but be safe)
|
||||
$sql = preg_replace('/\bIFNULL\s*\(/i', 'COALESCE(', $sql);
|
||||
|
||||
// Backtick identifier quoting → double-quote (SQLite standard)
|
||||
$sql = preg_replace('/`(\w+)`/', '"$1"', $sql);
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user