Controller.php (1140B)
1 <?php 2 3 /** 4 * This is the "base controller class". All other "real" controllers extend this class. 5 * Whenever a controller is created, we also 6 * 1. initialize a session 7 * 2. check if the user is not logged in anymore (session timeout) but has a cookie 8 */ 9 class Controller 10 { 11 /** @var View View The view object */ 12 public $View; 13 14 /** 15 * Construct the (base) controller. This happens when a real controller is constructed, like in 16 * the constructor of IndexController when it says: parent::__construct(); 17 */ 18 function __construct() 19 { 20 // always initialize a session 21 Session::init(); 22 23 // check session concurrency 24 Auth::checkSessionConcurrency(); 25 26 // user is not logged in but has remember-me-cookie ? then try to login with cookie ("remember me" feature) 27 if (!Session::userIsLoggedIn() AND Request::cookie('remember_me')) { 28 header('location: ' . Config::get('URL') . 'login/loginWithCookie'); 29 } 30 31 // create a view object to be able to use it inside a controller, like $this->View->render(); 32 $this->View = new View(); 33 } 34 }