Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 public function beforeInsert($data, $entity = null)
 {
     //debug($data);die();
     $auth = Auth::getInstance()->getAuth();
     $data->author = $auth->username;
 }
Exemplo n.º 4
0
 public function logout()
 {
     $link = Auth::getInstance()->unsetAuth();
     $this->Flash->set('success', ['class' => 'success']);
     $this->request->redirect($link);
 }
Exemplo n.º 5
0
 function checkPrivateAccess($link)
 {
     //$this->Flash->set('Private',['class' => 'error']);
     return Auth::isAuthentified();
 }
Exemplo n.º 6
0
 public function getAuth()
 {
     return Auth::getInstance()->getAuth();
 }