Пример #1
0
 /**
  * Display Help Article Pages
  *
  * @return  void
  */
 public function displayTask()
 {
     // Force help template
     Request::setVar('tmpl', 'help');
     // Get the page we are trying to access
     $page = Request::getWord('page', 'index');
     $component = Request::getWord('component', 'com_help');
     $name = str_replace('com_', '', $component);
     $extension = Request::getWord('extension', '');
     $tmpl = App::get('template')->template;
     $lang = Lang::getTag();
     $finalHelpPage = Finder::page($component, $extension, $page);
     $content = '';
     // If we have an existing page
     if ($finalHelpPage != '') {
         ob_start();
         require_once $finalHelpPage;
         $content = ob_get_contents();
         ob_end_clean();
     } else {
         if (isset($component) && $component != '' && $page == 'index') {
             // Get list of component pages
             $pages[] = Finder::pages($component);
             //display page
             $view = with(new View(array('name' => $this->_controller, 'layout' => 'index')))->set('option', $this->_option)->set('controller', $this->_controller)->set('layoutExt', $this->layoutExt)->set('pages', $pages);
             $content = $view->loadTemplate();
         } else {
             // Raise error to avoid security bug
             throw new Exception(Lang::txt('COM_HELP_PAGE_NOT_FOUND'), 404);
         }
     }
     // Set vars for views
     $this->view->set('modified', filemtime($finalHelpPage))->set('component', $component)->set('extension', $extension)->set('content', $content)->set('page', $page)->display();
 }
Пример #2
0
 /**
  * Display Help Article Pages
  *
  * @return  void
  */
 public function displayTask()
 {
     // Get the page we are trying to access
     $page = Request::getWord('page', '');
     $component = Request::getWord('component', 'com_help');
     $extension = Request::getWord('extension', '');
     if ($component == $this->_option && !Request::getString('tmpl', '') && !$page) {
         $this->view->set('components', self::getComponents())->setLayout('overview')->display();
         return;
     }
     $page = $page ?: 'index';
     // Force help template
     Request::setVar('tmpl', 'help');
     $finalHelpPage = Finder::page($component, $extension, $page);
     // Var to hold content
     $this->view->content = '';
     // If we have an existing pge
     if ($finalHelpPage != '') {
         ob_start();
         require_once $finalHelpPage;
         $this->view->content = ob_get_contents();
         ob_end_clean();
     } else {
         if (isset($component) && $component != '' && $page == 'index') {
             // Get list of component pages
             $pages[] = Finder::pages($component);
             // Display page
             $this->view->content = $this->displayHelpPageIndexForPages($pages, 'h1');
         } else {
             // Raise error to avoid security bug
             App::abort(404, Lang::txt('COM_HELP_PAGE_NOT_FOUND'));
         }
     }
     // Set vars for views
     $this->view->modified = filemtime($finalHelpPage);
     $this->view->component = $component;
     $this->view->extension = $extension;
     $this->view->page = $page;
     // Display
     $this->view->display();
 }