Passed
Push — main ( ef9287...ab4e57 )
by A
10:14 queued 15s
created
src/DatabaseActiveRecord/ActiveRecordModel.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
         $this->checkDb();
136 136
         $params = is_array($value) ? $value : [$value];
137 137
         $this->db->connect()
138
-                 ->select()
139
-                 ->from($this ->tableName)
140
-                 ->where($where)
141
-                 ->execute($params)
142
-                 ->fetchInto($this);
138
+                    ->select()
139
+                    ->from($this ->tableName)
140
+                    ->where($where)
141
+                    ->execute($params)
142
+                    ->fetchInto($this);
143 143
         return $this;
144 144
     }
145 145
 
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
         $values  = array_values($properties);
243 243
 
244 244
         $this->db->connect()
245
-                 ->insert($this->tableName, $columns)
246
-                 ->execute($values);
245
+                    ->insert($this->tableName, $columns)
246
+                    ->execute($values);
247 247
 
248 248
         $this->{$this->tableIdColumn} = $this->db->lastInsertId();
249 249
     }
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
         $values[] = $this->{$this->tableIdColumn};
266 266
 
267 267
         $this->db->connect()
268
-                 ->update($this->tableName, $columns)
269
-                 ->where("{$this->tableIdColumn} = ?")
270
-                 ->execute($values);
268
+                    ->update($this->tableName, $columns)
269
+                    ->where("{$this->tableIdColumn} = ?")
270
+                    ->execute($values);
271 271
     }
272 272
 
273 273
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
         $values = array_merge($values, $values1);
300 300
 
301 301
         $this->db->connect()
302
-                 ->update($this->tableName, $columns)
303
-                 ->where($where)
304
-                 ->execute($values);
302
+                    ->update($this->tableName, $columns)
303
+                    ->where($where)
304
+                    ->execute($values);
305 305
     }
306 306
 
307 307
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
         $id = $id ?: $this->{$this->tableIdColumn};
322 322
 
323 323
         $this->db->connect()
324
-                 ->deleteFrom($this->tableName)
325
-                 ->where("{$this->tableIdColumn} = ?")
326
-                 ->execute([$id]);
324
+                    ->deleteFrom($this->tableName)
325
+                    ->where("{$this->tableIdColumn} = ?")
326
+                    ->execute([$id]);
327 327
 
328 328
         $this->{$this->tableIdColumn} = null;
329 329
     }
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
         $values = is_array($value) ? $value : [$value];
353 353
 
354 354
         $this->db->connect()
355
-                 ->deleteFrom($this->tableName)
356
-                 ->where($where)
357
-                 ->execute($values);
355
+                    ->deleteFrom($this->tableName)
356
+                    ->where($where)
357
+                    ->execute($values);
358 358
     }
359 359
 }
Please login to merge, or discard this patch.
src/DatabaseQueryBuilder/QueryBuilderTrait.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
 
467 467
 
468 468
     /**
469
-    * Build the group by part.
470
-    *
471
-    * @param string $condition for building the group by part of the query.
472
-    *
473
-    * @return $this
474
-    */
469
+     * Build the group by part.
470
+     *
471
+     * @param string $condition for building the group by part of the query.
472
+     *
473
+     * @return $this
474
+     */
475 475
     public function groupBy($condition)
476 476
     {
477 477
         $this->groupby = "GROUP BY " . $condition;
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
 
483 483
 
484 484
     /**
485
-    * Build the order by part.
486
-    *
487
-    * @param string $condition for building the where part of the query.
488
-    *
489
-    * @return $this
490
-    */
485
+     * Build the order by part.
486
+     *
487
+     * @param string $condition for building the where part of the query.
488
+     *
489
+     * @return $this
490
+     */
491 491
     public function orderBy($condition)
492 492
     {
493 493
         $this->orderby = "ORDER BY " . $condition;
Please login to merge, or discard this patch.
src/User/HTMLForm/UserLoginForm.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -82,18 +82,18 @@
 block discarded – undo
82 82
         $db = $this->di->get("dbqb");
83 83
         $db->connect();
84 84
         $user = $db->select("password")
85
-                   ->from("User")
86
-                   ->where("acronym = ?")
87
-                   ->execute([$acronym])
88
-                   ->fetch();
85
+                    ->from("User")
86
+                    ->where("acronym = ?")
87
+                    ->execute([$acronym])
88
+                    ->fetch();
89 89
 
90 90
         // $user is null if user is not found
91 91
         if (!$user || !password_verify($password, $user->password)) {
92 92
             var_dump($acronym);
93 93
             var_dump($password);
94
-           $this->form->rememberValues();
95
-           $this->form->addOutput("User $acronym or password $password did not match.");
96
-           return false;
94
+            $this->form->rememberValues();
95
+            $this->form->addOutput("User $acronym or password $password did not match.");
96
+            return false;
97 97
         }
98 98
 
99 99
         // $_SESSION["status"] = "Logga ut";
Please login to merge, or discard this patch.
src/User/Functions.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
         // $user = $db->select("id, question, tags")
25 25
         //            ->from("Question")
26 26
         $user = $db->select($rows)
27
-                   ->from($table)
28
-                   ->where("acronym = ?")
29
-                   ->execute([$acronym])
30
-                   ->fetchAll();
27
+                    ->from($table)
28
+                    ->where("acronym = ?")
29
+                    ->execute([$acronym])
30
+                    ->fetchAll();
31 31
 
32 32
         // var_dump($user);
33 33
         return $user;
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
         $db = $di->get("dbqb");
50 50
         $db->connect();
51 51
         $post = $db->select($rows)
52
-                   ->from($table)
53
-                   ->where("id = ?")
54
-                   ->execute([$id])
55
-                   ->fetchAll();
52
+                    ->from($table)
53
+                    ->where("id = ?")
54
+                    ->execute([$id])
55
+                    ->fetchAll();
56 56
 
57 57
         // var_dump($post);
58 58
         return $post;
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         $db = $di->get("dbqb");
115 115
         $db->connect();
116 116
         $users = $db->select("acronym")
117
-                   ->from("User")
118
-                   ->execute()
119
-                   ->fetchAll();
117
+                    ->from("User")
118
+                    ->execute()
119
+                    ->fetchAll();
120 120
 
121 121
         return $users;
122 122
     }
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
         $db = $di->get("dbqb");
316 316
         $db->connect();
317 317
         $questions = $db->select("id, acronym, question, tags")
318
-                   ->from("Question")
319
-                   ->where("tags LIKE ?")
320
-                   ->execute(["%$res%"])
321
-                   ->fetchAll();
318
+                    ->from("Question")
319
+                    ->where("tags LIKE ?")
320
+                    ->execute(["%$res%"])
321
+                    ->fetchAll();
322 322
 
323 323
         // var_dump($questions);
324 324
         return $questions;
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
         $db = $di->get("dbqb");
338 338
         $db->connect();
339 339
         $questions = $db->select("*")
340
-                   ->from("Question")
341
-                   ->where("id = ?")
342
-                   ->execute([$res])
343
-                   ->fetchAll();
340
+                    ->from("Question")
341
+                    ->where("id = ?")
342
+                    ->execute([$res])
343
+                    ->fetchAll();
344 344
 
345 345
         // var_dump($questions);
346 346
         return $questions;
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
         $db = $di->get("dbqb");
361 361
         $db->connect();
362 362
         $res = $db->select("*")
363
-                   ->from("Comments")
364
-                   ->where("questionId = ?")
365
-                   ->execute([$questionId])
366
-                   ->fetchAll();
363
+                    ->from("Comments")
364
+                    ->where("questionId = ?")
365
+                    ->execute([$questionId])
366
+                    ->fetchAll();
367 367
 
368 368
         // var_dump($res);
369 369
         return $res;
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
         $db = $di->get("dbqb");
384 384
         $db->connect();
385 385
         $res = $db->select("*")
386
-                   ->from("Comments")
387
-                   ->where("id = ?")
388
-                   ->execute([$id])
389
-                   ->fetchAll();
386
+                    ->from("Comments")
387
+                    ->where("id = ?")
388
+                    ->execute([$id])
389
+                    ->fetchAll();
390 390
 
391 391
         return $res;
392 392
     }
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
         $db = $di->get("dbqb");
406 406
         $db->connect();
407 407
         $res = $db->select("*")
408
-                   ->from("AnswerComments")
409
-                   ->where("answerId = ?")
410
-                   ->execute([$answerId])
411
-                   ->fetchAll();
408
+                    ->from("AnswerComments")
409
+                    ->where("answerId = ?")
410
+                    ->execute([$answerId])
411
+                    ->fetchAll();
412 412
 
413 413
         // var_dump($res);
414 414
         return $res;
@@ -448,10 +448,10 @@  discard block
 block discarded – undo
448 448
         $db = $di->get("dbqb");
449 449
         $db->connect();
450 450
         $res = $db->select("answer")
451
-                   ->from("Answers")
452
-                   ->where("questionId = ?")
453
-                   ->execute([$questionId])
454
-                   ->fetch();
451
+                    ->from("Answers")
452
+                    ->where("questionId = ?")
453
+                    ->execute([$questionId])
454
+                    ->fetch();
455 455
 
456 456
         $answered = "Nej";
457 457
         if ($res ?? null) {
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
         $db = $di->get("dbqb");
475 475
         $db->connect();
476 476
         $res = $db->select("*")
477
-                   ->from("Answers")
478
-                   ->where("questionId = ?")
479
-                   ->execute([$questionId])
480
-                   ->fetchAll();
477
+                    ->from("Answers")
478
+                    ->where("questionId = ?")
479
+                    ->execute([$questionId])
480
+                    ->fetchAll();
481 481
 
482 482
         // var_dump($res);
483 483
         return $res;
@@ -514,10 +514,10 @@  discard block
 block discarded – undo
514 514
         $db = $di->get("dbqb");
515 515
         $db->connect();
516 516
         $res = $db->select("points")
517
-                   ->from($table)
518
-                   ->where("id = ?")
519
-                   ->execute([$id])
520
-                   ->fetch();
517
+                    ->from($table)
518
+                    ->where("id = ?")
519
+                    ->execute([$id])
520
+                    ->fetch();
521 521
 
522 522
         return $res;
523 523
     }
@@ -624,10 +624,10 @@  discard block
 block discarded – undo
624 624
         $db = $di->get("dbqb");
625 625
         $db->connect();
626 626
         $res = $db->select("name")
627
-                   ->from("Pictures")
628
-                   ->where("acronym = ? OR acronym = ?")
629
-                   ->execute(["default", $acronym])
630
-                   ->fetchAll();
627
+                    ->from("Pictures")
628
+                    ->where("acronym = ? OR acronym = ?")
629
+                    ->execute(["default", $acronym])
630
+                    ->fetchAll();
631 631
 
632 632
         return $res;
633 633
     }
Please login to merge, or discard this patch.
src/User/UserController.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -301,46 +301,46 @@
 block discarded – undo
301 301
             // Check if image file is a actual image or fake image
302 302
             if(isset($_POST["submit"])) {
303 303
                 var_dump("smask");
304
-             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
305
-              if($check !== false) {
304
+                $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
305
+                if($check !== false) {
306 306
                 echo "File is an image - " . $check["mime"] . ".";
307 307
                 $uploadOk = 1;
308
-              } else {
308
+                } else {
309 309
                 echo "File is not an image.";
310 310
                 $uploadOk = 0;
311
-              }
311
+                }
312 312
             }
313 313
             // Check if file already exists
314 314
             if (file_exists($target_file)) {
315
-              echo "Sorry, file already exists.";
316
-              $uploadOk = 0;
315
+                echo "Sorry, file already exists.";
316
+                $uploadOk = 0;
317 317
             }
318 318
 
319 319
             // Check file size
320 320
             if ($_FILES["fileToUpload"]["size"] > 500000) {
321
-              echo "Sorry, your file is too large.";
322
-              $uploadOk = 0;
321
+                echo "Sorry, your file is too large.";
322
+                $uploadOk = 0;
323 323
             }
324 324
 
325 325
             // Allow certain file formats
326 326
             if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
327 327
             && $imageFileType != "gif" ) {
328
-              echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
329
-              $uploadOk = 0;
328
+                echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
329
+                $uploadOk = 0;
330 330
             }
331 331
 
332 332
             // Check if $uploadOk is set to 0 by an error
333 333
             if ($uploadOk == 0) {
334
-              echo "Sorry, your file was not uploaded.";
334
+                echo "Sorry, your file was not uploaded.";
335 335
             // if everything is ok, try to upload file
336 336
             } else {
337
-              if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
337
+                if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
338 338
                 echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded.";
339 339
                 $res->setProfilePicture($this->di, $acronym, $_FILES["fileToUpload"]);
340 340
                 $res->addProfilePicture($this->di, $acronym, $_FILES["fileToUpload"]);
341
-              } else {
341
+                } else {
342 342
                 echo "Sorry, there was an error uploading your file.";
343
-              }
343
+                }
344 344
             }
345 345
         }
346 346
 
Please login to merge, or discard this patch.
src/User/User.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@
 block discarded – undo
56 56
         $db = $di->get("dbqb");
57 57
         $db->connect();
58 58
         $res = $db->select("name")
59
-                   ->from("Pictures")
60
-                   ->where("acronym = ?")
61
-                   ->execute(["default"])
62
-                   ->fetchAll();
59
+                    ->from("Pictures")
60
+                    ->where("acronym = ?")
61
+                    ->execute(["default"])
62
+                    ->fetchAll();
63 63
 
64 64
         $array = [];
65 65
         foreach ($res as $val) {
Please login to merge, or discard this patch.