@@ -6,11 +6,11 @@ |
||
6 | 6 | |
7 | 7 | class ContactController extends Controller |
8 | 8 | { |
9 | - public function index() |
|
10 | - { |
|
9 | + public function index() |
|
10 | + { |
|
11 | 11 | $context = [ |
12 | 12 | |
13 | 13 | ]; |
14 | 14 | return $this->PugView->render('website/pages/contact', $context); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -6,11 +6,11 @@ |
||
6 | 6 | |
7 | 7 | class HomeController extends Controller |
8 | 8 | { |
9 | - public function index() |
|
10 | - { |
|
9 | + public function index() |
|
10 | + { |
|
11 | 11 | $context = [ |
12 | 12 | |
13 | 13 | ]; |
14 | 14 | return $this->PugView->render('website/pages/home', $context); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | |
7 | 7 | class NotfoundController extends Controller |
8 | 8 | { |
9 | - public function index() |
|
10 | - { |
|
9 | + public function index() |
|
10 | + { |
|
11 | 11 | $context = [ |
12 | 12 | |
13 | 13 | ]; |
14 | 14 | return $this->PugView->render('notFound', $context); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | interface MiddlewaresInterface |
8 | 8 | { |
9 | - public function handle(Application $app, $nex); |
|
9 | + public function handle(Application $app, $nex); |
|
10 | 10 | } |
11 | 11 | \ No newline at end of file |
@@ -7,28 +7,28 @@ |
||
7 | 7 | |
8 | 8 | class AuthenticateMiddleware implements Middleware |
9 | 9 | { |
10 | - public function handle(Application $app, $next) |
|
11 | - { |
|
10 | + public function handle(Application $app, $next) |
|
11 | + { |
|
12 | 12 | $request = $app->request->url(); |
13 | 13 | |
14 | 14 | $login = $app->load->model('Login'); |
15 | 15 | |
16 | 16 | $pagesWhenLogout = [ |
17 | - '/login', |
|
18 | - '/login/submit', |
|
19 | - '/registration', |
|
20 | - '/registration/submit' |
|
17 | + '/login', |
|
18 | + '/login/submit', |
|
19 | + '/registration', |
|
20 | + '/registration/submit' |
|
21 | 21 | ]; |
22 | 22 | |
23 | 23 | if ($login->isLogged()) { |
24 | 24 | |
25 | - if (in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
25 | + if (in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
26 | 26 | |
27 | 27 | } else { |
28 | 28 | |
29 | - if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
29 | + if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | return $next; |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | } else { |
28 | 28 | |
29 | - if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
29 | + if (!in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | return $next; |
@@ -22,11 +22,15 @@ |
||
22 | 22 | |
23 | 23 | if ($login->isLogged()) { |
24 | 24 | |
25 | - if (in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
25 | + if (in_array($request, $pagesWhenLogout)) { |
|
26 | + $app->url->redirectTo('/'); |
|
27 | + } |
|
26 | 28 | |
27 | 29 | } else { |
28 | 30 | |
29 | - if (! in_array($request, $pagesWhenLogout)) $app->url->redirectTo('/'); |
|
31 | + if (! in_array($request, $pagesWhenLogout)) { |
|
32 | + $app->url->redirectTo('/'); |
|
33 | + } |
|
30 | 34 | } |
31 | 35 | |
32 | 36 | return $next; |
@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class PermissionsMiddleware implements Middleware |
9 | 9 | { |
10 | - public function handle(Application $app, $next) |
|
11 | - { |
|
10 | + public function handle(Application $app, $next) |
|
11 | + { |
|
12 | 12 | |
13 | - } |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -10,13 +10,13 @@ |
||
10 | 10 | public function handle(Application $app, $next) |
11 | 11 | { |
12 | 12 | |
13 | - if (! $this->session->has('error') || $this->session->get('error') != true) { |
|
13 | + if (! $this->session->has('error') || $this->session->get('error') != true) { |
|
14 | 14 | |
15 | 15 | $this->url->redirectTo('/'); |
16 | 16 | |
17 | - } else { |
|
17 | + } else { |
|
18 | 18 | |
19 | - $this->session->remove('error'); |
|
20 | - } |
|
19 | + $this->session->remove('error'); |
|
20 | + } |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
10 | 10 | public function handle(Application $app, $next) |
11 | 11 | { |
12 | 12 | |
13 | - if (! $this->session->has('error') || $this->session->get('error') != true) { |
|
13 | + if (!$this->session->has('error') || $this->session->get('error') != true) { |
|
14 | 14 | |
15 | 15 | $this->url->redirectTo('/'); |
16 | 16 |
@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class AjaxMiddleware implements Middleware |
9 | 9 | { |
10 | - public function handle(Application $app, $next) |
|
11 | - { |
|
10 | + public function handle(Application $app, $next) |
|
11 | + { |
|
12 | 12 | // if(empty($_SERVER['HTTP_X_REQUESTED_WITH'])) $this->url->redirectTo('error'); |
13 | - } |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -4,60 +4,60 @@ |
||
4 | 4 | |
5 | 5 | class Session |
6 | 6 | { |
7 | - private $app; |
|
7 | + private $app; |
|
8 | 8 | |
9 | - public function __construct(Application $app) |
|
10 | - { |
|
9 | + public function __construct(Application $app) |
|
10 | + { |
|
11 | 11 | $this->app = $app; |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - public function start() |
|
15 | - { |
|
14 | + public function start() |
|
15 | + { |
|
16 | 16 | ini_set('session.use_only_cookies', 1); |
17 | 17 | |
18 | 18 | if (! session_id()) { |
19 | - session_start(); |
|
19 | + session_start(); |
|
20 | + } |
|
20 | 21 | } |
21 | - } |
|
22 | 22 | |
23 | - public function set($key, $value) |
|
24 | - { |
|
25 | - $_SESSION[$key] = $value; |
|
23 | + public function set($key, $value) |
|
24 | + { |
|
25 | + $_SESSION[$key] = $value; |
|
26 | 26 | } |
27 | 27 | |
28 | - public function get($key, $default = null) |
|
29 | - { |
|
28 | + public function get($key, $default = null) |
|
29 | + { |
|
30 | 30 | return array_get($_SESSION, $key, $default); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | - public function pull($key) |
|
34 | - { |
|
33 | + public function pull($key) |
|
34 | + { |
|
35 | 35 | $value = $this->get($key); |
36 | 36 | |
37 | 37 | $this->remove($key); |
38 | 38 | |
39 | 39 | return $value; |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - public function has($key) |
|
43 | - { |
|
42 | + public function has($key) |
|
43 | + { |
|
44 | 44 | return isset($_SESSION[$key]); |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - public function all() |
|
48 | - { |
|
47 | + public function all() |
|
48 | + { |
|
49 | 49 | return $_SESSION; |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - public function remove($key) |
|
53 | - { |
|
52 | + public function remove($key) |
|
53 | + { |
|
54 | 54 | unset($_SESSION[$key]); |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - public function destroy() |
|
58 | - { |
|
59 | - session_destroy(); |
|
57 | + public function destroy() |
|
58 | + { |
|
59 | + session_destroy(); |
|
60 | 60 | |
61 | 61 | unset($_SESSION); |
62 | - } |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | \ No newline at end of file |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | ini_set('session.use_only_cookies', 1); |
17 | 17 | |
18 | - if (! session_id()) { |
|
18 | + if (!session_id()) { |
|
19 | 19 | session_start(); |
20 | 20 | } |
21 | 21 | } |