feat: add client sla balances report totals and branding settings

This commit is contained in:
Marco0300
2026-09-01 23:16:34 +02:00
parent 9627da20e1
commit 1a7111c78d
7 changed files with 86 additions and 5 deletions
+9
View File
@@ -46,6 +46,15 @@ function db(): PDO
return $pdo;
}
function app_setting(string $key, ?string $default = null): ?string
{
static $cache = [];
if (array_key_exists($key, $cache)) return $cache[$key];
try { $stmt = db()->prepare('SELECT setting_value FROM app_settings WHERE setting_key = :key'); $stmt->execute(['key' => $key]); $value = $stmt->fetchColumn(); }
catch (Throwable) { $value = false; }
return $cache[$key] = $value === false || $value === null ? $default : (string)$value;
}
function csrf_token(): string
{
if (empty($_SESSION['csrf'])) $_SESSION['csrf'] = bin2hex(random_bytes(32));