Globinours fait une petite pause 🐾

Une mise à jour sécurisée est en cours. Réessayez dans quelques instants.

'; exit(); } $bootstrapPath = rtrim((string) (parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?: '/'), '/') ?: '/'; $bootstrapIssues = InstallationService::blockingRuntimeIssues(); if ($bootstrapIssues) { I18n::setLocale('fr'); Auth::start(); if ($bootstrapPath !== '/setup') { header('Location: /setup'); exit(); } AuthController::setupUnavailable(InstallationService::runtimeChecks(true)); exit(); } function render(string $view, array $vars = []): void { extract($vars, EXTR_SKIP); $viewFile = __DIR__ . '/../app/Views/' . $view; require __DIR__ . '/../app/Views/layout.php'; } Migrations::run(__DIR__ . '/../migrations'); PrivateMediaService::migrateLegacy(); SecurityService::hardenRuntimeFiles(); I18n::setLocale(AppSettings::get('app_language')); $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? '/'; $path = rtrim($path, '/') ?: '/'; Auth::start(); header_remove('X-Powered-By'); header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: DENY'); header('Referrer-Policy: strict-origin-when-cross-origin'); header('Permissions-Policy: camera=(self), geolocation=(self), microphone=()'); header( "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https://tile.openstreetmap.org https://*.tile.openstreetmap.org; font-src 'self' data:; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'; manifest-src 'self'; worker-src 'self'", ); header('Cross-Origin-Opener-Policy: same-origin'); header('Cross-Origin-Resource-Policy: same-origin'); if (Auth::isSecureRequest()) { header('Strict-Transport-Security: max-age=31536000; includeSubDomains'); } if ($path === '/gestion') { header('Location: ' . (Auth::user() ? '/dashboard' : '/login?next=%2Fdashboard')); exit(); } if (PublicSiteController::handles($path)) { PublicSiteController::dispatch($path); exit(); } if ($path === '/auth/logo') { AuthController::logo(); exit(); } if ($path === '/pwa-icon-192.png') { AuthController::pwaIcon(192); exit(); } if ($path === '/pwa-icon-512.png') { AuthController::pwaIcon(512); exit(); } if ($path === '/setup') { AuthController::setup(); exit(); } if ($path === '/login') { AuthController::login(); exit(); } if ($path === '/logout') { AuthController::logout(); exit(); } if ($path === '/agenda/feed.ics') { AgendaController::feed(); exit(); } if (Auth::countUsers() === 0) { header('Location: /setup'); exit(); } if (!Auth::user()) { header('Location: /login?next=' . rawurlencode($_SERVER['REQUEST_URI'] ?? '/dashboard')); exit(); } header('Cache-Control: private, no-store'); if ($path === '/account/devices') { DevicesController::index(); exit(); } if ($path === '/account/devices/revoke') { DevicesController::revoke(); exit(); } if ($path === '/account/devices/revoke-all') { DevicesController::revokeAll(); exit(); } if ($path === '/agenda/feed/regenerate') { AgendaController::regenerateFeed(); exit(); } if ($path === '/agenda/feed/revoke') { AgendaController::revokeFeed(); exit(); } if ($path === '/' && !PermissionService::can('dashboard')) { header('Location: ' . PermissionService::firstAllowedPath()); exit(); } PermissionService::enforce($path, (string) ($_SERVER['REQUEST_METHOD'] ?? 'GET')); if (str_starts_with($path, '/dev/')) { $remote = (string) ($_SERVER['REMOTE_ADDR'] ?? ''); if (getenv('APP_ENV') !== 'development' || !in_array($remote, ['127.0.0.1', '::1'], true) || !Auth::is('admin')) { http_response_code(404); echo 'Page introuvable.'; exit(); } } if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST') { if (!Auth::validCsrf($_POST['csrf'] ?? null)) { http_response_code(419); echo 'Session expirée. Rechargez la page puis réessayez.'; exit(); } if (!Auth::canWrite($path)) { http_response_code(403); echo 'Votre rôle ne permet pas cette action.'; exit(); } if (!in_array($path, ['/settings/users/save', '/settings/backups/restore'], true)) { $entityId = (int) ($_POST['animal_id'] ?? ($_POST['id'] ?? 0)) ?: null; $fields = implode(',', array_keys($_POST)); register_shutdown_function(static function () use ($path, $entityId, $fields): void { $error = error_get_last(); if ($error && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR], true)) { return; } $code = http_response_code(); if ($code === false || $code < 400) { AuditService::log('post', $path, 'Action effectuée', $entityId ? 'animal' : null, $entityId, [ 'fields' => $fields, ]); } }); } } require __DIR__ . '/../app/Routes/web.php';