@@ -114,10 +114,11 @@ discard block |
||
114 | 114 | 'sentAt' => time() |
115 | 115 | ); |
116 | 116 | |
117 | - if ($this->db->insert('messages', $insert)) |
|
118 | - return $this->db->lastInsertId(); |
|
119 | - else |
|
120 | - return false; |
|
117 | + if ($this->db->insert('messages', $insert)) { |
|
118 | + return $this->db->lastInsertId(); |
|
119 | + } else { |
|
120 | + return false; |
|
121 | + } |
|
121 | 122 | } |
122 | 123 | |
123 | 124 | public function sendFile($data) |
@@ -131,10 +132,11 @@ discard block |
||
131 | 132 | 'sentAt' => time() |
132 | 133 | ); |
133 | 134 | |
134 | - if ($this->db->insert('files', $insert)) |
|
135 | - return $this->db->lastInsertId(); |
|
136 | - else |
|
137 | - return false; |
|
135 | + if ($this->db->insert('files', $insert)) { |
|
136 | + return $this->db->lastInsertId(); |
|
137 | + } else { |
|
138 | + return false; |
|
139 | + } |
|
138 | 140 | } |
139 | 141 | |
140 | 142 | public function getMessageById($id) |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | |
292 | 292 | foreach ($sentFiles as $file) { |
293 | 293 | $item = array(); |
294 | - $item['id'] = 'f_' . $file['id']; |
|
294 | + $item['id'] = 'f_'.$file['id']; |
|
295 | 295 | $item['sender_id'] = $file['sender_id']; |
296 | 296 | $item['receiver_id'] = $file['receiver_id']; |
297 | 297 | $item['fileName'] = $file['fileName']; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | foreach ($getFiles as $file) { |
306 | 306 | $item = array(); |
307 | - $item['id'] = 'f_' . $file['id']; |
|
307 | + $item['id'] = 'f_'.$file['id']; |
|
308 | 308 | $item['sender_id'] = $file['sender_id']; |
309 | 309 | $item['receiver_id'] = $file['receiver_id']; |
310 | 310 | $item['fileName'] = $file['fileName']; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $unsorted_messages = array_merge($sent, $inbox); |
319 | 319 | |
320 | - uasort($unsorted_messages, function ($a, $b) { |
|
320 | + uasort($unsorted_messages, function($a, $b) { |
|
321 | 321 | return ($a['sentAt'] > $b['sentAt']) ? -1 : 1; |
322 | 322 | }); |
323 | 323 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function insert_friends_request(array $data) |
135 | 135 | { |
136 | 136 | $sql = " |
137 | - INSERT INTO " . $this->friends_request_table . " |
|
137 | + INSERT INTO " . $this->friends_request_table." |
|
138 | 138 | ( |
139 | 139 | `user_id`, |
140 | 140 | `sender_id`, |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function delete_friend_request($request_id) |
158 | 158 | { |
159 | 159 | $sql = " |
160 | - DELETE FROM " . $this->friends_request_table . " WHERE `request_id` = " . (int)$request_id . " |
|
160 | + DELETE FROM " . $this->friends_request_table." WHERE `request_id` = ".(int)$request_id." |
|
161 | 161 | "; |
162 | 162 | |
163 | 163 | return $this->db->sql_query($sql); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function approve_friend_request($request_id) |
167 | 167 | { |
168 | 168 | $sql = " |
169 | - UPDATE " . $this->friends_request_table . " SET `status` = 1 WHERE `request_id` = " . (int)$request_id . " |
|
169 | + UPDATE " . $this->friends_request_table." SET `status` = 1 WHERE `request_id` = ".(int)$request_id." |
|
170 | 170 | "; |
171 | 171 | |
172 | 172 | return $this->db->sql_query($sql); |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | $check_friend = $this->check_friend($data); |
179 | 179 | if ($check_friend == false) { |
180 | 180 | $sql = " |
181 | - INSERT INTO " . $this->user_friends_table . " |
|
181 | + INSERT INTO " . $this->user_friends_table." |
|
182 | 182 | ( |
183 | 183 | `user_id`, |
184 | 184 | `friend_id` |
185 | 185 | ) |
186 | 186 | VALUES |
187 | 187 | ( |
188 | - " . (int)$data['user_id'] . ", |
|
189 | - " . (int)$data['friend_id'] . " |
|
188 | + " . (int)$data['user_id'].", |
|
189 | + " . (int)$data['friend_id']." |
|
190 | 190 | ) |
191 | 191 | "; |
192 | 192 | if ($this->db->sql_query($sql)) { |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | |
243 | 243 | public function remove_friend($user_id) |
244 | 244 | { |
245 | - $sql = "DELETE FROM " . $this->user_friends_table . " WHERE `user_id` = " . (int)$user_id . ""; |
|
245 | + $sql = "DELETE FROM ".$this->user_friends_table." WHERE `user_id` = ".(int)$user_id.""; |
|
246 | 246 | $this->db->sql_query($sql); |
247 | 247 | |
248 | - $sql = "DELETE FROM " . $this->user_friends_table . " WHERE `friend_id` = " . (int)$user_id . ""; |
|
248 | + $sql = "DELETE FROM ".$this->user_friends_table." WHERE `friend_id` = ".(int)$user_id.""; |
|
249 | 249 | $this->db->sql_query($sql); |
250 | 250 | } |
251 | 251 |