@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace ChatApp; |
| 4 | -require_once (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 4 | +require_once (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 5 | 5 | use ChatApp\Time; |
| 6 | 6 | use ChatApp\User; |
| 7 | 7 | use Dotenv\Dotenv; |
@@ -35,38 +35,38 @@ discard block |
||
| 35 | 35 | public function conversationLoad($msg, $para) |
| 36 | 36 | { |
| 37 | 37 | $msg = json_decode($msg); |
| 38 | - if(!empty($msg)) |
|
| 38 | + if (!empty($msg)) |
|
| 39 | 39 | { |
| 40 | 40 | $userId = $msg->userId; |
| 41 | 41 | $add_load = 0; |
| 42 | 42 | $details = $msg->details; |
| 43 | 43 | $load = $msg->load; |
| 44 | 44 | |
| 45 | - if($para == True) |
|
| 45 | + if ($para == True) |
|
| 46 | 46 | { |
| 47 | 47 | $details = convert_uudecode(hex2bin($details)); |
| 48 | 48 | } |
| 49 | 49 | $fetch = $this->obUser->userDetails($details, $para); |
| 50 | 50 | |
| 51 | - if($fetch != NULL) |
|
| 51 | + if ($fetch != NULL) |
|
| 52 | 52 | { |
| 53 | 53 | $login_id = (int)$fetch['login_id']; |
| 54 | 54 | |
| 55 | 55 | // Unique Identifier |
| 56 | - if($login_id > $userId) |
|
| 56 | + if ($login_id > $userId) |
|
| 57 | 57 | $identifier = $userId.':'.$login_id; |
| 58 | 58 | else |
| 59 | 59 | $identifier = $login_id.':'.$userId; |
| 60 | 60 | |
| 61 | 61 | $query = "SELECT total_messages from total_message where identifier = '$identifier'"; |
| 62 | - if($result = $this->connect->query($query)) |
|
| 62 | + if ($result = $this->connect->query($query)) |
|
| 63 | 63 | { |
| 64 | - if($result->num_rows > 0) |
|
| 64 | + if ($result->num_rows > 0) |
|
| 65 | 65 | { |
| 66 | 66 | $total = $result->fetch_assoc(); |
| 67 | 67 | $total = $total['total_messages']; |
| 68 | - if($total - $load > 0) |
|
| 69 | - if($total - $load > 10) |
|
| 68 | + if ($total - $load > 0) |
|
| 69 | + if ($total - $load > 10) |
|
| 70 | 70 | $add_load = $load + 10; |
| 71 | 71 | else |
| 72 | 72 | $add_load = $total; |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $query = "SELECT message, time, sent_by FROM messages WHERE identifier_message_number = '$identifier' ORDER BY id DESC limit ".$load; |
| 77 | - if($result = $this->connect->query($query)) |
|
| 77 | + if ($result = $this->connect->query($query)) |
|
| 78 | 78 | { |
| 79 | - if($result->num_rows > 0) |
|
| 79 | + if ($result->num_rows > 0) |
|
| 80 | 80 | { |
| 81 | - while($row = $result->fetch_assoc()) |
|
| 81 | + while ($row = $result->fetch_assoc()) |
|
| 82 | 82 | { |
| 83 | 83 | $row['time'] = $this->obTime->timeConversion($row['time']); |
| 84 | - $row = array_merge($row,['start' => $userId]); |
|
| 84 | + $row = array_merge($row, ['start' => $userId]); |
|
| 85 | 85 | $this->array = array_merge($this->array, [$row]); |
| 86 | 86 | } |
| 87 | 87 | |