diff --git a/app/helpers/errors.php b/app/helpers/errors.php index 6695a64..ec8416b 100644 --- a/app/helpers/errors.php +++ b/app/helpers/errors.php @@ -1,5 +1,16 @@ " . $message . "\n"; + if ($unset) { + $message = null; + } + } +} + ?> diff --git a/app/templates/block-message.php b/app/templates/block-message.php index c078db0..79490a0 100644 --- a/app/templates/block-message.php +++ b/app/templates/block-message.php @@ -1,24 +1,18 @@ ' . $_SESSION['error'] . ''; +// Display and clean up session messages +foreach (['error', 'notice'] as $type) { + if (isset($_SESSION[$type])) { + renderMessage($_SESSION[$type], $type, true); + } } -// 'notice' for all non-critical messages -if (isset($_SESSION['notice'])) { - echo "\t\t" . '
' . $_SESSION['notice'] . '
'; -} - -// 'error' for errors +// Display standalone messages if (isset($error)) { - echo "\t\t" . '
' . $error . '
'; + renderMessage($error, 'error', true); } -// 'notice' for all non-critical messages -if (isset($_SESSION['notice'])) { - echo "\t\t" . '
' . $_SESSION['notice'] . '
'; +if (isset($notice)) { + renderMessage($notice, 'notice', true); } - - ?>