@@ -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); |
@@ -83,9 +83,9 @@ |
||
| 83 | 83 | $session->set("login", $user->id); |
| 84 | 84 | |
| 85 | 85 | if (!$res) { |
| 86 | - $this->form->rememberValues(); |
|
| 87 | - $this->form->addOutput("User or password did not match."); |
|
| 88 | - return false; |
|
| 86 | + $this->form->rememberValues(); |
|
| 87 | + $this->form->addOutput("User or password did not match."); |
|
| 88 | + return false; |
|
| 89 | 89 | } |
| 90 | 90 | $this->form->addOutput("User " . $user->username . " logged in."); |
| 91 | 91 | return true; |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * |
| 87 | 87 | * @return boolean true if okey, false if something went wrong. |
| 88 | 88 | */ |
| 89 | - public function callbackSubmit() |
|
| 89 | + public function callbackSubmit() |
|
| 90 | 90 | { |
| 91 | 91 | // Get values from the submitted form |
| 92 | 92 | $user = new User(); |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | * |
| 62 | 62 | * @return boolean true if okey, false if something went wrong. |
| 63 | 63 | */ |
| 64 | - public function callbackSubmit() |
|
| 64 | + public function callbackSubmit() |
|
| 65 | 65 | { |
| 66 | 66 | // Get values from the submitted form |
| 67 | 67 | $username = $this->form->value("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 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 $question_id; |
@@ -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; |
@@ -21,33 +21,42 @@ |
||
| 21 | 21 | <h3>Questions asked: </h3> |
| 22 | 22 | <?php if (empty($questions)) : ?> |
| 23 | 23 | <p>This user hasen't posted any questions yet.</p> |
| 24 | -<?php else : ?> |
|
| 24 | +<?php else { |
|
| 25 | + : ?> |
|
| 25 | 26 | <?php foreach ($questions as $question) : ?> |
| 26 | 27 | <p> |
| 27 | 28 | <a href="../../forum/question/<?= $question->id ?>"><?= $question->title ?></a> |
| 28 | 29 | </p> |
| 29 | - <?php endforeach; ?> |
|
| 30 | + <?php endforeach; |
|
| 31 | +} |
|
| 32 | +?> |
|
| 30 | 33 | <?php endif; ?> |
| 31 | 34 | <h3>Answers posted: </h3> |
| 32 | 35 | <?php if (empty($answers)) : ?> |
| 33 | 36 | <p>This user hasn't posted any answers yet.</p> |
| 34 | -<?php else: ?> |
|
| 37 | +<?php else { |
|
| 38 | + : ?> |
|
| 35 | 39 | <?php foreach ($answers as $answer) : ?> |
| 36 | 40 | <p> |
| 37 | 41 | <a href="../../forum/question/<?= $answer->question_id ?>"><?= $answer->content ?></a> |
| 38 | 42 | </p> |
| 39 | - <?php endforeach; ?> |
|
| 43 | + <?php endforeach; |
|
| 44 | +} |
|
| 45 | +?> |
|
| 40 | 46 | <?php endif; ?> |
| 41 | 47 | <?php if (empty($comments)) : ?> |
| 42 | 48 | <h3>Comments this user have posted: </h3> |
| 43 | 49 | <p>This user have not posted any comments yet.</p> |
| 44 | -<?php else : ?> |
|
| 50 | +<?php else { |
|
| 51 | + : ?> |
|
| 45 | 52 | <h3>Comments you have posted: </h3> |
| 46 | 53 | <?php foreach ($comments as $comment) : ?> |
| 47 | 54 | <p> |
| 48 | 55 | <a href="../../forum/question/<?= $answer->question_id ?>"><?= $comment->content ?></a> |
| 49 | 56 | </p> |
| 50 | - <?php endforeach; ?> |
|
| 57 | + <?php endforeach; |
|
| 58 | +} |
|
| 59 | +?> |
|
| 51 | 60 | <?php endif; ?> |
| 52 | 61 | <h3>Comments on answers you have posted: </h3> |
| 53 | 62 | <?php foreach ($anscomments as $anscomment) : ?> |