diff options
Diffstat (limited to 'includes/helper')
-rw-r--r-- | includes/helper/error_helper.php | 11 | ||||
-rw-r--r-- | includes/helper/message_helper.php | 59 |
2 files changed, 70 insertions, 0 deletions
diff --git a/includes/helper/error_helper.php b/includes/helper/error_helper.php new file mode 100644 index 00000000..d26485d6 --- /dev/null +++ b/includes/helper/error_helper.php @@ -0,0 +1,11 @@ +<?php + +/** + * Displays a fatal message and stops execution. + * @param string $message + */ +function engelsystem_error($message) { + die($message); +} + +?>
\ No newline at end of file diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php new file mode 100644 index 00000000..c582c5b1 --- /dev/null +++ b/includes/helper/message_helper.php @@ -0,0 +1,59 @@ +<?php + +/** + * Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher + */ +function msg() { + if (!isset ($_SESSION['msg'])) + return ""; + $msg = $_SESSION['msg']; + $_SESSION['msg'] = ""; + return $msg; +} + +/** + * Rendert eine Information + */ +function info($msg, $immediatly = false) { + if ($immediatly) { + if ($msg == "") + return ""; + return '<p class="info">' . $msg . '</p>'; + } else { + if (!isset ($_SESSION['msg'])) + $_SESSION['msg'] = ""; + $_SESSION['msg'] .= info($msg, true); + } +} + +/** + * Rendert eine Fehlermeldung + */ +function error($msg, $immediatly = false) { + if ($immediatly) { + if ($msg == "") + return ""; + return '<p class="error">' . $msg . '</p>'; + } else { + if (!isset ($_SESSION['msg'])) + $_SESSION['msg'] = ""; + $_SESSION['msg'] .= error($msg, true); + } +} + +/** + * Rendert eine Erfolgsmeldung + */ +function success($msg, $immediatly = false) { + if ($immediatly) { + if ($msg == "") + return ""; + return '<p class="success">' . $msg . '</p>'; + } else { + if (!isset ($_SESSION['msg'])) + $_SESSION['msg'] = ""; + $_SESSION['msg'] .= success($msg, true); + } +} + +?>
\ No newline at end of file |