@@ -46,8 +46,7 @@ |
||
46 | 46 | if($substring[0] != $userId) |
47 | 47 | { |
48 | 48 | $this->data($substring[0], $row); |
49 | - } |
|
50 | - else |
|
49 | + } else |
|
51 | 50 | { |
52 | 51 | $this->data($substring[1], $row); |
53 | 52 | } |
@@ -55,33 +55,28 @@ discard block |
||
55 | 55 | ); |
56 | 56 | } |
57 | 57 | $from->send(json_encode($initial)); |
58 | - } |
|
59 | - elseif ($msg->type == 'Load Sidebar') |
|
58 | + } elseif ($msg->type == 'Load Sidebar') |
|
60 | 59 | { |
61 | 60 | $sidebar = (object) array(); |
62 | 61 | $sidebar->sidebar = json_decode($this->onSidebar($from->userId)); |
63 | 62 | $from->send(json_encode($sidebar)); |
64 | - } |
|
65 | - elseif ($msg->type == 'Initiated') |
|
63 | + } elseif ($msg->type == 'Initiated') |
|
66 | 64 | { |
67 | 65 | $msg->userId = $from->userId; |
68 | 66 | $result = (object) array(); |
69 | 67 | $result->conversation = json_decode($this->onConversation(json_encode($msg), False)); |
70 | 68 | $from->send(json_encode($result)); |
71 | - } |
|
72 | - elseif ($msg->type == 'Search') |
|
69 | + } elseif ($msg->type == 'Search') |
|
73 | 70 | { |
74 | 71 | $msg->userId = $from->userId; |
75 | 72 | $searchResult = $this->onSearch($msg); |
76 | 73 | $from->send($searchResult); |
77 | - } |
|
78 | - elseif ($msg->type == 'Compose') |
|
74 | + } elseif ($msg->type == 'Compose') |
|
79 | 75 | { |
80 | 76 | $msg->userId = $from->userId; |
81 | 77 | $composeResult = $this->onCompose($msg); |
82 | 78 | $from->send($composeResult); |
83 | - } |
|
84 | - else |
|
79 | + } else |
|
85 | 80 | { |
86 | 81 | $msg->userId = $from->userId; |
87 | 82 | $msg->name = convert_uudecode(hex2bin($msg->name)); |
@@ -108,8 +103,7 @@ discard block |
||
108 | 103 | ); |
109 | 104 | |
110 | 105 | $client->send(json_encode($receiveResult)); |
111 | - } |
|
112 | - elseif($client == $from) |
|
106 | + } elseif($client == $from) |
|
113 | 107 | { |
114 | 108 | $sentResult->sidebar = json_decode($this->onSidebar($client->userId)); |
115 | 109 |
@@ -23,12 +23,13 @@ |
||
23 | 23 | ); |
24 | 24 | $query = "SELECT * from profile where login_id = '$userId'"; |
25 | 25 | $result = $connect->query($query); |
26 | - if($result->num_rows > 0) // if true |
|
26 | + if($result->num_rows > 0) { |
|
27 | + // if true |
|
27 | 28 | { |
28 | 29 | $details = $result->fetch_assoc(); |
29 | - return $details; |
|
30 | 30 | } |
31 | - else |
|
31 | + return $details; |
|
32 | + } else |
|
32 | 33 | { |
33 | 34 | return NULL; |
34 | 35 | } |
@@ -16,14 +16,15 @@ |
||
16 | 16 | public function timeConversion($time) |
17 | 17 | { |
18 | 18 | |
19 | - if(substr($time,4,11) == date("d M Y", time() + 16200)) |
|
20 | - $time = substr($time,16,5); |
|
21 | - else if(substr($time,7,8) == date("M Y", time() + 16200) && substr($time, 4,2) - date("d") < 7) |
|
22 | - $time = substr($time,0,3); |
|
23 | - else if(substr($time,11,4) == date("Y", time() + 16200)) |
|
24 | - $time = substr($time,4,6); |
|
25 | - else |
|
26 | - $time = substr($time,4,11); |
|
19 | + if(substr($time,4,11) == date("d M Y", time() + 16200)) { |
|
20 | + $time = substr($time,16,5); |
|
21 | + } else if(substr($time,7,8) == date("M Y", time() + 16200) && substr($time, 4,2) - date("d") < 7) { |
|
22 | + $time = substr($time,0,3); |
|
23 | + } else if(substr($time,11,4) == date("Y", time() + 16200)) { |
|
24 | + $time = substr($time,4,6); |
|
25 | + } else { |
|
26 | + $time = substr($time,4,11); |
|
27 | + } |
|
27 | 28 | |
28 | 29 | return $time; |
29 | 30 | } |
@@ -53,10 +53,11 @@ discard block |
||
53 | 53 | $login_id = (int)$fetch['login_id']; |
54 | 54 | |
55 | 55 | // Unique Identifier |
56 | - if($login_id > $userId) |
|
57 | - $identifier = $userId.':'.$login_id; |
|
58 | - else |
|
59 | - $identifier = $login_id.':'.$userId; |
|
56 | + if($login_id > $userId) { |
|
57 | + $identifier = $userId.':'.$login_id; |
|
58 | + } else { |
|
59 | + $identifier = $login_id.':'.$userId; |
|
60 | + } |
|
60 | 61 | |
61 | 62 | $query = "SELECT total_messages from total_message where identifier = '$identifier'"; |
62 | 63 | if($result = $this->connect->query($query)) |
@@ -65,11 +66,12 @@ discard block |
||
65 | 66 | { |
66 | 67 | $total = $result->fetch_assoc(); |
67 | 68 | $total = $total['total_messages']; |
68 | - if($total - $load > 0) |
|
69 | - if($total - $load > 10) |
|
69 | + if($total - $load > 0) { |
|
70 | + if($total - $load > 10) |
|
70 | 71 | $add_load = $load + 10; |
71 | - else |
|
72 | - $add_load = $total; |
|
72 | + } else { |
|
73 | + $add_load = $total; |
|
74 | + } |
|
73 | 75 | } |
74 | 76 | } |
75 | 77 | |
@@ -87,8 +89,7 @@ discard block |
||
87 | 89 | |
88 | 90 | $this->array = array_merge([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => bin2hex(convert_uuencode($fetch['login_id'])), 'load' => $add_load, 'login_status' => $fetch['login_status'], 'type' => 1]], $this->array); |
89 | 91 | return json_encode($this->array); |
90 | - } |
|
91 | - else |
|
92 | + } else |
|
92 | 93 | { |
93 | 94 | return json_encode([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => bin2hex(convert_uuencode($fetch['login_id'])), 'login_status' => $fetch['login_status'], 'type' => 0]]); |
94 | 95 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | { |
31 | 31 | if ($result->num_rows > 0) { |
32 | 32 | return 1; |
33 | + } else { |
|
34 | + return 0; |
|
33 | 35 | } |
34 | - else |
|
35 | - return 0; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | if ($result = $this->connect->query($query)) { |
43 | 43 | if ($result->num_rows > 0) { |
44 | 44 | return 1; |
45 | + } else { |
|
46 | + return 0; |
|
45 | 47 | } |
46 | - else |
|
47 | - return 0; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |