@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Login; |
| 5 | 5 | |
| 6 | -if(isset($_POST['q'])) |
|
| 6 | +if (isset($_POST['q'])) |
|
| 7 | 7 | { |
| 8 | 8 | $loginField = json_decode($_POST['q']); |
| 9 | 9 | $login = $loginField->login; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | 'passLogin' => $password |
| 15 | 15 | ); |
| 16 | 16 | $result = $obLogin->authLogin($data); |
| 17 | - if(isset($result)) |
|
| 17 | + if (isset($result)) |
|
| 18 | 18 | echo $result; |
| 19 | 19 | else |
| 20 | 20 | echo json_encode([]); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require_once (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Session; |
| 5 | 5 | use Dotenv\Dotenv; |
| 6 | 6 | $dotenv = new Dotenv(dirname(__DIR__)); |
| 7 | 7 | $dotenv->load(); |
| 8 | 8 | |
| 9 | -if(Session::get('start') != null && empty($_GET['user'])) |
|
| 9 | +if (Session::get('start') != null && empty($_GET['user'])) |
|
| 10 | 10 | { |
| 11 | 11 | |
| 12 | 12 | ?> |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | <?php |
| 176 | 176 | } |
| 177 | -else{ |
|
| 178 | - header('Location:'. getenv('APP_URL')."/index.php"); |
|
| 177 | +else { |
|
| 178 | + header('Location:'.getenv('APP_URL')."/index.php"); |
|
| 179 | 179 | } |
| 180 | 180 | ?> |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once (__DIR__ . '/vendor/autoload.php'); |
|
| 3 | +require_once (__DIR__.'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Session; |
| 5 | 5 | use Dotenv\Dotenv; |
| 6 | 6 | $dotenv = new Dotenv(__DIR__); |
| 7 | 7 | $dotenv->load(); |
| 8 | 8 | |
| 9 | 9 | // die("Hello"); |
| 10 | -if(Session::get('start') != null) |
|
| 10 | +if (Session::get('start') != null) |
|
| 11 | 11 | { |
| 12 | 12 | header("Location:".getenv('APP_URL')."/views/account.php"); |
| 13 | 13 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require (dirname(__DIR__) . '/vendor/autoload.php'); |
|
| 3 | +require (dirname(__DIR__).'/vendor/autoload.php'); |
|
| 4 | 4 | use ChatApp\Register; |
| 5 | 5 | |
| 6 | -if(isset($_POST['q'])) |
|
| 6 | +if (isset($_POST['q'])) |
|
| 7 | 7 | { |
| 8 | 8 | $registerField = json_decode($_POST['q']); |
| 9 | 9 | $name = $registerField->name; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'mob' => $mob |
| 21 | 21 | ); |
| 22 | 22 | $result = $obRegister->authRegister($data); |
| 23 | - if(isset($result)) |
|
| 23 | + if (isset($result)) |
|
| 24 | 24 | echo $result; |
| 25 | 25 | else |
| 26 | 26 | echo json_encode([]); |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | "passLogin" => 'testing' |
| 191 | 191 | ] |
| 192 | 192 | ); |
| 193 | - $outputEmail = (array) json_decode($outputEmail); |
|
| 193 | + $outputEmail = (array)json_decode($outputEmail); |
|
| 194 | 194 | $this->assertEquals($expectedOutput, $outputEmail); |
| 195 | 195 | $currentId = Session::get('start'); |
| 196 | 196 | Session::forget('start'); |
| 197 | 197 | |
| 198 | - $msg =(object) [ |
|
| 198 | + $msg = (object)[ |
|
| 199 | 199 | "name" => $userId, |
| 200 | 200 | "reply" => "Hello World", |
| 201 | 201 | "userId" => $currentId |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $output = $obReply->replyTo($msg); |
| 206 | 206 | $this->assertEquals("Messages is sent", $output); |
| 207 | 207 | |
| 208 | - $msg =(object) [ |
|
| 208 | + $msg = (object)[ |
|
| 209 | 209 | "name" => $currentId, |
| 210 | 210 | "reply" => "Hello World", |
| 211 | 211 | "userId" => $userId |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | $output = $obReply->replyTo([]); |
| 219 | 219 | $this->assertEquals("Failed", $output); |
| 220 | 220 | |
| 221 | - $output = $obReply->replyTo((object) [ |
|
| 221 | + $output = $obReply->replyTo((object)[ |
|
| 222 | 222 | "name" => -1, |
| 223 | 223 | "reply" => "Hello World", |
| 224 | 224 | "userId" => $currentId |
| 225 | 225 | ]); |
| 226 | 226 | $this->assertEquals("Invalid Authentication", $output); |
| 227 | 227 | |
| 228 | - $output = $obReply->replyTo((object) [ |
|
| 228 | + $output = $obReply->replyTo((object)[ |
|
| 229 | 229 | "name" => $userId, |
| 230 | 230 | "reply" => "Hello", |
| 231 | 231 | "userId" => $currentId |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | class Session |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public static function put($key, $value){ |
|
| 9 | + public static function put($key, $value) { |
|
| 10 | 10 | $_SESSION[$key] = $value; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - public static function get($key){ |
|
| 13 | + public static function get($key) { |
|
| 14 | 14 | return (isset($_SESSION[$key]) ? $_SESSION[$key] : null); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public static function forget($key){ |
|
| 17 | + public static function forget($key) { |
|
| 18 | 18 | unset($_SESSION[$key]); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -65,20 +65,20 @@ |
||
| 65 | 65 | <div class="brief"> |
| 66 | 66 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
| 67 | 67 | <?php foreach ($row as $key => $value) { |
| 68 | - if ($key =='username' && $value != null) { |
|
| 69 | - echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 68 | + if ($key == 'username' && $value != null) { |
|
| 69 | + echo '<p>Username: '.$row["username"].'</p><br>'; |
|
| 70 | 70 | } |
| 71 | 71 | if ($key == 'email' && $value != null) { |
| 72 | - echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 72 | + echo '<p>Email Id: '.$row["email"].'</p><br>'; |
|
| 73 | 73 | } |
| 74 | 74 | if ($key == 'status' && $value != null) { |
| 75 | - echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 75 | + echo '<p>Status: '.$row["status"].'</p><br>'; |
|
| 76 | 76 | } |
| 77 | 77 | if ($key == 'education' && $value != null) { |
| 78 | - echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 78 | + echo '<p>Education: '.$row["education"].'</p><br>'; |
|
| 79 | 79 | } |
| 80 | 80 | if ($key == 'gender' && $value != null) { |
| 81 | - echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 81 | + echo '<p>Gender: '.$row["gender"].'</p><br>'; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | ?> |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | if ($result->num_rows > 0) { |
| 77 | 77 | while ($row = $result->fetch_assoc()) { |
| 78 | 78 | $row['time'] = $this->obTime->timeConversion($row['time']); |
| 79 | - $row = array_merge($row,['start' => $userId]); |
|
| 79 | + $row = array_merge($row, ['start' => $userId]); |
|
| 80 | 80 | $this->array = array_merge($this->array, [$row]); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -58,12 +58,12 @@ |
||
| 58 | 58 | $this->onError("passLogin", " *Invalid password"); |
| 59 | 59 | return json_encode($this->error); |
| 60 | 60 | } |
| 61 | - return json_encode(["Error" => "You are not registered, ".$this->connect->error ]); |
|
| 61 | + return json_encode(["Error" => "You are not registered, ".$this->connect->error]); |
|
| 62 | 62 | } |
| 63 | 63 | $this->onError("login", " *Invalid username or email"); |
| 64 | 64 | return json_encode($this->error); |
| 65 | 65 | } |
| 66 | - return json_encode(["Error" => "You are not registered, ".$this->connect->error ]); |
|
| 66 | + return json_encode(["Error" => "You are not registered, ".$this->connect->error]); |
|
| 67 | 67 | } else { |
| 68 | 68 | return json_encode($this->error); |
| 69 | 69 | } |