protected function __construct() { // check if it is a POST request and if it is then check the CSRF token if (isset($_POST)) { if (!Session::getInstance()->isCSRFValid($this->getPost('csrf_token'))) { $this->post = false; // it's not a valid post request } else { $this->post = true; } } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $this->ajax = true; } $getParamsRemoved = explode('?', $_SERVER['REQUEST_URI']); // removes everything after a question mark, like google adwords stuff $this->query = $getParamsRemoved[0]; // set the querystring for the router if (isset($getParamsRemoved[1])) { $this->parseGetParams($getParamsRemoved[1]); } // inject the parameters to the params instance }
public function __construct() { $this->sm = ServiceManager::getInstance(); $this->layout = new Layout(); $this->session = Session::getInstance(); }