@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Michelf\Markdown; |
6 | 6 | |
7 | -$db = $this->di->get("db"); |
|
7 | +$db = $this->di->get("db"); |
|
8 | 8 | // Gather incoming variables and use default values if not set |
9 | 9 | $post = isset($post) ? $post : null; |
10 | 10 | $urlToUppVote = url("post/uppvote/$post->id"); |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | <div><?= Markdown::defaultTransform($post->content) ?></div> |
27 | 27 | <div> |
28 | 28 | <?php foreach ($posttags as $tag) : |
29 | - $urlToShowTag = url("tags/show/$tag->tag_name");?> |
|
29 | + $urlToShowTag = url("tags/show/$tag->tag_name"); ?> |
|
30 | 30 | <a class=onetag href="<?= $urlToShowTag ?>"><?= $tag->tag_name ?></a> |
31 | 31 | <?php endforeach; ?> |
32 | 32 | </div> |
33 | 33 | <?php foreach ($comments0 as $comment) : |
34 | 34 | $sql = "SELECT user_id FROM comments WHERE id=?;"; |
35 | - $userId = $db->executeFetchAll($sql, [$comment->id]); |
|
35 | + $userId = $db->executeFetchAll($sql, [ $comment->id ]); |
|
36 | 36 | $sql = "SELECT username FROM users WHERE id=?;"; |
37 | - $username = $db->executeFetchAll($sql, [$userId[0]->user_id]); |
|
37 | + $username = $db->executeFetchAll($sql, [ $userId[ 0 ]->user_id ]); |
|
38 | 38 | // var_dump($username);?> |
39 | 39 | <div class=comments> |
40 | 40 | |
41 | 41 | <div><?= Markdown::defaultTransform($comment->comment) ?></div> |
42 | - <div><b>Commented:</b> <?= $comment->created ?> <b>By:</b><?= $username[0]->username ?></div> |
|
42 | + <div><b>Commented:</b> <?= $comment->created ?> <b>By:</b><?= $username[ 0 ]->username ?></div> |
|
43 | 43 | |
44 | 44 | </div> |
45 | 45 | <?php endforeach; ?> |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | // get the score for each answer |
76 | 76 | |
77 | 77 | $sql = "SELECT username FROM users WHERE id=?;"; |
78 | - $username = $db->executeFetchAll($sql, [$answer->user_id]); |
|
78 | + $username = $db->executeFetchAll($sql, [ $answer->user_id ]); |
|
79 | 79 | |
80 | 80 | $sql = "SELECT sum(score) as commentscore from comment_votes where comment_id=?;"; |
81 | - $commentScore = $db->executeFetchAll($sql, [$answer->id]); |
|
81 | + $commentScore = $db->executeFetchAll($sql, [ $answer->id ]); |
|
82 | 82 | |
83 | 83 | $sql = "select * from comments where comment_reply_id=?;"; |
84 | - $replys= $db->executeFetchAll($sql, [$answer->id]); |
|
84 | + $replys = $db->executeFetchAll($sql, [ $answer->id ]); |
|
85 | 85 | |
86 | 86 | // Set the accepted button according the status of answer and owner |
87 | 87 | // var_dump($status, $answer->accepted); |
88 | 88 | if ($isOwner) { |
89 | 89 | if ($answer->accepted==0) { |
90 | - $acceptAns="check"; |
|
90 | + $acceptAns = "check"; |
|
91 | 91 | } elseif ($answer->accepted==1) { |
92 | - $acceptAns="accepted"; |
|
92 | + $acceptAns = "accepted"; |
|
93 | 93 | } |
94 | 94 | } else { |
95 | 95 | if ($answer->accepted==1) { |
96 | - $acceptAns="accepted"; |
|
96 | + $acceptAns = "accepted"; |
|
97 | 97 | } elseif ($answer->accepted==0) { |
98 | - $acceptAns="NoShowAcceptButton"; |
|
98 | + $acceptAns = "NoShowAcceptButton"; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | // if (!$commentscore) { |
@@ -103,26 +103,26 @@ discard block |
||
103 | 103 | // } else { |
104 | 104 | // $commentscore = $commentscore[0]-> commentscore; |
105 | 105 | // } |
106 | - $urlToComment =url("comment/$answer->id"); |
|
106 | + $urlToComment = url("comment/$answer->id"); |
|
107 | 107 | // var_dump($acceptAns);?> |
108 | 108 | <div class=posts> |
109 | 109 | <div class=leftpost> |
110 | 110 | <div class=arrow><a href='<?= $urlToCommentUppVote?>'><i class="fa-2x fas fa-caret-up"></i></i></a></div> |
111 | - <div class=countvotes><?= $commentScore[0]->commentscore?:0?></div> |
|
111 | + <div class=countvotes><?= $commentScore[ 0 ]->commentscore ?: 0?></div> |
|
112 | 112 | <div class=arrow><a href='<?= $urlToCommentDownVote?>'><i class="fa-2x fas fa-caret-down"></i></a></div> |
113 | 113 | <div class=<?=$acceptAns?>><a href='<?= $urlToAccept?>'><i class="fa-2x fas fa-check"></i></a></div> |
114 | 114 | </div> |
115 | 115 | <div class=rightpost> |
116 | 116 | <div><?= Markdown::defaultTransform($answer->comment) ?></div> |
117 | - <div><b>Answered</b>: <?= $answer->created ?> <b>By:</b><?= $username[0]->username?></div> |
|
117 | + <div><b>Answered</b>: <?= $answer->created ?> <b>By:</b><?= $username[ 0 ]->username?></div> |
|
118 | 118 | <?php foreach ($replys as $reply) : |
119 | 119 | $sql = "SELECT username FROM users WHERE id=?;"; |
120 | - $username = $db->executeFetchAll($sql, [$reply->user_id]); |
|
120 | + $username = $db->executeFetchAll($sql, [ $reply->user_id ]); |
|
121 | 121 | ?> |
122 | 122 | <div class=comments> |
123 | 123 | |
124 | 124 | <div><?= Markdown::defaultTransform($reply->comment) ?></div> |
125 | - <div><b>Commented:</b> <?= $reply->created ?> <b>By:</b><?= $username[0]->username ?></div> |
|
125 | + <div><b>Commented:</b> <?= $reply->created ?> <b>By:</b><?= $username[ 0 ]->username ?></div> |
|
126 | 126 | |
127 | 127 | </div> |
128 | 128 | <?php endforeach; ?> |