summaryrefslogtreecommitdiff
path: root/includes/helper
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2013-09-18 01:38:36 +0200
committerPhilip Häusler <msquare@notrademark.de>2013-09-18 01:38:36 +0200
commitbfb0cacd541cc20129a3c0ac77130370741dca18 (patch)
tree0a0e86e1a53d712065664c12d06603bc044df9ec /includes/helper
parentd50cc21f50cb3ec3afdabb74a20d81bd1a53dfbd (diff)
mysql to mysqli and a lot of cleanup and mvc
Diffstat (limited to 'includes/helper')
-rw-r--r--includes/helper/error_helper.php11
-rw-r--r--includes/helper/message_helper.php59
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