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:
@@ -14,14 +14,14 @@ $action = $_POST['action'] ?? '';
|
||||
|
||||
if ($action === 'enable_maintenance') {
|
||||
file_put_contents(MAINTENANCE_FLAG, date('c'));
|
||||
$_SESSION['success'] = "Mode maintenance activé.";
|
||||
App::flash('success', "Mode maintenance activé.");
|
||||
} elseif ($action === 'disable_maintenance') {
|
||||
if (file_exists(MAINTENANCE_FLAG)) {
|
||||
unlink(MAINTENANCE_FLAG);
|
||||
}
|
||||
$_SESSION['success'] = "Mode maintenance désactivé.";
|
||||
App::flash('success', "Mode maintenance désactivé.");
|
||||
} else {
|
||||
$_SESSION['error'] = "Action inconnue.";
|
||||
App::flash('error', "Action inconnue.");
|
||||
}
|
||||
|
||||
header('Location: /admin/');
|
||||
|
||||
Reference in New Issue
Block a user