summaryrefslogtreecommitdiff
path: root/includes/model/Message_model.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2013-12-29 15:08:33 +0100
committerPhilip Häusler <msquare@notrademark.de>2013-12-29 15:08:33 +0100
commit8fa78b55ac2327f87d492cf483a7d77b79ae8db0 (patch)
tree5ffc3fd40be53501c6b21604f8c66d9a529ca80c /includes/model/Message_model.php
parenta041e0efbb9825a9c8d77cba989dcea27d0f825d (diff)
first api new files
Diffstat (limited to 'includes/model/Message_model.php')
-rw-r--r--includes/model/Message_model.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php
new file mode 100644
index 00000000..0141208b
--- /dev/null
+++ b/includes/model/Message_model.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * Returns Message id array
+ */
+function mMessageList() {
+ $message_source = sql_select("SELECT `id` FROM `Messages`");
+ if ($message_source === false)
+ return false;
+ if (count($message_source) > 0)
+ return $message_source;
+ return null;
+}
+
+/**
+ * Returns message by id.
+ *
+ * @param $id message ID
+ */
+function mMessage($id) {
+ $message_source = sql_select("SELECT * FROM `Messages` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
+ if ($message_source === false)
+ return false;
+ if (count($message_source) > 0)
+ return $message_source[0];
+ return null;
+}
+
+?> \ No newline at end of file