feat: add client sla balances report totals and branding settings
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user