Example #1
0
 function act_confirm($token)
 {
     if ($this->user) {
         Controller::weberror('404', 'La page est invalide.');
     }
     $user = $this->Member->GetByToken($token);
     if (empty($user)) {
         header('Location: ' . WEBROOT);
         exit;
     }
     if (!$user->Confirmed()) {
         $user->Confirm();
         $this->Member->Update($user);
         $d = array('member' => $user, 'success' => true);
         $this->set($d);
         $this->render();
     } else {
         header('Location: ' . WEBROOT);
         exit;
     }
 }
Example #2
0
 function act_add($id = null)
 {
     if ($this->user) {
         if (isset($id) & !empty($id)) {
             $page = $this->Page->GetByID($id);
             $book = $this->Book->GetByID($page->Book());
             $answers = $this->Answer->GetByPageID($id);
             $pages = $this->Page->GetByBookID($page->Book());
             if (empty($page)) {
                 Controller::weberror('404', 'La page est introuvable.');
             }
             $this->set('page', $page);
             $this->set('pages', $pages);
             $this->set('book', $book);
             $this->set('answers', $answers);
             $this->render();
         } else {
             $this->noaction();
         }
     } else {
         Controller::weberror('500', 'Vous devez vous cconnecter pour acceder à cette page.');
     }
 }
Example #3
0
 static function load($controller = null, $action = null, $params = null, $data = null)
 {
     if (!isset($controller) or empty($controller)) {
         $controller = DEFAULT_CONTROLLER;
     }
     self::$controllername = $controller;
     $cn = $controller;
     $filename = APPROOT . 'controllers/' . strtolower($controller) . '.php';
     if (file_exists($filename)) {
         require_once $filename;
         $class = 'Apps\\Controller\\' . $controller;
         $controller = new $class($action, $params, $data);
         $controller->controller = $cn;
         $controller->run();
         return $controller;
     } else {
         return Controller::weberror('404', 'Le controller demandé n\'existe pas.');
     }
 }
Example #4
0
 function act_create()
 {
     if ($this->user) {
         $categories = $this->Resource->Categories();
         $this->set('categories', $categories);
         $this->render();
     } else {
         Controller::weberror('500', 'Vous devez vous cconnecter pour acceder à cette page.');
     }
 }