@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | class User extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "User"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $username; |
20 | 20 | public $password; |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | * A database driven model. |
28 | 28 | */ |
29 | 29 | /** |
30 | - * Set the password. |
|
31 | - * |
|
32 | - * @param string $password the password to use. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
30 | + * Set the password. |
|
31 | + * |
|
32 | + * @param string $password the password to use. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | 36 | public function setPassword($password) |
37 | 37 | { |
38 | 38 | $this->password = password_hash($password, PASSWORD_DEFAULT); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Verify the acronym and the password, if successful the object contains |
|
43 | - * all details from the database row. |
|
44 | - * |
|
45 | - * @param string $acronym acronym to check. |
|
46 | - * @param string $password the password to use. |
|
47 | - * |
|
48 | - * @return boolean true if acronym and password matches, else false. |
|
49 | - */ |
|
42 | + * Verify the acronym and the password, if successful the object contains |
|
43 | + * all details from the database row. |
|
44 | + * |
|
45 | + * @param string $acronym acronym to check. |
|
46 | + * @param string $password the password to use. |
|
47 | + * |
|
48 | + * @return boolean true if acronym and password matches, else false. |
|
49 | + */ |
|
50 | 50 | public function verifyPassword($username, $password) |
51 | 51 | { |
52 | 52 | $this->find("username", $username); |
@@ -22,7 +22,6 @@ |
||
22 | 22 | * @param string $message with details. |
23 | 23 | * |
24 | 24 | * @throws Anax\Route\Exception\NotFoundException |
25 | - |
|
26 | 25 | * @return object as the response. |
27 | 26 | */ |
28 | 27 | public function catchAll() : object |
@@ -21,7 +21,6 @@ |
||
21 | 21 | * @param array $args as a variadic to catch all arguments. |
22 | 22 | * |
23 | 23 | * @throws Anax\Route\Exception\NotFoundException when route is not found. |
24 | - |
|
25 | 24 | * @return object as the response. |
26 | 25 | * |
27 | 26 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class Forum extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "Forum"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $title; |
20 | 20 | public $content; |
@@ -40,9 +40,12 @@ |
||
40 | 40 | <p> |
41 | 41 | <a href="../answer/<?= $item->id ?>">Answer this post</a> |
42 | 42 | </p> |
43 | - <?php else : ?> |
|
43 | + <?php else { |
|
44 | + : ?> |
|
44 | 45 | <p>You have to be logged in to answer on a post!</p> |
45 | - <?php endif; ?> |
|
46 | + <?php endif; |
|
47 | +} |
|
48 | +?> |
|
46 | 49 | <h2>Comments: </h2> |
47 | 50 | <?php foreach ($comments as $comment) : ?> |
48 | 51 | <div class="comments"> |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class Answer extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "Svar"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $questionId; |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class Comment extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "Comment"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $questionId; |
@@ -6,15 +6,15 @@ |
||
6 | 6 | class AnswerComment extends ActiveRecordModel |
7 | 7 | { |
8 | 8 | /** |
9 | - * @var string $tableName name of the database table. |
|
10 | - */ |
|
9 | + * @var string $tableName name of the database table. |
|
10 | + */ |
|
11 | 11 | protected $tableName = "AnswerComment"; |
12 | 12 | |
13 | 13 | /** |
14 | - * Columns in the table. |
|
15 | - * |
|
16 | - * @var integer $id primary key auto incremented. |
|
17 | - */ |
|
14 | + * Columns in the table. |
|
15 | + * |
|
16 | + * @var integer $id primary key auto incremented. |
|
17 | + */ |
|
18 | 18 | public $id; |
19 | 19 | public $content; |
20 | 20 | public $answerId; |
@@ -27,40 +27,52 @@ |
||
27 | 27 | <h3>Questions you have asked: </h3> |
28 | 28 | <?php if (empty($posts)) : ?> |
29 | 29 | <p>You have not made any posts yet.</p> |
30 | -<?php else : ?> |
|
30 | +<?php else { |
|
31 | + : ?> |
|
31 | 32 | <?php foreach ($posts as $post) : ?> |
32 | 33 | <p> |
33 | 34 | <a href="forum/question/<?= $post->id ?>"><?= $post->title ?></a> |
34 | 35 | </p> |
35 | - <?php endforeach; ?> |
|
36 | + <?php endforeach; |
|
37 | +} |
|
38 | +?> |
|
36 | 39 | <?php endif; ?> |
37 | 40 | <h3>Answers you have posted: </h3> |
38 | 41 | <?php if (empty($answers)) : ?> |
39 | 42 | <p>You have not posted any answers yet.</p> |
40 | -<?php else : ?> |
|
43 | +<?php else { |
|
44 | + : ?> |
|
41 | 45 | <?php foreach ($answers as $answer) : ?> |
42 | 46 | <p> |
43 | 47 | <a href="forum/question/<?= $answer->questionId ?>"><?= $answer->content ?></a> |
44 | 48 | </p> |
45 | - <?php endforeach; ?> |
|
49 | + <?php endforeach; |
|
50 | +} |
|
51 | +?> |
|
46 | 52 | <?php endif; ?> |
47 | 53 | <h3>Comments you have posted: </h3> |
48 | 54 | <?php if (empty($comments)) : ?> |
49 | 55 | <p>You have not posted any comments yet.</p> |
50 | -<?php else : ?> |
|
56 | +<?php else { |
|
57 | + : ?> |
|
51 | 58 | <?php foreach ($comments as $comment) : ?> |
52 | 59 | <p> |
53 | 60 | <a href="forum/question/<?= $answer->questionId ?>"><?= $comment->content ?></a> |
54 | 61 | </p> |
55 | - <?php endforeach; ?> |
|
62 | + <?php endforeach; |
|
63 | +} |
|
64 | +?> |
|
56 | 65 | <?php endif; ?> |
57 | 66 | <h3>Comments on answers you have posted: </h3> |
58 | 67 | <?php if (empty($anscomments)) : ?> |
59 | 68 | <p>You have not made any comments on answers yet.</p> |
60 | -<?php else : ?> |
|
69 | +<?php else { |
|
70 | + : ?> |
|
61 | 71 | <?php foreach ($anscomments as $anscomment) : ?> |
62 | 72 | <p> |
63 | 73 | <a href="forum/question/<?= $answer->questionId ?>"><?= $anscomment->content ?></a> |
64 | 74 | </p> |
65 | - <?php endforeach; ?> |
|
75 | + <?php endforeach; |
|
76 | +} |
|
77 | +?> |
|
66 | 78 | <?php endif; ?> |