mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: student mode support for thanks page (admin-auth only)
- add hidden student_mode field in add.php form - pass mode=student through redirect to thanks.php in formulaire.php - thanks.php renders clean student thank-you page (no header, centered button) - add CSS for .thanks-student-page, .btn-new-form, .thanks-success, .thanks-error - admin auth always required; student mode is purely UI variant on the physical machine
This commit is contained in:
@@ -3,14 +3,16 @@
|
||||
require_once __DIR__ . "/../../config/bootstrap.php";
|
||||
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||
|
||||
// PHP-level auth guard (defence-in-depth behind nginx Basic Auth)
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
// Configure error reporting
|
||||
ini_set('display_errors', 0);
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', 'error.log');
|
||||
|
||||
$studentMode = isset($_GET['mode']) && $_GET['mode'] === 'student';
|
||||
if (!$studentMode) {
|
||||
AdminAuth::requireLogin();
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../src/Database.php';
|
||||
|
||||
// Security: Validate thesis ID parameter
|
||||
@@ -62,10 +64,48 @@ function formatFileSize($bytes) {
|
||||
// Set page title for header
|
||||
$pageTitle = "Récapitulatif TFE";
|
||||
?>
|
||||
<?php $isAdmin = true; $bodyClass = 'admin-body'; require_once APP_ROOT . '/templates/head.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/header.php'; ?>
|
||||
<?php
|
||||
$isAdmin = true;
|
||||
if ($studentMode) {
|
||||
$bodyClass = 'admin-body student-body';
|
||||
require_once APP_ROOT . '/templates/head.php';
|
||||
} else {
|
||||
$bodyClass = 'admin-body';
|
||||
require_once APP_ROOT . '/templates/head.php';
|
||||
include APP_ROOT . '/templates/header.php';
|
||||
}
|
||||
?>
|
||||
|
||||
<main id="main-content">
|
||||
<?php if ($studentMode): ?>
|
||||
<!-- ═══════════════════ STUDENT MODE: Thank you page ═══════════════════ -->
|
||||
<div class="thanks-student-page">
|
||||
<?php if ($error): ?>
|
||||
<div class="thanks-error">
|
||||
<h1>⚠ Oups…</h1>
|
||||
<p><?= htmlspecialchars($error) ?></p>
|
||||
<a href="/admin/add.php?mode=student" class="btn-new-form">← Retour au formulaire</a>
|
||||
</div>
|
||||
|
||||
<?php elseif ($thesis): ?>
|
||||
<div class="thanks-success">
|
||||
<h1>Merci 🎉</h1>
|
||||
<p class="thanks-message">
|
||||
Ton TFE <strong><?= htmlspecialchars($thesis['title']) ?></strong> a bien été soumis.
|
||||
</p>
|
||||
<a href="/admin/add.php?mode=student" class="btn-new-form">+ Ajouter un nouveau TFE</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="thanks-error">
|
||||
<h1>Erreur</h1>
|
||||
<p>Aucune donnée à afficher.</p>
|
||||
<a href="/admin/add.php?mode=student" class="btn-new-form">← Retour au formulaire</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<!-- ═══════════════════ ADMIN MODE: Recap page ═══════════════════ -->
|
||||
<h1>Récapitulatif TFE</h1>
|
||||
|
||||
<?php if ($error): ?>
|
||||
@@ -148,6 +188,8 @@ $pageTitle = "Récapitulatif TFE";
|
||||
<p class="admin-muted">Aucune donnée à afficher.</p>
|
||||
<p><a href="/admin/add.php" class="admin-btn-secondary">Retour au formulaire</a></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user