Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function before()
 {
     $manager = $this->getAuth();
     $uri = $this->getUri();
     if (!$manager->check()) {
         return \Response::forge('redirect', $uri . 'login', 'location', 403);
     }
     \View::setGlobal('admin_uri', $uri);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function before()
 {
     $this->_before();
     if (!in_array($this->route->action, ['Login', 'Logout'])) {
         return parent::before();
     } else {
         \View::setGlobal('admin_uri', $this->getUri());
     }
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function before()
 {
     $this->__before();
     $config = $this->request->getConfig();
     $finder = $this->app->getViewManager()->getFinder();
     $config->load('theme', true);
     $paths = $config->get('theme.paths', []);
     $theme = $config->get('theme.active', 'default');
     \View::setGlobal('theme', $theme);
     \View::setGlobal('asset_path', $config->get('theme.asset_path', 'themes' . DIRECTORY_SEPARATOR));
     if ($config->get('theme.use_component', false)) {
         $component = $this->request->getComponent()->getUri();
         $component = str_replace('/', DIRECTORY_SEPARATOR, trim($component, '/'));
     }
     foreach ($paths as $path) {
         rtrim($path, '\\/');
         $path .= DIRECTORY_SEPARATOR . $theme;
         if (isset($component)) {
             $path .= DIRECTORY_SEPARATOR . $component;
         }
         is_dir($path) and $finder->addPath($path);
     }
 }