Test Setup Failed
Push — master ( f3ea8f...027aaa )
by Ankit
02:16
created
registration-module/source/class.validate.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 		}	
34 34
 	}
35 35
 	
36
+	/**
37
+	 * @param string $email
38
+	 */
36 39
 	function validate_email_in_db($email)
37 40
 	{
38 41
 		$query="SELECT login_id FROM login WHERE email='$email'";
@@ -46,6 +49,9 @@  discard block
 block discarded – undo
46 49
 		}
47 50
 	}
48 51
 
52
+	/**
53
+	 * @param string $username
54
+	 */
49 55
 	function validate_username_in_db($username)
50 56
 	{
51 57
 		$query="SELECT login_id FROM login WHERE username='$username'";
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,23 +3,23 @@  discard block
 block discarded – undo
3 3
 require_once 'database.php';
4 4
 class validate
5 5
 {
6
-	private $connect;
7
-	function __construct()
8
-	{
9
-		$this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
6
+    private $connect;
7
+    function __construct()
8
+    {
9
+        $this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
10 10
 
11
-		$query="CREATE TABLE IF NOT EXISTS register (
11
+        $query="CREATE TABLE IF NOT EXISTS register (
12 12
 			id int primary key auto_increment unique not null,
13 13
 			email varchar(255) unique not null,
14 14
 			username varchar(255) unique not null,
15 15
 			password varchar(255) not null
16 16
 			) ENGINE=INNODB;";
17 17
 
18
-		if (!$this->connect->query($query)) {
19
-			echo "Table is not created || Query failed";
20
-		}
18
+        if (!$this->connect->query($query)) {
19
+            echo "Table is not created || Query failed";
20
+        }
21 21
 
22
-			$query="CREATE TABLE IF NOT EXISTS login (
22
+            $query="CREATE TABLE IF NOT EXISTS login (
23 23
 			login_id int primary key not null,
24 24
 			name varchar(255) not null,
25 25
 			email varchar(255) unique not null,
@@ -28,34 +28,34 @@  discard block
 block discarded – undo
28 28
 			FOREIGN KEY (login_id) REFERENCES register(id)
29 29
 			) ENGINE=INNODB;";
30 30
 		
31
-		if (!$this->connect->query($query)) {
32
-			echo "Table is not created || Query failed";
33
-		}	
34
-	}
31
+        if (!$this->connect->query($query)) {
32
+            echo "Table is not created || Query failed";
33
+        }	
34
+    }
35 35
 	
36
-	function validate_email_in_db($email)
37
-	{
38
-		$query="SELECT login_id FROM login WHERE email='$email'";
39
-		if ($result=$this->connect->query($query)) 
40
-		{
41
-			if ($result->num_rows>0) {
42
-				return 1;
43
-			}
44
-			else
45
-				return 0;
46
-		}
47
-	}
36
+    function validate_email_in_db($email)
37
+    {
38
+        $query="SELECT login_id FROM login WHERE email='$email'";
39
+        if ($result=$this->connect->query($query)) 
40
+        {
41
+            if ($result->num_rows>0) {
42
+                return 1;
43
+            }
44
+            else
45
+                return 0;
46
+        }
47
+    }
48 48
 
49
-	function validate_username_in_db($username)
50
-	{
51
-		$query="SELECT login_id FROM login WHERE username='$username'";
52
-		if ($result=$this->connect->query($query)) {
53
-			if ($result->num_rows>0) {
54
-				return 1;
55
-			}
56
-			else
57
-				return 0;
49
+    function validate_username_in_db($username)
50
+    {
51
+        $query="SELECT login_id FROM login WHERE username='$username'";
52
+        if ($result=$this->connect->query($query)) {
53
+            if ($result->num_rows>0) {
54
+                return 1;
55
+            }
56
+            else
57
+                return 0;
58 58
 			
59
-		}
60
-	}
59
+        }
60
+    }
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
src/Chat.php 1 patch
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -26,6 +26,9 @@  discard block
 block discarded – undo
26 26
         echo "New connection! ({$conn->resourceId})\n";
27 27
     }
28 28
 
29
+    /**
30
+     * @param ConnectionInterface $conn
31
+     */
29 32
     public function setID($conn)
30 33
     {
31 34
         session_id($conn->WebSocket->request->getCookies()['PHPSESSID']);
@@ -126,30 +129,47 @@  discard block
 block discarded – undo
126 129
         return $obSidebar->LoadSideBar($data);
127 130
     }
128 131
 
132
+    /**
133
+     * @param string $data
134
+     * @param boolean $para
135
+     */
129 136
     public function onConversation($data, $para, $sessionId)
130 137
     {
131 138
         $obConversation = new Conversation($sessionId);
132 139
         return $obConversation->ConversationLoad($data, $para);
133 140
     }
134 141
 
142
+    /**
143
+     * @param string $data
144
+     * @param boolean $para
145
+     */
135 146
     public function onReceiver($data, $para, $sessionId)
136 147
     {
137 148
         $obReceiver = new Receiver($sessionId);
138 149
         return $obReceiver->ReceiverLoad($data, True);
139 150
     }
140 151
 
152
+    /**
153
+     * @param string $data
154
+     */
141 155
     public function onSearch($data, $sessionId)
142 156
     {
143 157
         $obSearch = new Search($sessionId);
144 158
         return $obSearch->SearchItem(json_decode($data));
145 159
     }
146 160
 
161
+    /**
162
+     * @param string $data
163
+     */
147 164
     public function onCompose($data, $sessionId)
148 165
     {
149 166
         $obCompose = new Compose($sessionId);
150 167
         return $obCompose->SelectUser(json_decode($data));
151 168
     }
152 169
 
170
+    /**
171
+     * @param string $data
172
+     */
153 173
     public function onReply($data, $sessionId)
154 174
     {
155 175
         $obReply = new Reply($sessionId);
Please login to merge, or discard this patch.
src/Reply.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -90,6 +90,11 @@
 block discarded – undo
90 90
         $this->connect->close();
91 91
     }
92 92
 
93
+    /**
94
+     * @param string $identifier
95
+     * @param string $reply
96
+     * @param string $time
97
+     */
93 98
     function UpdateMessages($query, $identifier, $reply, $id, $time)
94 99
     {
95 100
         if($result = $this->connect->query($query))
Please login to merge, or discard this patch.
src/SideBar.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -65,6 +65,9 @@
 block discarded – undo
65 65
         $this->connect->close();
66 66
     }
67 67
 
68
+    /**
69
+     * @param string $id
70
+     */
68 71
     function Data($id, $row)
69 72
     {
70 73
         $query = "SELECT username,name,login_status,login_id from login where login_id = '$id'";
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
 			<a id="brand" href="#">OpenChat</a>
17 17
 			<ul class="nav-right">
18 18
 				<?php if(isset($_SESSION['start']))
19
-				{
20
-				?>
19
+                {
20
+                ?>
21 21
 				<li><a href="account.php">Account</a></li>
22 22
 				<li><a href="message.php">Message</a></li>
23 23
 				<li><a href="registration-module/source/class.logout.php">Log out</a></li>
24 24
 				<?php 
25
-				}
26
-				else
27
-				{
28
-				?>
25
+                }
26
+                else
27
+                {
28
+                ?>
29 29
 				<li><a href="login.php">Login</a></li>
30 30
 				<li><a href="register.php">Register</a></li>
31 31
 				<?php
32
-				}
33
-				?>
32
+                }
33
+                ?>
34 34
 			</ul>
35 35
 		</div>
36 36
 
Please login to merge, or discard this patch.
cmd.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
 use ChatApp\Chat;
9 9
 
10 10
 $server =IoServer::factory(
11
-	new HttpServer(
12
-		new WsServer(
13
-			new Chat()
14
-			)
15
-		)
16
-	,
17
-	8080
18
-	);
11
+    new HttpServer(
12
+        new WsServer(
13
+            new Chat()
14
+            )
15
+        )
16
+    ,
17
+    8080
18
+    );
19 19
 $server->run();
20 20
 
21 21
 
22 22
 
23
- ?>
24 23
\ No newline at end of file
24
+    ?>
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
message.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,6 +131,6 @@
 block discarded – undo
131 131
 <?php
132 132
 }
133 133
 else{
134
-	header('Location:http://www.localhost/openchat/login.php');
134
+    header('Location:http://www.localhost/openchat/login.php');
135 135
 }
136 136
 ?>
Please login to merge, or discard this patch.
registration-module/ajax/validate_register.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@
 block discarded – undo
3 3
 require_once '../source/class.register.php';
4 4
 if(isset($_POST['q']))
5 5
 {
6
-	$register_field=json_decode($_POST['q']);
7
-	$name=$register_field->name;
8
-	$email=$register_field->email;
9
-	$username=$register_field->username;
10
-	$mob=$register_field->mob;
11
-	$password=$register_field->password;
12
-	$ob = new register();
13
-	$result=$ob->_register($name,$email,$username,$password,$mob);
14
-	if(isset($result))
15
-		echo $result;
16
-	else
17
-		echo json_encode([]);
6
+    $register_field=json_decode($_POST['q']);
7
+    $name=$register_field->name;
8
+    $email=$register_field->email;
9
+    $username=$register_field->username;
10
+    $mob=$register_field->mob;
11
+    $password=$register_field->password;
12
+    $ob = new register();
13
+    $result=$ob->_register($name,$email,$username,$password,$mob);
14
+    if(isset($result))
15
+        echo $result;
16
+    else
17
+        echo json_encode([]);
18 18
 }
19 19
 ?>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
registration-module/ajax/validate_login.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@
 block discarded – undo
3 3
 require_once '../source/class.login.php';
4 4
 if(isset($_POST['q']))
5 5
 {
6
-	$login_field=json_decode($_POST['q']);
7
-	$login=$login_field->login;
8
-	$password=$login_field->password;
9
-	$ob = new login();
10
-	$result=$ob->_login($login,$password);
11
-	if(isset($result))
12
-		echo $result;
13
-	else
14
-		echo json_encode([]);
6
+    $login_field=json_decode($_POST['q']);
7
+    $login=$login_field->login;
8
+    $password=$login_field->password;
9
+    $ob = new login();
10
+    $result=$ob->_login($login,$password);
11
+    if(isset($result))
12
+        echo $result;
13
+    else
14
+        echo json_encode([]);
15 15
 }
16 16
 ?>
17 17
\ No newline at end of file
Please login to merge, or discard this patch.