@@ -82,18 +82,18 @@ |
||
| 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"; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | "submit" => [ |
| 43 | 43 | "type" => "submit", |
| 44 | 44 | "value" => "Login", |
| 45 | - "callback" => [$this, "callbackSubmit"] |
|
| 45 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 46 | 46 | ], |
| 47 | 47 | ] |
| 48 | 48 | ); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $user = $db->select("password") |
| 85 | 85 | ->from("User") |
| 86 | 86 | ->where("acronym = ?") |
| 87 | - ->execute([$acronym]) |
|
| 87 | + ->execute([ $acronym ]) |
|
| 88 | 88 | ->fetch(); |
| 89 | 89 | |
| 90 | 90 | // $user is null if user is not found |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | // $_SESSION["status"] = "Logga ut"; |
| 100 | 100 | // $_SESSION["status_url"] = "user/logout"; |
| 101 | - $_SESSION["status"] = [ |
|
| 101 | + $_SESSION[ "status" ] = [ |
|
| 102 | 102 | "text" => "Profil", |
| 103 | 103 | "url" => "user/profile", |
| 104 | 104 | "title" => "Profil", |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ], |
| 113 | 113 | ], |
| 114 | 114 | ]; |
| 115 | - $_SESSION["acronym"] = $acronym; |
|
| 115 | + $_SESSION[ "acronym" ] = $acronym; |
|
| 116 | 116 | // $this->form->addOutput("User logged in."); |
| 117 | 117 | return true; |
| 118 | 118 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | // "description" => "Here you can place a description.", |
| 31 | 31 | "placeholder" => "Sök", |
| 32 | 32 | "label" => "Sök", |
| 33 | - "callback" => [$this, "callbackSubmit"], |
|
| 33 | + "callback" => [ $this, "callbackSubmit" ], |
|
| 34 | 34 | ] |
| 35 | 35 | ] |
| 36 | 36 | ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | ], |
| 33 | 33 | "submit" => [ |
| 34 | 34 | "type" => "submit", |
| 35 | - "callback" => [$this, "callbackSubmit"], |
|
| 35 | + "callback" => [ $this, "callbackSubmit" ], |
|
| 36 | 36 | ], |
| 37 | 37 | ] |
| 38 | 38 | ); |
@@ -24,10 +24,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $user = $db->select($rows) |
| 27 | 27 | ->from($table) |
| 28 | 28 | ->where("acronym = ?")
|
| 29 | - ->execute([$acronym]) |
|
| 29 | + ->execute([ $acronym ]) |
|
| 30 | 30 | ->fetchAll(); |
| 31 | 31 | |
| 32 | 32 | // var_dump($user); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $post = $db->select($rows) |
| 52 | 52 | ->from($table) |
| 53 | 53 | ->where("id = ?")
|
| 54 | - ->execute([$id]) |
|
| 54 | + ->execute([ $id ]) |
|
| 55 | 55 | ->fetchAll(); |
| 56 | 56 | |
| 57 | 57 | // var_dump($post); |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | {
|
| 75 | 75 | $db = $di->get("dbqb");
|
| 76 | 76 | $db->connect() |
| 77 | - ->update($table, [$rows]) |
|
| 77 | + ->update($table, [ $rows ]) |
|
| 78 | 78 | ->where("id = ?")
|
| 79 | - ->execute([$res, $id]); |
|
| 79 | + ->execute([ $res, $id ]); |
|
| 80 | 80 | |
| 81 | 81 | return "Saved"; |
| 82 | 82 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $db = $di->get("dbqb");
|
| 97 | 97 | $db->connect(); |
| 98 | 98 | $sql = "DELETE FROM $table WHERE id = ?;"; |
| 99 | - $db->execute($sql, [$id]); |
|
| 99 | + $db->execute($sql, [ $id ]); |
|
| 100 | 100 | return "Deleted"; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $db = $di->get("dbqb");
|
| 116 | 116 | $db->connect(); |
| 117 | 117 | $sql = "DELETE FROM $table WHERE questionId = ?;"; |
| 118 | - $db->execute($sql, [$id]); |
|
| 118 | + $db->execute($sql, [ $id ]); |
|
| 119 | 119 | |
| 120 | 120 | return "Deleted"; |
| 121 | 121 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $db = $di->get("dbqb");
|
| 136 | 136 | $db->connect(); |
| 137 | 137 | $sql = "DELETE FROM AnswerComments WHERE answerId = ?;"; |
| 138 | - $db->execute($sql, [$id]); |
|
| 138 | + $db->execute($sql, [ $id ]); |
|
| 139 | 139 | |
| 140 | 140 | return "Deleted"; |
| 141 | 141 | } |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | public function getUserStatus($di, $users) |
| 175 | 175 | {
|
| 176 | 176 | // get all answers made by $acronym |
| 177 | - $answers = []; |
|
| 177 | + $answers = [ ]; |
|
| 178 | 178 | foreach ($users as $acronym) {
|
| 179 | 179 | $db = $di->get("dbqb");
|
| 180 | 180 | $db->connect(); |
| 181 | 181 | $answers = $db->select("answer")
|
| 182 | 182 | ->from("Answers")
|
| 183 | 183 | ->where("acronym = ?")
|
| 184 | - ->execute([$acronym]) |
|
| 184 | + ->execute([ $acronym ]) |
|
| 185 | 185 | ->fetchAll(); |
| 186 | 186 | } |
| 187 | 187 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $questions = $db->select("*")
|
| 226 | 226 | ->from("Question")
|
| 227 | 227 | ->where("tags LIKE ?")
|
| 228 | - ->execute(["%$tag%"]) |
|
| 228 | + ->execute([ "%$tag%" ]) |
|
| 229 | 229 | ->fetchAll(); |
| 230 | 230 | |
| 231 | 231 | return $questions; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public function getTagsOnce($tagsArray) |
| 287 | 287 | {
|
| 288 | - $tags = []; |
|
| 288 | + $tags = [ ]; |
|
| 289 | 289 | foreach ($tagsArray as $val) {
|
| 290 | 290 | if (!in_array($val, $tags)) {
|
| 291 | 291 | array_push($tags, $val); |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | public function countTagsFrequency($tagsArray) |
| 307 | 307 | {
|
| 308 | 308 | // var_dump($tagsArray); |
| 309 | - $tags = []; |
|
| 309 | + $tags = [ ]; |
|
| 310 | 310 | foreach ($tagsArray as $val) {
|
| 311 | 311 | if (!array_key_exists($val, $tags)) {
|
| 312 | - $tags[$val] = 0; |
|
| 312 | + $tags[ $val ] = 0; |
|
| 313 | 313 | } |
| 314 | - $tags[$val] += 1; |
|
| 314 | + $tags[ $val ] += 1; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | return $tags; |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $questions = $db->select("id, acronym, question, tags")
|
| 358 | 358 | ->from("Question")
|
| 359 | 359 | ->where("tags LIKE ?")
|
| 360 | - ->execute(["%$res%"]) |
|
| 360 | + ->execute([ "%$res%" ]) |
|
| 361 | 361 | ->fetchAll(); |
| 362 | 362 | |
| 363 | 363 | // var_dump($questions); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $questions = $db->select("*")
|
| 380 | 380 | ->from("Question")
|
| 381 | 381 | ->where("id = ?")
|
| 382 | - ->execute([$res]) |
|
| 382 | + ->execute([ $res ]) |
|
| 383 | 383 | ->fetchAll(); |
| 384 | 384 | |
| 385 | 385 | // var_dump($questions); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $res = $db->select("*")
|
| 403 | 403 | ->from("Comments")
|
| 404 | 404 | ->where("questionId = ?")
|
| 405 | - ->execute([$questionId]) |
|
| 405 | + ->execute([ $questionId ]) |
|
| 406 | 406 | ->fetchAll(); |
| 407 | 407 | |
| 408 | 408 | // var_dump($res); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $res = $db->select("*")
|
| 426 | 426 | ->from("Comments")
|
| 427 | 427 | ->where("id = ?")
|
| 428 | - ->execute([$id]) |
|
| 428 | + ->execute([ $id ]) |
|
| 429 | 429 | ->fetchAll(); |
| 430 | 430 | |
| 431 | 431 | return $res; |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $res = $db->select("*")
|
| 448 | 448 | ->from("AnswerComments")
|
| 449 | 449 | ->where("answerId = ?")
|
| 450 | - ->execute([$answerId]) |
|
| 450 | + ->execute([ $answerId ]) |
|
| 451 | 451 | ->fetchAll(); |
| 452 | 452 | |
| 453 | 453 | // var_dump($res); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $db = $di->get("dbqb");
|
| 470 | 470 | $db->connect(); |
| 471 | 471 | $sql = "SELECT * FROM Answers WHERE questionId = ? ORDER BY $column;"; |
| 472 | - $res = $db->executeFetchAll($sql, [$questionId]); |
|
| 472 | + $res = $db->executeFetchAll($sql, [ $questionId ]); |
|
| 473 | 473 | |
| 474 | 474 | return $res; |
| 475 | 475 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $res = $db->select("answer")
|
| 491 | 491 | ->from("Answers")
|
| 492 | 492 | ->where("questionId = ?")
|
| 493 | - ->execute([$questionId]) |
|
| 493 | + ->execute([ $questionId ]) |
|
| 494 | 494 | ->fetch(); |
| 495 | 495 | |
| 496 | 496 | $answered = "Nej"; |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | $res = $db->select("*")
|
| 517 | 517 | ->from("Answers")
|
| 518 | 518 | ->where("questionId = ?")
|
| 519 | - ->execute([$questionId]) |
|
| 519 | + ->execute([ $questionId ]) |
|
| 520 | 520 | ->fetchAll(); |
| 521 | 521 | |
| 522 | 522 | // var_dump($res); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | */ |
| 534 | 534 | public function userCheck($acronym) |
| 535 | 535 | {
|
| 536 | - $user = $_SESSION["acronym"]; |
|
| 536 | + $user = $_SESSION[ "acronym" ]; |
|
| 537 | 537 | if ($user == $acronym) {
|
| 538 | 538 | return true; |
| 539 | 539 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | $res = $db->select("points")
|
| 557 | 557 | ->from($table) |
| 558 | 558 | ->where("id = ?")
|
| 559 | - ->execute([$id]) |
|
| 559 | + ->execute([ $id ]) |
|
| 560 | 560 | ->fetch(); |
| 561 | 561 | |
| 562 | 562 | return $res; |
@@ -578,9 +578,9 @@ discard block |
||
| 578 | 578 | // var_dump($points); |
| 579 | 579 | $db = $di->get("dbqb");
|
| 580 | 580 | $db->connect() |
| 581 | - ->update($table, ["points"]) |
|
| 581 | + ->update($table, [ "points" ]) |
|
| 582 | 582 | ->where("id = ?")
|
| 583 | - ->execute([$points, $id]); |
|
| 583 | + ->execute([ $points, $id ]); |
|
| 584 | 584 | |
| 585 | 585 | return "Saved"; |
| 586 | 586 | } |
@@ -600,9 +600,9 @@ discard block |
||
| 600 | 600 | // var_dump($points); |
| 601 | 601 | $db = $di->get("dbqb");
|
| 602 | 602 | $db->connect() |
| 603 | - ->update("User", ["picture"])
|
|
| 603 | + ->update("User", [ "picture" ])
|
|
| 604 | 604 | ->where("acronym = ?")
|
| 605 | - ->execute([$picture, $acronym]); |
|
| 605 | + ->execute([ $picture, $acronym ]); |
|
| 606 | 606 | |
| 607 | 607 | return "Saved"; |
| 608 | 608 | } |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | {
|
| 622 | 622 | $db = $di->get("dbqb");
|
| 623 | 623 | $db->connect() |
| 624 | - ->update("User", ["info"])
|
|
| 624 | + ->update("User", [ "info" ])
|
|
| 625 | 625 | ->where("acronym = ?")
|
| 626 | - ->execute([$info, $acronym]); |
|
| 626 | + ->execute([ $info, $acronym ]); |
|
| 627 | 627 | |
| 628 | 628 | return "Saved"; |
| 629 | 629 | } |
@@ -643,8 +643,8 @@ discard block |
||
| 643 | 643 | // var_dump($points); |
| 644 | 644 | $db = $di->get("dbqb");
|
| 645 | 645 | $db->connect() |
| 646 | - ->insert("Pictures", ["acronym", "name"])
|
|
| 647 | - ->execute([$acronym, $name]); |
|
| 646 | + ->insert("Pictures", [ "acronym", "name" ])
|
|
| 647 | + ->execute([ $acronym, $name ]); |
|
| 648 | 648 | |
| 649 | 649 | return "Saved"; |
| 650 | 650 | } |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | $res = $db->select("name")
|
| 667 | 667 | ->from("Pictures")
|
| 668 | 668 | ->where("acronym = ? OR acronym = ?")
|
| 669 | - ->execute(["default", $acronym]) |
|
| 669 | + ->execute([ "default", $acronym ]) |
|
| 670 | 670 | ->fetchAll(); |
| 671 | 671 | |
| 672 | 672 | return $res; |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $db = $di->get("dbqb");
|
| 691 | 691 | $db->connect() |
| 692 | - ->insert("Answers", ["questionId", "acronym", "answer", "points", "created"])
|
|
| 693 | - ->execute([$questionId, $acronym, $answer, $points, $created]); |
|
| 692 | + ->insert("Answers", [ "questionId", "acronym", "answer", "points", "created" ])
|
|
| 693 | + ->execute([ $questionId, $acronym, $answer, $points, $created ]); |
|
| 694 | 694 | |
| 695 | 695 | return "Saved"; |
| 696 | 696 | } |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $db = $di->get("dbqb");
|
| 710 | 710 | $db->connect(); |
| 711 | 711 | $sql = "DELETE FROM Comments WHERE id = ?;"; |
| 712 | - $db->execute($sql, [$id]); |
|
| 712 | + $db->execute($sql, [ $id ]); |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | |
@@ -721,9 +721,9 @@ discard block |
||
| 721 | 721 | */ |
| 722 | 722 | function sessionDestroy() |
| 723 | 723 | {
|
| 724 | - $style = $_SESSION['AnaxStyleChooser'] ?? "css/mine.css"; |
|
| 724 | + $style = $_SESSION[ 'AnaxStyleChooser' ] ?? "css/mine.css"; |
|
| 725 | 725 | // Unset all of the session variables. |
| 726 | - $_SESSION = []; |
|
| 726 | + $_SESSION = [ ]; |
|
| 727 | 727 | |
| 728 | 728 | // If it's desired to kill the session, also delete the session cookie. |
| 729 | 729 | // Note: This will destroy the session, and not just the session data! |
@@ -733,17 +733,17 @@ discard block |
||
| 733 | 733 | session_name(), |
| 734 | 734 | '', |
| 735 | 735 | time() - 42000, |
| 736 | - $params["path"], |
|
| 737 | - $params["domain"], |
|
| 738 | - $params["secure"], |
|
| 739 | - $params["httponly"] |
|
| 736 | + $params[ "path" ], |
|
| 737 | + $params[ "domain" ], |
|
| 738 | + $params[ "secure" ], |
|
| 739 | + $params[ "httponly" ] |
|
| 740 | 740 | ); |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | // Finally, destroy the session. |
| 744 | 744 | session_destroy(); |
| 745 | 745 | |
| 746 | - $_SESSION['AnaxStyleChooser'] = $style; |
|
| 746 | + $_SESSION[ 'AnaxStyleChooser' ] = $style; |
|
| 747 | 747 | |
| 748 | 748 | // $_SESSION["status"] = null; |
| 749 | 749 | // $_SESSION["acronym"] = null; |
@@ -301,46 +301,46 @@ |
||
| 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 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // var_dump($page); |
| 51 | 51 | $route = $request->getRoute(); |
| 52 | 52 | // var_dump($route); |
| 53 | - $acronym = $_SESSION["acronym"] ?? null; |
|
| 53 | + $acronym = $_SESSION[ "acronym" ] ?? null; |
|
| 54 | 54 | // var_dump($_SESSION); |
| 55 | 55 | |
| 56 | 56 | if ($route == "user/login" || $route == "user/create") { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // var_dump($_SESSION); |
| 138 | 138 | |
| 139 | - if ($_SESSION["acronym"] ?? null) { |
|
| 139 | + if ($_SESSION[ "acronym" ] ?? null) { |
|
| 140 | 140 | $response = $this->di->get("response"); |
| 141 | 141 | return $response->redirect("user/questions"); |
| 142 | 142 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | "content" => "<img src='../../htdocs/image/garden2.jpg' width='1000px'></img>", |
| 154 | 154 | ]; |
| 155 | 155 | |
| 156 | - $page->add("login-side", [], "sidebar-right"); |
|
| 156 | + $page->add("login-side", [ ], "sidebar-right"); |
|
| 157 | 157 | $page->add("anax/v2/article/default", $pic, "flash"); |
| 158 | 158 | |
| 159 | 159 | return $page->render([ |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $request = $this->di->get("request"); |
| 178 | 178 | |
| 179 | 179 | $res = new Functions(); |
| 180 | - $acronym = $_SESSION["acronym"]; |
|
| 180 | + $acronym = $_SESSION[ "acronym" ]; |
|
| 181 | 181 | $rows = "id, question, tags"; |
| 182 | 182 | $questions = $res->getProfileInfo($acronym, $this->di, "Question", $rows); |
| 183 | 183 | $rows2 = "id, questionId, answer"; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $user = $res->getProfileInfo($acronym, $this->di, "User", $rows4); |
| 189 | 189 | // var_dump($comments); |
| 190 | 190 | |
| 191 | - $form = new FormElementFile("img", ["image/*"]); |
|
| 191 | + $form = new FormElementFile("img", [ "image/*" ]); |
|
| 192 | 192 | $baseURL = $request->getBaseUrl(); |
| 193 | 193 | // var_dump($baseURL); |
| 194 | 194 | |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | $user = $res->getProfileInfo($acronym, $this->di, "User", $rows); |
| 239 | 239 | $pictures = $res->getAllProfilePictures($this->di, $acronym); |
| 240 | 240 | |
| 241 | - $info = $_POST["info"] ?? null; |
|
| 242 | - $picture = $_POST["picture"] ?? null; |
|
| 241 | + $info = $_POST[ "info" ] ?? null; |
|
| 242 | + $picture = $_POST[ "picture" ] ?? null; |
|
| 243 | 243 | if ($info) { |
| 244 | 244 | var_dump($info); |
| 245 | 245 | $res->setProfileInfo($this->di, $acronym, $info); |
@@ -295,15 +295,15 @@ discard block |
||
| 295 | 295 | if ($post) { |
| 296 | 296 | // $res->setProfilePicture($this->di, $acronym, $post); |
| 297 | 297 | $target_dir = "C:/cygwin64/home/Lichn/dbwebb-kurser/ramverk1/me/kmom10/module/htdocs/img/profile/"; |
| 298 | - $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); |
|
| 298 | + $target_file = $target_dir . basename($_FILES[ "fileToUpload" ][ "name" ]); |
|
| 299 | 299 | $uploadOk = 1; |
| 300 | - $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); |
|
| 300 | + $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); |
|
| 301 | 301 | // Check if image file is a actual image or fake image |
| 302 | - if(isset($_POST["submit"])) { |
|
| 302 | + if (isset($_POST[ "submit" ])) { |
|
| 303 | 303 | var_dump("smask"); |
| 304 | - $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); |
|
| 305 | - if($check !== false) { |
|
| 306 | - echo "File is an image - " . $check["mime"] . "."; |
|
| 304 | + $check = getimagesize($_FILES[ "fileToUpload" ][ "tmp_name" ]); |
|
| 305 | + if ($check !== false) { |
|
| 306 | + echo "File is an image - " . $check[ "mime" ] . "."; |
|
| 307 | 307 | $uploadOk = 1; |
| 308 | 308 | } else { |
| 309 | 309 | echo "File is not an image."; |
@@ -317,14 +317,14 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | // Check file size |
| 320 | - if ($_FILES["fileToUpload"]["size"] > 500000) { |
|
| 320 | + if ($_FILES[ "fileToUpload" ][ "size" ] > 500000) { |
|
| 321 | 321 | echo "Sorry, your file is too large."; |
| 322 | 322 | $uploadOk = 0; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Allow certain file formats |
| 326 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 327 | - && $imageFileType != "gif" ) { |
|
| 326 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 327 | + && $imageFileType != "gif") { |
|
| 328 | 328 | echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; |
| 329 | 329 | $uploadOk = 0; |
| 330 | 330 | } |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 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)) { |
|
| 338 | - echo "The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded."; |
|
| 339 | - $res->setProfilePicture($this->di, $acronym, $_FILES["fileToUpload"]); |
|
| 340 | - $res->addProfilePicture($this->di, $acronym, $_FILES["fileToUpload"]); |
|
| 337 | + if (move_uploaded_file($_FILES[ "fileToUpload" ][ "tmp_name" ], $target_file)) { |
|
| 338 | + echo "The file " . htmlspecialchars(basename($_FILES[ "fileToUpload" ][ "name" ])) . " has been uploaded."; |
|
| 339 | + $res->setProfilePicture($this->di, $acronym, $_FILES[ "fileToUpload" ]); |
|
| 340 | + $res->addProfilePicture($this->di, $acronym, $_FILES[ "fileToUpload" ]); |
|
| 341 | 341 | } else { |
| 342 | 342 | echo "Sorry, there was an error uploading your file."; |
| 343 | 343 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | { |
| 418 | 418 | $page = $this->di->get("page"); |
| 419 | 419 | // $acronym = $_SESSION["acronym"]; |
| 420 | - $acronym = $_SESSION["acronym"]; |
|
| 420 | + $acronym = $_SESSION[ "acronym" ]; |
|
| 421 | 421 | // var_dump($_SESSION); |
| 422 | 422 | $form = new CreateQuestionForm($this->di, $acronym); |
| 423 | 423 | $form->check(); |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | // "content" => "<img src='../../htdocs/image/car.png' width='1000px'></img>", |
| 435 | 435 | // ]; |
| 436 | 436 | |
| 437 | - $page->add("ask-tip", [], "sidebar-right"); |
|
| 438 | - $page->add("ask-tag", [], "sidebar-right"); |
|
| 437 | + $page->add("ask-tip", [ ], "sidebar-right"); |
|
| 438 | + $page->add("ask-tag", [ ], "sidebar-right"); |
|
| 439 | 439 | // $page->add("anax/v2/article/default", $pic, "flash"); |
| 440 | 440 | |
| 441 | 441 | return $page->render([ |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // Get list of all users. |
| 520 | 520 | $users = $res->getAllUsers($this->di); |
| 521 | - $sums = []; |
|
| 521 | + $sums = [ ]; |
|
| 522 | 522 | foreach ($users as $user) { |
| 523 | 523 | $acronym = $user->acronym; |
| 524 | 524 | // get all questions made by user |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | // get all answers made by user |
| 529 | 529 | $ans = $res->getProfileInfo($acronym, $this->di, "Answers", "answer"); |
| 530 | 530 | // sum up everything |
| 531 | - $sums[$acronym] = sizeof($quests) + sizeof($com) + sizeof($ans); |
|
| 531 | + $sums[ $acronym ] = sizeof($quests) + sizeof($com) + sizeof($ans); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | arsort($sums); |
@@ -631,9 +631,9 @@ discard block |
||
| 631 | 631 | $comment = $res->getOneQuestionComment($this->di, $commentId); |
| 632 | 632 | var_dump($comment); |
| 633 | 633 | |
| 634 | - $acronym = $comment[0]->acronym; |
|
| 635 | - $answer = $comment[0]->comment; |
|
| 636 | - $created = $comment[0]->created; |
|
| 634 | + $acronym = $comment[ 0 ]->acronym; |
|
| 635 | + $answer = $comment[ 0 ]->comment; |
|
| 636 | + $created = $comment[ 0 ]->created; |
|
| 637 | 637 | |
| 638 | 638 | // Save as answer. |
| 639 | 639 | $res->saveAnswer($this->di, $questionId, $acronym, $answer, $created); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | // Delete comment. |
| 642 | 642 | $res->deleteComment($this->di, $commentId); |
| 643 | 643 | |
| 644 | - var_dump($comment[0]->comment); |
|
| 644 | + var_dump($comment[ 0 ]->comment); |
|
| 645 | 645 | |
| 646 | 646 | // $page->add("anax/v2/article/default", [ |
| 647 | 647 | // "content" => "Hello", |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | // get profile picture of the user who made a question |
| 693 | 693 | $picture = $res->getProfileInfo($acronym, $this->di, "User", "picture"); |
| 694 | 694 | |
| 695 | - $question->picture = "<img src='{$baseURL}/image/profile/{$picture[0]->picture}{$size}'></img>"; |
|
| 695 | + $question->picture = "<img src='{$baseURL}/image/profile/{$picture[ 0 ]->picture}{$size}'></img>"; |
|
| 696 | 696 | // get all answers |
| 697 | 697 | $question->answers = $res->getQuestionAnswers($this->di, $questionId); |
| 698 | 698 | } |
@@ -705,9 +705,9 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | // get variables from posted checkbox form |
| 707 | 707 | $items = $request->getPost(); |
| 708 | - if ($items["items"] ?? null) { |
|
| 708 | + if ($items[ "items" ] ?? null) { |
|
| 709 | 709 | // visa endast info gällande de ikryssade taggarna |
| 710 | - foreach ($items["items"] as $val) { |
|
| 710 | + foreach ($items[ "items" ] as $val) { |
|
| 711 | 711 | // var_dump($val); |
| 712 | 712 | $questions = $res->getSomeQuestionsTags($this->di, $val); |
| 713 | 713 | // var_dump($questions); |
@@ -778,9 +778,9 @@ discard block |
||
| 778 | 778 | // var_dump($answers); |
| 779 | 779 | |
| 780 | 780 | // var_dump($comments); |
| 781 | - $qId = $question[0]->id; |
|
| 781 | + $qId = $question[ 0 ]->id; |
|
| 782 | 782 | // var_dump($qId); |
| 783 | - $acronym = $_SESSION["acronym"]; |
|
| 783 | + $acronym = $_SESSION[ "acronym" ]; |
|
| 784 | 784 | // var_dump($acronym); |
| 785 | 785 | |
| 786 | 786 | $form = new CreateCommentsForm($this->di, $acronym, $qId); |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | $up = "<img src='../../../htdocs/image/up.png' width='30px'></img>"; |
| 796 | 796 | $down = "<img src='../../../htdocs/image/down.png' width='30px'></img>"; |
| 797 | 797 | |
| 798 | - $user = $_SESSION["acronym"]; |
|
| 798 | + $user = $_SESSION[ "acronym" ]; |
|
| 799 | 799 | |
| 800 | 800 | $page->add("view-question", [ |
| 801 | 801 | "res" => $question, |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | "qId" => $id, |
| 813 | 813 | ]); |
| 814 | 814 | |
| 815 | - $tags = $question[0]->tags ?? "Grönsaker, Plantor"; |
|
| 815 | + $tags = $question[ 0 ]->tags ?? "Grönsaker, Plantor"; |
|
| 816 | 816 | $tagsArray = explode("; ", $tags); |
| 817 | 817 | |
| 818 | 818 | $page->add("show-tags", [ |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | "content" => $content, |
| 832 | 832 | ], "sidebar-right"); |
| 833 | 833 | |
| 834 | - $page->add("ask-tip", [], "sidebar-right"); |
|
| 834 | + $page->add("ask-tip", [ ], "sidebar-right"); |
|
| 835 | 835 | |
| 836 | 836 | return $page->render([ |
| 837 | 837 | "title" => "View question", |
@@ -951,14 +951,14 @@ discard block |
||
| 951 | 951 | // get profile picture of the user who made a question |
| 952 | 952 | $picture = $res->getProfileInfo($acronym, $this->di, "User", "picture"); |
| 953 | 953 | |
| 954 | - $question->picture = "<img src='{$baseURL}/image/profile/{$picture[0]->picture}{$size}'></img>"; |
|
| 954 | + $question->picture = "<img src='{$baseURL}/image/profile/{$picture[ 0 ]->picture}{$size}'></img>"; |
|
| 955 | 955 | // get all answers |
| 956 | 956 | $question->answers = $res->getQuestionAnswers($this->di, $questionId); |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | 959 | $filter = new \Anax\TextFilter\TextFilter(); |
| 960 | 960 | |
| 961 | - $user = $_SESSION["acronym"]; |
|
| 961 | + $user = $_SESSION[ "acronym" ]; |
|
| 962 | 962 | |
| 963 | 963 | $page->add("view-tag-questions", [ |
| 964 | 964 | "questions" => $questions, |
@@ -51,8 +51,8 @@ |
||
| 51 | 51 | // ->fetchAll(); |
| 52 | 52 | // var_dump($user) |
| 53 | 53 | $db->connect() |
| 54 | - ->insert("Question", ["acronym", "question", "tags", "points", "created"]) |
|
| 55 | - ->execute([$this->acronym, $this->question, $this->tags, $this->points, $this->created]); |
|
| 54 | + ->insert("Question", [ "acronym", "question", "tags", "points", "created" ]) |
|
| 55 | + ->execute([ $this->acronym, $this->question, $this->tags, $this->points, $this->created ]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $db = $di->get("dbqb"); |
| 48 | 48 | $db->connect() |
| 49 | - ->insert("Comments", ["questionId", "acronym", "comment", "points", "created"]) |
|
| 50 | - ->execute([$this->questionId, $this->acronym, $this->comment, $this->points, $this->created]); |
|
| 49 | + ->insert("Comments", [ "questionId", "acronym", "comment", "points", "created" ]) |
|
| 50 | + ->execute([ $this->questionId, $this->acronym, $this->comment, $this->points, $this->created ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $db = $di->get("dbqb"); |
| 64 | 64 | $db->connect() |
| 65 | - ->insert("AnswerComments", ["answerId", "acronym", "comment", "points", "created"]) |
|
| 66 | - ->execute([$this->answerId, $this->acronym, $this->comment, $this->points, $this->created]); |
|
| 65 | + ->insert("AnswerComments", [ "answerId", "acronym", "comment", "points", "created" ]) |
|
| 66 | + ->execute([ $this->answerId, $this->acronym, $this->comment, $this->points, $this->created ]); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -56,10 +56,10 @@ |
||
| 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) { |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | $res = $db->select("name") |
| 59 | 59 | ->from("Pictures") |
| 60 | 60 | ->where("acronym = ?") |
| 61 | - ->execute(["default"]) |
|
| 61 | + ->execute([ "default" ]) |
|
| 62 | 62 | ->fetchAll(); |
| 63 | 63 | |
| 64 | - $array = []; |
|
| 64 | + $array = [ ]; |
|
| 65 | 65 | foreach ($res as $val) { |
| 66 | 66 | // var_dump($val->name); |
| 67 | 67 | array_push($array, $val->name); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $pic = array_rand($array, 1); |
| 72 | 72 | // var_dump($array[$pic]); |
| 73 | - $this->picture = $array[$pic]; |
|
| 73 | + $this->picture = $array[ $pic ]; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $db = $di->get("dbqb"); |
| 106 | 106 | $db->connect() |
| 107 | - ->insert("User", ["acronym", "password", "picture", "points", "created"]) |
|
| 108 | - ->execute([$this->acronym, $this->password, $this->picture, $this->points, $this->created]); |
|
| 107 | + ->insert("User", [ "acronym", "password", "picture", "points", "created" ]) |
|
| 108 | + ->execute([ $this->acronym, $this->password, $this->picture, $this->points, $this->created ]); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | "submit" => [ |
| 52 | 52 | "type" => "submit", |
| 53 | 53 | "value" => "Ställ fråga", |
| 54 | - "callback" => [$this, "callbackSubmit"] |
|
| 54 | + "callback" => [ $this, "callbackSubmit" ] |
|
| 55 | 55 | ], |
| 56 | 56 | ] |
| 57 | 57 | ); |