diff options
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/AngelType_model.php | 29 | ||||
-rw-r--r-- | includes/model/Message_model.php | 29 | ||||
-rw-r--r-- | includes/model/Room_model.php | 31 |
3 files changed, 89 insertions, 0 deletions
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php new file mode 100644 index 00000000..49d1c702 --- /dev/null +++ b/includes/model/AngelType_model.php @@ -0,0 +1,29 @@ +<?php
+
+/**
+ * Returns AngelType id array
+ */
+function mAngelTypeList() {
+ $angelType_source = sql_select("SELECT `id` FROM `AngelTypes`");
+ if ($angelType_source === false)
+ return false;
+ if (count($angelType_source) > 0)
+ return $angelType_source;
+ return null;
+}
+
+/**
+ * Returns angelType by id.
+ *
+ * @param $id angelType ID
+ */
+function mAngelType($id) {
+ $angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
+ if ($angelType_source === false)
+ return false;
+ if (count($angelType_source) > 0)
+ return $angelType_source[0];
+ return null;
+}
+
+?>
\ No newline at end of file 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 diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php new file mode 100644 index 00000000..fea241a6 --- /dev/null +++ b/includes/model/Room_model.php @@ -0,0 +1,31 @@ +<?php + +/** + * Returns room id array + */ +function mRoomList() { + $room_source = sql_select("SELECT `RID` FROM `Room`"); + if ($room_source === false) + return false; + if (count($room_source) > 0) + return $room_source; + return null; +} + + +/** + * Returns room by id. + * + * @param $id RID + */ +function mRoom($id) { + $room_source = sql_select("SELECT * FROM `Room` WHERE `RID`=" . sql_escape($id) . " LIMIT 1"); + if ($room_source === false) + return false; + if (count($room_source) > 0) + return $room_source[0]; + return null; +} + + +?> |