@@ -16,22 +16,22 @@ discard block |
||
16 | 16 | [ |
17 | 17 | "info" => "Just say hi with a string.", |
18 | 18 | "path" => "hi", |
19 | - "handler" => function () { |
|
19 | + "handler" => function() { |
|
20 | 20 | return "Hi."; |
21 | 21 | }, |
22 | 22 | ], |
23 | 23 | [ |
24 | 24 | "info" => "Say No! with status code 500.", |
25 | 25 | "path" => "no", |
26 | - "handler" => function () { |
|
27 | - return ["No!", 500]; |
|
26 | + "handler" => function() { |
|
27 | + return [ "No!", 500 ]; |
|
28 | 28 | }, |
29 | 29 | ], |
30 | 30 | [ |
31 | 31 | "info" => "Say Hi through JSON.", |
32 | 32 | "path" => "json", |
33 | - "handler" => function () { |
|
34 | - return [["message" => "Hi JSON"]]; |
|
33 | + "handler" => function() { |
|
34 | + return [ [ "message" => "Hi JSON" ] ]; |
|
35 | 35 | }, |
36 | 36 | ], |
37 | 37 | [ |
@@ -47,28 +47,28 @@ discard block |
||
47 | 47 | [ |
48 | 48 | "info" => "Throw standard exception.", |
49 | 49 | "path" => "exception", |
50 | - "handler" => function () { |
|
50 | + "handler" => function() { |
|
51 | 51 | throw new \Exception("Standard \Exception"); |
52 | 52 | }, |
53 | 53 | ], |
54 | 54 | [ |
55 | 55 | "info" => "Try internal 403.", |
56 | 56 | "path" => "403", |
57 | - "handler" => function () { |
|
57 | + "handler" => function() { |
|
58 | 58 | throw new ForbiddenException("Detailed error message."); |
59 | 59 | }, |
60 | 60 | ], |
61 | 61 | [ |
62 | 62 | "info" => "Try internal 404.", |
63 | 63 | "path" => "404", |
64 | - "handler" => function () { |
|
64 | + "handler" => function() { |
|
65 | 65 | throw new NotFoundException("Detailed error message."); |
66 | 66 | }, |
67 | 67 | ], |
68 | 68 | [ |
69 | 69 | "info" => "Try internal 500.", |
70 | 70 | "path" => "500", |
71 | - "handler" => function () { |
|
71 | + "handler" => function() { |
|
72 | 72 | throw new InternalErrorException("Detailed error message."); |
73 | 73 | }, |
74 | 74 | ], |
@@ -21,5 +21,5 @@ |
||
21 | 21 | <pre><?= var_dump($session) ?></pre> |
22 | 22 | |
23 | 23 | <p> |
24 | - <a href="<?= url($mount."session") ?>">Back to session<a> |
|
24 | + <a href="<?= url($mount . "session") ?>">Back to session<a> |
|
25 | 25 | </p> |
@@ -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"> |
@@ -50,7 +50,7 @@ |
||
50 | 50 | "submit" => [ |
51 | 51 | "type" => "submit", |
52 | 52 | "value" => "Answer", |
53 | - "callback" => [$this, "callbackSubmit"] |
|
53 | + "callback" => [ $this, "callbackSubmit" ] |
|
54 | 54 | ], |
55 | 55 | ] |
56 | 56 | ); |
@@ -50,7 +50,7 @@ |
||
50 | 50 | "submit" => [ |
51 | 51 | "type" => "submit", |
52 | 52 | "value" => "Answer", |
53 | - "callback" => [$this, "callbackSubmit"] |
|
53 | + "callback" => [ $this, "callbackSubmit" ] |
|
54 | 54 | ], |
55 | 55 | ] |
56 | 56 | ); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $items = isset($items) ? $items : null; |
12 | 12 | $session = $this->di->get("session"); |
13 | 13 | $filter = $this->di->get("textfilter"); |
14 | -$tags = []; |
|
14 | +$tags = [ ]; |
|
15 | 15 | // var_dump($session); |
16 | 16 | ?> |
17 | 17 | <h1>Welcome to the forum</h1> |
@@ -19,9 +19,12 @@ |
||
19 | 19 | <p> |
20 | 20 | <a href="forum/create">Create a new post</a> |
21 | 21 | </p> |
22 | -<?php else : ?> |
|
22 | +<?php else { |
|
23 | + : ?> |
|
23 | 24 | <p>You have to be logged in to create a new post</p> |
24 | -<?php endif; ?> |
|
25 | +<?php endif; |
|
26 | +} |
|
27 | +?> |
|
25 | 28 | <?php if (!$items) : ?> |
26 | 29 | <p>There are no posts to show!</p> |
27 | 30 | <?php endif; ?> |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $items = isset($items) ? $items : null; |
12 | 12 | // var_dump($items); |
13 | 13 | // $session = $this->di->get("session"); |
14 | -$tags = []; |
|
14 | +$tags = [ ]; |
|
15 | 15 | $counter = 1; |
16 | 16 | ?> |
17 | 17 |
@@ -38,13 +38,16 @@ |
||
38 | 38 | </section> |
39 | 39 | <?php $counter++ ?> |
40 | 40 | <?php endforeach; ?> |
41 | - <?php else : ?> |
|
41 | + <?php else { |
|
42 | + : ?> |
|
42 | 43 | <?php foreach ($exploded as $piece) : ?> |
43 | 44 | <section> |
44 | 45 | <?= $counter ?>: <a href="tags/tag/<?= $piece ?>"><?= $piece ?></a> |
45 | 46 | </section> |
46 | 47 | <?php $counter++ ?> |
47 | - <?php endforeach; ?> |
|
48 | + <?php endforeach; |
|
49 | +} |
|
50 | +?> |
|
48 | 51 | <?php endif; ?> |
49 | 52 | <?php endforeach; ?> |
50 | 53 | </article> |
@@ -47,7 +47,7 @@ |
||
47 | 47 | "submit" => [ |
48 | 48 | "type" => "submit", |
49 | 49 | "value" => "Create user", |
50 | - "callback" => [$this, "callbackSubmit"] |
|
50 | + "callback" => [ $this, "callbackSubmit" ] |
|
51 | 51 | ], |
52 | 52 | ] |
53 | 53 | ); |
@@ -26,20 +26,20 @@ discard block |
||
26 | 26 | [ |
27 | 27 | "id" => [ |
28 | 28 | "type" => "text", |
29 | - "validation" => ["not_empty"], |
|
29 | + "validation" => [ "not_empty" ], |
|
30 | 30 | "readonly" => "readonly", |
31 | 31 | "value" => $user->id, |
32 | 32 | ], |
33 | 33 | |
34 | 34 | "username" => [ |
35 | 35 | "type" => "text", |
36 | - "validation" => ["not_empty"], |
|
36 | + "validation" => [ "not_empty" ], |
|
37 | 37 | "value" => $user->username, |
38 | 38 | ], |
39 | 39 | |
40 | 40 | "password" => [ |
41 | 41 | "type" => "password", |
42 | - "validation" => ["not_empty"], |
|
42 | + "validation" => [ "not_empty" ], |
|
43 | 43 | ], |
44 | 44 | |
45 | 45 | "password-again" => [ |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | |
52 | 52 | "email" => [ |
53 | 53 | "type" => "email", |
54 | - "validation" => ["not_empty"], |
|
54 | + "validation" => [ "not_empty" ], |
|
55 | 55 | "value" => $user->email, |
56 | 56 | ], |
57 | 57 | |
58 | 58 | "submit" => [ |
59 | 59 | "type" => "submit", |
60 | 60 | "value" => "Create user", |
61 | - "callback" => [$this, "callbackSubmit"] |
|
61 | + "callback" => [ $this, "callbackSubmit" ] |
|
62 | 62 | ], |
63 | 63 | ] |
64 | 64 | ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | $user->find("id", $this->form->value("id")); |
106 | - $user->username = $username; |
|
106 | + $user->username = $username; |
|
107 | 107 | $user->password = $this->form->value("password"); |
108 | 108 | $user->email = $email; |
109 | 109 | $user->save(); |