multi-tenant relay und card-push to user

This commit is contained in:
th committed 2026-04-10 18:23:07 +02:00
1 parent 7219bae655
commit 5b18c46ac2
22 files changed
+7453 -519

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
<?php
// Tenant DB lookup helpers.
if (!defined('RELAY_BOOTSTRAPPED')) { http_response_code(404); exit; }
function getTenantById(PDO $db, int $id): ?array {
$stmt = $db->prepare('SELECT * FROM tenants WHERE id = :id');
$stmt->execute(['id' => $id]);
return $stmt->fetch() ?: null;
}
function getTenantByUsername(PDO $db, string $username): ?array {
$stmt = $db->prepare('SELECT * FROM tenants WHERE username = :u');
$stmt->execute(['u' => $username]);
return $stmt->fetch() ?: null;
}
function tenantCount(PDO $db): int {
return (int)$db->query('SELECT COUNT(*) FROM tenants')->fetchColumn();
}
function adminCount(PDO $db): int {
return (int)$db->query('SELECT COUNT(*) FROM tenants WHERE is_admin = 1')->fetchColumn();
}