@@ -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 Dotenv\Dotenv; |
| 7 | 7 | $dotenv = new Dotenv(dirname(__DIR__)); |
@@ -32,18 +32,18 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function loadSideBar($userId) |
| 34 | 34 | { |
| 35 | - if(!empty($userId)) |
|
| 35 | + if (!empty($userId)) |
|
| 36 | 36 | { |
| 37 | 37 | $query = "SELECT * FROM total_message WHERE user1='$userId' or user2='$userId' ORDER BY id DESC"; |
| 38 | - if($result = $this->connect->query($query)) |
|
| 38 | + if ($result = $this->connect->query($query)) |
|
| 39 | 39 | { |
| 40 | 40 | if ($result->num_rows > 0) |
| 41 | 41 | { |
| 42 | - while($row = $result->fetch_assoc()) |
|
| 42 | + while ($row = $result->fetch_assoc()) |
|
| 43 | 43 | { |
| 44 | 44 | $identifier = $row['identifier']; |
| 45 | 45 | $substring = explode(":", $identifier); |
| 46 | - if($substring[0] != $userId) |
|
| 46 | + if ($substring[0] != $userId) |
|
| 47 | 47 | { |
| 48 | 48 | $this->data($substring[0], $row); |
| 49 | 49 | } |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | public function data($userId, $row) |
| 65 | 65 | { |
| 66 | 66 | $query = "SELECT username, name, login_status, login_id from login where login_id = '$userId'"; |
| 67 | - if($result = $this->connect->query($query)) |
|
| 67 | + if ($result = $this->connect->query($query)) |
|
| 68 | 68 | { |
| 69 | - if($result->num_rows > 0) |
|
| 69 | + if ($result->num_rows > 0) |
|
| 70 | 70 | { |
| 71 | 71 | $fetch = $result->fetch_assoc(); |
| 72 | 72 | $row['time'] = $this->obTime->timeConversion($row['time']); |