diff options
author | Bot <bot@myigel.name> | 2017-01-02 03:57:23 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-01-02 03:57:23 +0100 |
commit | 7313e15ce8236e19331fb6639a3a5b97c8f06ecd (patch) | |
tree | 399e5eaa403d6dd5993ca8fb6f2162319d2ed2e1 /includes/model/Message_model.php | |
parent | b839e401062b294292fdcbd7e30b79bc149fab6f (diff) |
PSR-2 formatting
Diffstat (limited to 'includes/model/Message_model.php')
-rw-r--r-- | includes/model/Message_model.php | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/includes/model/Message_model.php b/includes/model/Message_model.php index 652b60ea..6ee19792 100644 --- a/includes/model/Message_model.php +++ b/includes/model/Message_model.php @@ -3,8 +3,9 @@ /** * Returns Message id array */ -function Message_ids() { - return sql_select("SELECT `id` FROM `Messages`"); +function Message_ids() +{ + return sql_select("SELECT `id` FROM `Messages`"); } /** @@ -13,15 +14,16 @@ function Message_ids() { * @param $message_id message * ID */ -function Message($message_id) { - $message_source = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1"); - if ($message_source === false) { - return false; - } - if (count($message_source) > 0) { - return $message_source[0]; - } - return null; +function Message($message_id) +{ + $message_source = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1"); + if ($message_source === false) { + return false; + } + if (count($message_source) > 0) { + return $message_source[0]; + } + return null; } /** @@ -34,18 +36,17 @@ function Message($message_id) { * @param $text Text * of Message */ -function Message_send($receiver_user_id, $text) { - global $user; +function Message_send($receiver_user_id, $text) +{ + global $user; - $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text)); - $receiver_user_id = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($receiver_user_id)); + $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text)); + $receiver_user_id = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($receiver_user_id)); - if (($text != "" && is_numeric($receiver_user_id)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($receiver_user_id) . "' AND NOT `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0)) { - sql_query("INSERT INTO `Messages` SET `Datum`='" . sql_escape(time()) . "', `SUID`='" . sql_escape($user['UID']) . "', `RUID`='" . sql_escape($receiver_user_id) . "', `Text`='" . sql_escape($text) . "'"); - return true; - } + if (($text != "" && is_numeric($receiver_user_id)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($receiver_user_id) . "' AND NOT `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0)) { + sql_query("INSERT INTO `Messages` SET `Datum`='" . sql_escape(time()) . "', `SUID`='" . sql_escape($user['UID']) . "', `RUID`='" . sql_escape($receiver_user_id) . "', `Text`='" . sql_escape($text) . "'"); + return true; + } - return false; + return false; } - -?>
\ No newline at end of file |