@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | |
25 | 25 | <!-- Show the question --> |
26 | 26 | <div class="main-question"> |
27 | - <?php echo $filter->parse($res[0]->question, ["markdown"])->text ?> |
|
28 | - - <a href="<?= url("user/viewProfile/{$res[0]->acronym}"); ?>"><?php echo $res[0]->acronym ?></a> |
|
27 | + <?php echo $filter->parse($res[ 0 ]->question, [ "markdown" ])->text ?> |
|
28 | + - <a href="<?= url("user/viewProfile/{$res[ 0 ]->acronym}"); ?>"><?php echo $res[ 0 ]->acronym ?></a> |
|
29 | 29 | <br> |
30 | - <?php echo $res[0]->created ?> |
|
31 | - <?php if ($user == $res[0]->acronym) :?> |
|
32 | - <br><a href="../../user/editPost/<?= $res[0]->id ?>/Question"> Ändra </a> |
|
30 | + <?php echo $res[ 0 ]->created ?> |
|
31 | + <?php if ($user == $res[ 0 ]->acronym) :?> |
|
32 | + <br><a href="../../user/editPost/<?= $res[ 0 ]->id ?>/Question"> Ändra </a> |
|
33 | 33 | <?php endif; ?> |
34 | 34 | <br><br><a class="img-button" href="<?= url("user/points/Question/{$qId}/{$qId}/1"); ?>"> <?= $up ?> </a> |
35 | 35 | <a class="img-button" href="<?= url("user/points/Question/{$qId}/{$qId}/-1"); ?>"> <?= $down ?> </a> |
36 | - Poäng: <?= $res[0]->points ?> |
|
36 | + Poäng: <?= $res[ 0 ]->points ?> |
|
37 | 37 | </div> |
38 | 38 | |
39 | 39 | <!-- Show comments connected to question --> |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | <a class="img-button" href="<?= url("user/points/Comments/{$qId}/{$com->id}/-1"); ?>"> <?= $down ?> </a> |
47 | 47 | </div> |
48 | 48 | <div class="q-comments"> |
49 | - <?php echo $filter->parse($com->comment, ["markdown"])->text ?> |
|
49 | + <?php echo $filter->parse($com->comment, [ "markdown" ])->text ?> |
|
50 | 50 | - <a href="<?= url("user/viewProfile/{$com->acronym}"); ?>"><?php echo $com->acronym ?></a> |
51 | 51 | <?php echo $com->created ?> |
52 | 52 | <?php if ($user == $com->acronym) :?> |
53 | 53 | <br><br><a href="../../user/editPost/<?= $com->id ?>/Comments"> Ändra </a> |
54 | 54 | <?php endif; ?> |
55 | - <?php if ($user == $res[0]->acronym) :?> |
|
55 | + <?php if ($user == $res[ 0 ]->acronym) :?> |
|
56 | 56 | <p><a class="answer-button" href="<?= url("user/acceptAnswer/{$qId}/{$com->id}"); ?>"> Godkänn som svar </a></p> |
57 | 57 | <?php endif; ?> |
58 | 58 | </div> |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | <div class="answer"> |
69 | 69 | <h4 class="answer-h4">Svar</h4> |
70 | 70 | <!-- <?= $row->id ?><br> --> |
71 | - <?php echo $filter->parse($row->answer, ["markdown"])->text ?><br> |
|
71 | + <?php echo $filter->parse($row->answer, [ "markdown" ])->text ?><br> |
|
72 | 72 | - <a href="<?= url("user/viewProfile/{$row->acronym}"); ?>"><?php echo $row->acronym ?></a><br> |
73 | 73 | <?= $row->created ?> |
74 | 74 | <?php if ($user == $row->acronym) :?> |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | <a class="img-button" href="<?= url("user/points/AnswerComments/{$qId}/{$comment->id}/-1"); ?>"> <?= $down ?> </a> |
89 | 89 | </div> |
90 | 90 | <div class="a-comments"> |
91 | - <?php echo $filter->parse($comment->comment, ["markdown"])->text ?> |
|
91 | + <?php echo $filter->parse($comment->comment, [ "markdown" ])->text ?> |
|
92 | 92 | - <a href="<?= url("user/viewProfile/{$comment->acronym}"); ?>"><?php echo $comment->acronym ?></a> |
93 | 93 | <?= $comment->created ?><br> |
94 | 94 | <?php if ($user == $comment->acronym) :?> |
95 | 95 | <a href="../../user/editPost/<?= $comment->id ?>/AnswerComments"> Ändra </a> |
96 | 96 | <?php endif; ?> |
97 | - <!-- <?php if ($user == $res[0]->acronym) :?> |
|
97 | + <!-- <?php if ($user == $res[ 0 ]->acronym) :?> |
|
98 | 98 | <p><a class="answer-button" href="<?= url("user/acceptAnswer/{$qId}/{$comment->id}"); ?>"> Godkänn som svar </a></p> |
99 | 99 | <?php endif; ?> --> |
100 | 100 | </div> |
@@ -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; |
@@ -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, |