mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
33 lines
913 B
PHP
33 lines
913 B
PHP
<?php
|
|
/**
|
|
* Toast fragment endpoint — HTMX target.
|
|
*
|
|
* Reads flash messages from the session and returns the toast markup.
|
|
* Returns an empty 204 when there is nothing to show.
|
|
* Called via hx-get on the #toast-region aside in the admin footer.
|
|
*/
|
|
require_once __DIR__ . '/../../bootstrap.php';
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
|
|
AdminAuth::requireLogin();
|
|
|
|
$flash = App::consumeFlash();
|
|
|
|
if (!$flash['error'] && !$flash['success']) {
|
|
http_response_code(204);
|
|
exit;
|
|
}
|
|
?>
|
|
<?php if ($flash['error']): ?>
|
|
<p class="toast toast--error" role="alert">
|
|
<span class="toast__icon" aria-hidden="true">⚠</span>
|
|
<?= htmlspecialchars($flash['error']) ?>
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php if ($flash['success']): ?>
|
|
<p class="toast toast--success" role="status">
|
|
<span class="toast__icon" aria-hidden="true">✓</span>
|
|
<?= htmlspecialchars($flash['success']) ?>
|
|
</p>
|
|
<?php endif; ?>
|