예제 #1
0
 protected function loadData()
 {
     if (!($theme = Theme::getActiveTheme())) {
         throw new ApplicationException(Lang::get('cms::lang.theme.not_found_name', ['name' => Theme::getActiveThemeCode()]));
     }
     $this->vars['theme'] = $theme;
     $this->vars['inMaintenance'] = MaintenanceSetting::get('is_enabled');
 }
예제 #2
0
파일: Status.php 프로젝트: jiiis/ptn
 protected function loadData()
 {
     $manager = UpdateManager::instance();
     $manager->requestUpdateList();
     $this->vars['inMaintenance'] = MaintenanceSetting::get('is_enabled');
     $this->vars['updates'] = DB::table('system_parameters')->where('item', 'count')->pluck('value');
     $this->vars['plugins'] = DB::table('system_plugin_versions')->count();
     $count = 0;
     if ($themes = opendir('themes')) {
         while (false !== ($theme = readdir($themes))) {
             if ($theme != '.' && $theme != '..' && !File::isFile($theme)) {
                 $count++;
             }
         }
         closedir($themes);
     }
     $this->vars['themes'] = $count;
 }
예제 #3
0
 protected function loadData()
 {
     $this->vars['theme'] = Theme::getActiveTheme();
     $this->vars['inMaintenance'] = MaintenanceSetting::get('is_enabled');
 }
예제 #4
0
 /**
  * Finds and serves the requested page.
  * If the page cannot be found, returns the page with the URL /404.
  * If the /404 page doesn't exist, returns the system 404 page.
  * @param string $url Specifies the requested page URL.
  * If the parameter is omitted, the current URL used.
  * @return string Returns the processed page content.
  */
 public function run($url = '/')
 {
     if ($url === null) {
         $url = Request::path();
     }
     if (!strlen($url)) {
         $url = '/';
     }
     /*
      * Hidden page
      */
     $page = $this->router->findByUrl($url);
     if ($page && $page->is_hidden) {
         if (!BackendAuth::getUser()) {
             $page = null;
         }
     }
     /*
      * Maintenance mode
      */
     if (MaintenanceSetting::isConfigured() && MaintenanceSetting::get('is_enabled', false) && !BackendAuth::getUser()) {
         if (!Request::ajax()) {
             $this->setStatusCode(503);
         }
         $page = Page::loadCached($this->theme, MaintenanceSetting::get('cms_page'));
     }
     /*
      * Extensibility
      */
     if (($event = $this->fireEvent('page.beforeDisplay', [$url, $page], true)) || ($event = Event::fire('cms.page.beforeDisplay', [$this, $url, $page], true))) {
         if ($event instanceof Page) {
             $page = $event;
         } else {
             return $event;
         }
     }
     /*
      * If the page was not found, render the 404 page - either provided by the theme or the built-in one.
      */
     if (!$page || $url === '404') {
         if (!Request::ajax()) {
             $this->setStatusCode(404);
         }
         // Log the 404 request
         if (!App::runningUnitTests()) {
             RequestLog::add();
         }
         if (!($page = $this->router->findByUrl('/404'))) {
             return Response::make(View::make('cms::404'), $this->statusCode);
         }
     }
     /*
      * Run the page
      */
     $result = $this->runPage($page);
     /*
      * Post-processing
      */
     $result = $this->postProcessResult($page, $url, $result);
     /*
      * Extensibility
      */
     if (($event = $this->fireEvent('page.display', [$url, $page, $result], true)) || ($event = Event::fire('cms.page.display', [$this, $url, $page, $result], true))) {
         return $event;
     }
     if (!is_string($result)) {
         return $result;
     }
     return Response::make($result, $this->statusCode);
 }