[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_admin/src/View/Sysinfo/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_admin
   6   *
   7   * @copyright   (C) 2008 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Admin\Administrator\View\Sysinfo;
  12  
  13  use Exception;
  14  use Joomla\CMS\Access\Exception\NotAllowed;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Router\Route;
  18  use Joomla\CMS\Session\Session;
  19  use Joomla\CMS\Toolbar\ToolbarHelper;
  20  use Joomla\Component\Admin\Administrator\Model\SysinfoModel;
  21  
  22  // phpcs:disable PSR1.Files.SideEffects
  23  \defined('_JEXEC') or die;
  24  // phpcs:enable PSR1.Files.SideEffects
  25  
  26  /**
  27   * Sysinfo View class for the Admin component
  28   *
  29   * @since  1.6
  30   */
  31  class HtmlView extends BaseHtmlView
  32  {
  33      /**
  34       * Some PHP settings
  35       *
  36       * @var    array
  37       * @since  1.6
  38       */
  39      protected $phpSettings = [];
  40  
  41      /**
  42       * Config values
  43       *
  44       * @var    array
  45       * @since  1.6
  46       */
  47      protected $config = [];
  48  
  49      /**
  50       * Some system values
  51       *
  52       * @var    array
  53       * @since  1.6
  54       */
  55      protected $info = [];
  56  
  57      /**
  58       * PHP info
  59       *
  60       * @var    string
  61       * @since  1.6
  62       */
  63      protected $phpInfo = null;
  64  
  65      /**
  66       * Information about writable state of directories
  67       *
  68       * @var    array
  69       * @since  1.6
  70       */
  71      protected $directory = [];
  72  
  73      /**
  74       * Execute and display a template script.
  75       *
  76       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  77       *
  78       * @return  void
  79       *
  80       * @since   1.6
  81       *
  82       * @throws  Exception
  83       */
  84      public function display($tpl = null): void
  85      {
  86          // Access check.
  87          if (!$this->getCurrentUser()->authorise('core.admin')) {
  88              throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
  89          }
  90  
  91          /** @var SysinfoModel $model */
  92          $model             = $this->getModel();
  93          $this->phpSettings = $model->getPhpSettings();
  94          $this->config      = $model->getConfig();
  95          $this->info        = $model->getInfo();
  96          $this->phpInfo     = $model->getPHPInfo();
  97          $this->directory   = $model->getDirectory();
  98  
  99          $this->addToolbar();
 100  
 101          parent::display($tpl);
 102      }
 103  
 104      /**
 105       * Setup the Toolbar
 106       *
 107       * @return  void
 108       *
 109       * @since   1.6
 110       */
 111      protected function addToolbar(): void
 112      {
 113          ToolbarHelper::title(Text::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-circle systeminfo');
 114          ToolbarHelper::link(
 115              Route::_('index.php?option=com_admin&view=sysinfo&format=text&' . Session::getFormToken() . '=1'),
 116              'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT',
 117              'download'
 118          );
 119          ToolbarHelper::link(
 120              Route::_('index.php?option=com_admin&view=sysinfo&format=json&' . Session::getFormToken() . '=1'),
 121              'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON',
 122              'download'
 123          );
 124          ToolbarHelper::help('Site_System_Information');
 125      }
 126  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer