Files
xamxam/app/public/admin/acces.php

44 lines
2.0 KiB
PHP

<?php
require_once __DIR__ . '/../../bootstrap.php';
require_once __DIR__ . '/../../src/AdminAuth.php';
require_once __DIR__ . '/../../src/ShareLink.php';
require_once APP_ROOT . '/src/EmailObfuscator.php';
App::adminGuard();
// ── Liens d'accès étudiant·e ──────────────────────────────────────────────────
$shareLink = ShareLink::make();
$links = $shareLink->listActive();
$archivedLinks = $shareLink->listArchived();
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$baseUrl = $protocol . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
// ── Demandes d'accès aux fichiers ─────────────────────────────────────────────
require_once APP_ROOT . '/src/Database.php';
require_once APP_ROOT . '/src/Controllers/FileAccessController.php';
$db = new Database();
$siteSettings = $db->getAllSettings();
$controller = FileAccessController::create();
$vars = $controller->handle();
extract($vars);
// ── Page setup ────────────────────────────────────────────────────────────────
$pageTitle = 'Accès';
$isAdmin = true;
$bodyClass = 'admin-body';
$extraJs = ['/assets/js/app/clipboard.js', '/assets/js/app/acces-password.js'];
// Flash data for newly created/updated links (password display in modals)
$newLinkSlug = $_SESSION['_flash_new_link_slug'] ?? null;
$newLinkPassword = $_SESSION['_flash_new_link_password'] ?? null;
unset($_SESSION['_flash_new_link_slug'], $_SESSION['_flash_new_link_password']);
require_once APP_ROOT . '/templates/head.php';
echo '<link rel="stylesheet" href="/assets/css/file-access.css">';
include APP_ROOT . '/templates/header.php';
include APP_ROOT . '/templates/admin/acces.php';
require_once APP_ROOT . '/templates/admin/footer.php';