Completed
Push — master ( 06d3fe...de24cb )
by Ankit
02:59
created
views/validate_login.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
         'passLogin' => $password
15 15
     );
16 16
     $result = $obLogin->authLogin($data);
17
-    if(isset($result))
18
-        echo $result;
19
-    else
20
-        echo json_encode([]);
21
-}
22 17
\ No newline at end of file
18
+    if(isset($result)) {
19
+            echo $result;
20
+    } else {
21
+            echo json_encode([]);
22
+    }
23
+    }
23 24
\ No newline at end of file
Please login to merge, or discard this patch.
src/SideBar.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@
 block discarded – undo
47 47
                         if($substring != $userId)
48 48
                         {
49 49
                             $this->data($substring, $row);
50
-                        }
51
-                        else
50
+                        } else
52 51
                         {
53 52
                             $substring = substr($identifier, $length+1);
54 53
                             $this->Data($substring, $row);
Please login to merge, or discard this patch.
src/Conversation.php 1 patch
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,10 +50,11 @@  discard block
 block discarded – undo
50 50
                 $login_id = (int)$fetch['login_id'];
51 51
 
52 52
                 // Unique Identifier
53
-                if($login_id > $userId)
54
-                    $identifier = $userId.':'.$login_id;
55
-                else
56
-                    $identifier = $login_id.':'.$userId;
53
+                if($login_id > $userId) {
54
+                                    $identifier = $userId.':'.$login_id;
55
+                } else {
56
+                                    $identifier = $login_id.':'.$userId;
57
+                }
57 58
 
58 59
                 $query = "SELECT total_messages from total_message where identifier = '$identifier'";
59 60
                 if($result = $this->connect->query($query))
@@ -62,11 +63,12 @@  discard block
 block discarded – undo
62 63
                     {
63 64
                         $total = $result->fetch_assoc();
64 65
                         $total = $total['total_messages'];
65
-                        if($total - $load > 0)
66
-                            if($total - $load > 10)
66
+                        if($total - $load > 0) {
67
+                                                    if($total - $load > 10)
67 68
                                 $add_load = $load + 10;
68
-                            else
69
-                                $add_load = $total;
69
+                        } else {
70
+                                                            $add_load = $total;
71
+                            }
70 72
                     }
71 73
                 }
72 74
 
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
 
85 87
                         $this->array = array_merge([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => $fetch['login_id'], 'load' => $add_load, 'login_status' => $fetch['login_status'], 'type' => 1]], $this->array);
86 88
                         return json_encode($this->array);
87
-                    }
88
-                    else
89
+                    } else
89 90
                     {
90 91
                         return json_encode([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => $fetch['login_id'], 'login_status' => $fetch['login_status'], 'type' => 0]]);
91 92
                     }
Please login to merge, or discard this patch.
src/Chat.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,33 +55,28 @@  discard block
 block discarded – undo
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
             $getReturn = $this->onReply($msg);
@@ -106,8 +101,7 @@  discard block
 block discarded – undo
106 101
                     );
107 102
 
108 103
                     $client->send(json_encode($receiveResult));
109
-                }
110
-                elseif($client == $from)
104
+                } elseif($client == $from)
111 105
                 {
112 106
                     $sentResult->sidebar = json_decode($this->onSidebar($client->userId));
113 107
 
Please login to merge, or discard this patch.
src/Reply.php 1 patch
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,19 +26,22 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function replyTo($msg)
28 28
     {
29
-        if(!empty($msg))  //checks for the value send
29
+        if(!empty($msg)) {
30
+            //checks for the value send
30 31
         {
31 32
             $userId = $msg->userId;
33
+        }
32 34
             $receiverID = $msg->name; //stores id of the person whom message is to be sent
33 35
             $identifier = "";
34 36
 
35
-            if($receiverID > $userId)     // geneate specific unique code to store messages
37
+            if($receiverID > $userId) {
38
+                // geneate specific unique code to store messages
36 39
             {
37 40
                 $user1 = $userId;
41
+            }
38 42
                 $user2 = $receiverID;
39 43
                 $identifier = $userId . ":" . $receiverID;
40
-            }
41
-            else
44
+            } else
42 45
             {
43 46
                 $user1 = $receiverID;
44 47
                 $user2 = $userId;
@@ -57,19 +60,22 @@  discard block
 block discarded – undo
57 60
                 $query = "SELECT * from login where login_id = '$receiverID'";
58 61
 
59 62
                 $result = $this->connect->query($query);
60
-                if($result->num_rows > 0)     // if true
63
+                if($result->num_rows > 0) {
64
+                    // if true
61 65
                 {
62 66
                     //check whether he is sending message for thr first time or he has sent messages before
63 67
                     $query = "SELECT * from total_message where identifier = '$identifier'";
68
+                }
64 69
                     $result = $this->connect->query($query);
65
-                    if($result->num_rows > 0)               // if he has sent messages before
70
+                    if($result->num_rows > 0) {
71
+                        // if he has sent messages before
66 72
                     {
67 73
                         // Update Total_Message Table
68 74
                         $query = "UPDATE total_message SET total_messages = total_messages+1, time = '$time', unread = 1, id = '$time_id' WHERE identifier = '$identifier'";
75
+                    }
69 76
                         return $this->updateMessages($query, $identifier, $reply, $userId, $time);
70 77
 
71
-                    }
72
-                    else    // if he sends message for the first time
78
+                    } else    // if he sends message for the first time
73 79
                     {
74 80
                         // insert Details in Total_Message Table
75 81
                         $query = "INSERT into total_message values('$identifier', 1, '$user1', '$user2', 1, '$time', '$time_id')";
Please login to merge, or discard this patch.
src/User.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@
 block discarded – undo
33 33
         if($para == True)
34 34
         {
35 35
             $this->query = "SELECT * from login where login_id = '$details'";
36
-        }
37
-        else
36
+        } else
38 37
         {
39 38
             $this->query = "SELECT * from login where username = '$details'";
40 39
         }
41 40
         $this->result = $this->connect->query($this->query);
42
-        if($this->result->num_rows > 0)                   // if true
41
+        if($this->result->num_rows > 0) {
42
+            // if true
43 43
         {
44 44
             $this->details = $this->result->fetch_assoc();
45
-            return $this->details;
46 45
         }
47
-        else
46
+            return $this->details;
47
+        } else
48 48
         {
49 49
             return NULL;
50 50
         }
Please login to merge, or discard this patch.