| @@ 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 | echo $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 | Redirector::dashboard(); |
|
| 62 | ||
| 63 | } else { |
|
| 64 | ||
| 65 | // clear and regenerate session and cookies(instead of using the existing one in browser), |
|
| 66 | // then show login form. |
|
| 67 | ||
| 68 | // But, this won't allow user(un-trusted) to open more than one login form, |
|
| 69 | // because every time it loads, it generates a new CSRF Token |
|
| 70 | // So, keep it commented |
|
| 71 | // $this->login->logOut(Session::getUserId(), true); |
|
| 72 | ||
| 73 | // get redirect url if any |
|
| 74 | // validation for the url will be delayed until login() |
|
| 75 | $redirect = $this->request->query('redirect'); |
|
| 76 | ||
| 77 | echo $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/login/", Config::get('LOGIN_PATH') . "index.php", ['redirect' => $redirect]); |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * get captcha image for registration form |
|
| @@ 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 | echo $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 | echo $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 |
|