/**
  * Build fake page with error based on fake controller initiation
  */
 protected function buildFakePage()
 {
     // initialize fake controller to display page with exception
     $fakeController = new Controller();
     // check if used no layout template
     if (defined('env_no_layout') && env_no_layout === true) {
         $fakeController->layout = null;
     }
     // add global title tag value
     $fakeController->setGlobalVar('title', App::$Translate->get('Default', $this->title));
     // build error text
     $rawResponse = 'error';
     try {
         $rawResponse = App::$View->render('native/errors/' . $this->tpl, ['msg' => $this->text]);
         if (Str::likeEmpty($rawResponse)) {
             $rawResponse = $this->text;
         }
     } catch (SyntaxException $e) {
         $rawResponse = $this->text;
     }
     // set controller body response
     $fakeController->setOutput($rawResponse);
     // set status code for header
     App::$Response->setStatusCode((int) $this->status);
     // return compiled html output
     return $fakeController->buildOutput();
 }
 /**
  * FrontAppController constructor. Check if app is enabled in database
  * @throws ForbiddenException
  */
 public function __construct()
 {
     if (!$this->isEnabled()) {
         throw new ForbiddenException(__('This application is disabled or not installed!'));
     }
     // add localizations
     App::$Translate->append(App::$Alias->currentViewPath . '/I18n/' . App::$Request->getLanguage() . '.php');
     parent::__construct();
 }
Exemple #3
0
 public function __construct()
 {
     $this->loadAppsTable();
     parent::__construct();
 }
Exemple #4
0
 /**
  * ApiController constructor. Disable global layout for api responses
  */
 public function __construct()
 {
     $this->layout = null;
     parent::__construct();
 }