login.php (1166B)
1 <?php 2 class ControllerStartupLogin extends Controller { 3 public function index() { 4 $route = isset($this->request->get['route']) ? $this->request->get['route'] : ''; 5 6 $ignore = array( 7 'common/login', 8 'common/forgotten', 9 'common/reset' 10 ); 11 12 // User 13 $this->registry->set('user', new Cart\User($this->registry)); 14 15 if (!$this->user->isLogged() && !in_array($route, $ignore)) { 16 return new Action('common/login'); 17 } 18 19 if (isset($this->request->get['route'])) { 20 $ignore = array( 21 'common/login', 22 'common/logout', 23 'common/forgotten', 24 'common/reset', 25 'error/not_found', 26 'error/permission' 27 ); 28 29 if (!in_array($route, $ignore) && (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token']))) { 30 return new Action('common/login'); 31 } 32 } else { 33 if (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token'])) { 34 return new Action('common/login'); 35 } 36 } 37 } 38 }