Update codebase

This commit is contained in:
Hamza-Ayed
2026-08-09 16:56:13 +03:00
parent 95e2e4f35d
commit b64debaa88
1058 changed files with 164327 additions and 113928 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
// ============================================================
// food/connect_admin.php — بوابة إدارة سيرو (اعتماد المطاعم، التسويات...)
// يستخدم JWT الإداري نفسه المستخدم في backend/Admin (role admin/super_admin)
// ============================================================
require_once __DIR__ . '/../core/bootstrap.php';
require_once __DIR__ . '/functions.php';
$limiter = new RateLimiter($redis);
$limiter->enforce(RateLimiter::identifier(), 'api');
$jwtService = new JwtService($redis);
$decoded = $jwtService->authenticate();
$food_admin_role = $decoded->role ?? '';
if (!in_array($food_admin_role, ['admin', 'super_admin'], true)) {
jsonError('Forbidden — admin token required', 403);
}
$food_admin_id = (string)($decoded->user_id ?? '');
try {
$food_con = Database::get('food');
} catch (Exception $e) {
// السبب الحقيقي في اللوج فقط — الرد يبقى عاماً.
error_log('[FOOD] DB connection failed in ' . basename(__FILE__) . ': ' . $e->getMessage());
http_response_code(503);
echo json_encode(['status' => 'failure', 'message' => 'Food service unavailable']);
exit;
}