@@ 33-41 (lines=9) @@ | ||
30 | } |
|
31 | } |
|
32 | ||
33 | public function index(){ |
|
34 | ||
35 | // clear all notifications whenever you hit 'files' in the navigation bar |
|
36 | $this->user->clearNotifications(Session::getUserId(), $this->file->table); |
|
37 | ||
38 | $pageNum = $this->request->query("page"); |
|
39 | ||
40 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'files/index.php', ['pageNum' => $pageNum]); |
|
41 | } |
|
42 | ||
43 | public function create(){ |
|
44 |
@@ 56-79 (lines=24) @@ | ||
53 | * login form |
|
54 | * |
|
55 | */ |
|
56 | public function index(){ |
|
57 | ||
58 | // check first if user is already logged in via session or cookie |
|
59 | if($this->Auth->isLoggedIn()){ |
|
60 | ||
61 | return $this->redirector->dashboard(); |
|
62 | ||
63 | } else { |
|
64 | ||
65 | // Clearing the sesion won't allow user(un-trusted) to open more than one login form, |
|
66 | // as every time the page loads, it generates a new CSRF Token. |
|
67 | // Destroying the sesion won't allow accessing sesssion data (i.e. $_SESSION["csrf_token"]). |
|
68 | ||
69 | // get redirect url if any |
|
70 | $redirect = $this->request->query('redirect'); |
|
71 | ||
72 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/login/", Config::get('LOGIN_PATH') . "index.php", ['redirect' => $redirect]); |
|
73 | } |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * get captcha image for registration form |
|
78 | * |
|
79 | * @return Gregwar\Captcha\CaptchaBuilder |
|
80 | * @see views/login/index.php |
|
81 | */ |
|
82 | public function getCaptcha(){ |
@@ 39-46 (lines=8) @@ | ||
36 | } |
|
37 | } |
|
38 | ||
39 | public function index(){ |
|
40 | ||
41 | $this->user->clearNotifications(Session::getUserId(), $this->newsfeed->table); |
|
42 | ||
43 | $pageNum = $this->request->query("page"); |
|
44 | ||
45 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'newsfeed/index.php', ['pageNum' => $pageNum]); |
|
46 | } |
|
47 | ||
48 | public function create(){ |
|
49 |
@@ 41-49 (lines=9) @@ | ||
38 | * show posts page |
|
39 | * |
|
40 | */ |
|
41 | public function index(){ |
|
42 | ||
43 | // clear all notifications |
|
44 | $this->user->clearNotifications(Session::getUserId(), $this->post->table); |
|
45 | ||
46 | $pageNum = $this->request->query("page"); |
|
47 | ||
48 | $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'posts/index.php', ['pageNum' => $pageNum]); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * view a post |