mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Unify flash messages: replace all legacy session key writes with App::flash()
All admin action files (account, tag, page, edit, visibility, maintenance,
publish, formulaire) now call App::flash('error'|'success', ...) instead of
writing to raw per-page session keys ($_SESSION['error'], 'admin_error',
'edit_error', 'admin_success', 'edit_success', 'form_error').
All admin display pages (add, edit, account, tags, pages, index) now include
templates/partials/flash-messages.php instead of manually reading and
unsetting the legacy session keys and inlining their own alert HTML.
App::consumeFlash() already drained all legacy key variants as a safety net,
so the partial works correctly whether called from pages that were already
migrated or any remaining stragglers. No behaviour change for end users.
This commit is contained in:
@@ -19,10 +19,7 @@ if ($thesisId <= 0) {
|
||||
die("ID invalide");
|
||||
}
|
||||
|
||||
// Consume flash messages from the edit action
|
||||
$error = $_SESSION['edit_error'] ?? null;
|
||||
$success = $_SESSION['edit_success'] ?? null;
|
||||
unset($_SESSION['edit_error'], $_SESSION['edit_success']);
|
||||
// Flash messages are consumed by the flash-messages partial below.
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
@@ -67,12 +64,7 @@ try {
|
||||
<main id="main-content">
|
||||
<h1>Modifier un TFE</h1>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<p role="alert" data-type="error">⚠ <?= htmlspecialchars($error) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<p role="status" data-type="success">✓ <?= htmlspecialchars($success) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php include APP_ROOT . '/templates/partials/flash-messages.php'; ?>
|
||||
|
||||
<form method="post" action="/admin/actions/edit.php" class="admin-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
|
||||
Reference in New Issue
Block a user