Beispiel #1
0
 public function __construct($controller = null)
 {
     if (!session_id()) {
         session_start();
     }
     $request = isset($_GET['page']) ? $_GET['page'] : 'home';
     if (is_null($controller)) {
         $controller = new Lib\Controller();
     }
     $output = '';
     try {
         $output = $controller->getPageByRequest($request)->render();
     } catch (Exception\NotFoundException $e) {
         try {
             $output = $controller->getPageByRequest('404')->render();
         } catch (\Exception $se) {
             $output = $e->getMessage();
         }
     } catch (Exception\AccessException $e) {
         try {
             $output = $controller->getPageByRequest('403')->render();
         } catch (\Exception $se) {
             $output = $e->getMessage();
         }
     } catch (\Exception $e) {
         $settings = \Bh\Lib\Setup::getSettings();
         if ($settings['DevMode'] === true) {
             $output = $e;
         }
     }
     echo $output;
 }
Beispiel #2
0
 public function __construct($controller, $id)
 {
     $settings = \Bh\Lib\Setup::getSettings();
     if ($settings['EnableRegistration'] || $controller->getCurrentUser()) {
         parent::__construct($controller, 'User', $id);
     } else {
         $this->form = 'Registration disabled';
     }
 }
Beispiel #3
0
 protected function hash($pass)
 {
     $settings = \Bh\Lib\Setup::getSettings();
     $salt = $settings['Salt'];
     return sha1($salt . $this->name . $pass);
 }