public function __construct() { try { Config::getConf(); Auth::loadClass(); //we c'est un peux de la triche Session::start(); EventManager::init(); $this->request = Request::getInstance(); $this->router = Router::getInstance(); $this->auth = Auth::getInstance(); include_once APP_FOLDER . DS . 'config' . DS . 'bootstrap.php'; $this->request->securePost(); $view = $this->router->execute(); $view->render(); } catch (Exception $e) { $this->controller = new ErrorController($e); } }
/** * redirect the request to a new link * @param array $link a array description of the link */ public function redirect($link = []) { EventManager::getInstance()->event('request.redirect', $this); Auth::getInstance()->notDirect(); $url = ''; //debug($link); if (is_string($link)) { $url = $this->url(Router::getInstance()->getRouteByName($link)); } else { $url = $this->url($link); } //debug($url); header('Location: ' . $url); exit; }
public function beforeInsert($data, $entity = null) { //debug($data);die(); $auth = Auth::getInstance()->getAuth(); $data->author = $auth->username; }
public function logout() { $link = Auth::getInstance()->unsetAuth(); $this->Flash->set('success', ['class' => 'success']); $this->request->redirect($link); }
function checkPrivateAccess($link) { //$this->Flash->set('Private',['class' => 'error']); return Auth::isAuthentified(); }
public function getAuth() { return Auth::getInstance()->getAuth(); }