예제 #1
0
 public function __construct(Application $app, $module, $action)
 {
     parent::__construct($app, $module, $action);
     if ($this->app->user()->getAttribute('user')->level() != MemberManager::ADMINISTRATOR) {
         $this->app->httpResponse()->redirect('/admin/');
     }
     $this->page->addVar('router', new Router());
 }
예제 #2
0
 public function __construct(Application $app, $module, $action)
 {
     parent::__construct($app, $module, $action);
     $this->page->addVar('router', new Router());
     $Member = $this->app->user()->getAttribute('user');
     if (!$this->app->httpRequest()->getExists('id')) {
         return;
     }
     $news_id = $this->app->httpRequest()->getData('id');
     $ManagerNews = $this->managers->getmanagerof('news');
     $News = $ManagerNews->getUnique($news_id);
     if (!$News) {
         $this->app->user()->setFlash('La news spécifiée n\'existe pas');
         $this->app->httpResponse()->redirect('/admin/');
     }
     if (($action == "update" || $action == "delete") && $Member->level() != MemberManager::ADMINISTRATOR) {
         $ManagerNews = $this->managers->getmanagerof('news');
         if ($Member->id() != $ManagerNews->getUnique($news_id)->auteurId()) {
             $this->app->user()->setFlash("Vous n'avez les droits nécessaires pour cette action !");
             $this->app->httpResponse()->redirect('/admin/');
         }
     }
 }
예제 #3
0
 public function __construct(Application $app, $module, $action)
 {
     parent::__construct($app, $module, $action);
     $this->page->addVar('router', new Router());
 }