diff --git a/administrator/components/com_admin/controller.php b/administrator/components/com_admin/Controller/Controller.php similarity index 67% rename from administrator/components/com_admin/controller.php rename to administrator/components/com_admin/Controller/Controller.php index 8d95c42abe836..16fa8182793e5 100644 --- a/administrator/components/com_admin/controller.php +++ b/administrator/components/com_admin/Controller/Controller.php @@ -6,14 +6,18 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\Controller; defined('_JEXEC') or die; +use Joomla\CMS\Controller\Controller as BaseController; + /** * Admin Controller * * @since 1.6 */ -class AdminController extends JControllerLegacy +class Controller extends BaseController { + } diff --git a/administrator/components/com_admin/controllers/profile.php b/administrator/components/com_admin/Controller/Profile.php similarity index 78% rename from administrator/components/com_admin/controllers/profile.php rename to administrator/components/com_admin/Controller/Profile.php index 0c7496f417f33..19f4892aa7a62 100644 --- a/administrator/components/com_admin/controllers/profile.php +++ b/administrator/components/com_admin/Controller/Profile.php @@ -6,15 +6,18 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\Controller; defined('_JEXEC') or die; +use Joomla\CMS\Controller\Form; + /** * User profile controller class. * * @since 1.6 */ -class AdminControllerProfile extends JControllerForm +class Profile extends Form { /** * Method to check if you can edit a record. @@ -30,7 +33,7 @@ class AdminControllerProfile extends JControllerForm */ protected function allowEdit($data = array(), $key = 'id') { - return isset($data['id']) && $data['id'] == JFactory::getUser()->id; + return isset($data['id']) && $data['id'] == $this->app->getIdentity()->id; } /** @@ -45,14 +48,14 @@ protected function allowEdit($data = array(), $key = 'id') */ public function save($key = null, $urlVar = null) { - $this->setRedirect(JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id=' . JFactory::getUser()->id, false)); + $this->setRedirect(\JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id=' . $this->app->getIdentity()->id, false)); $return = parent::save(); if ($this->getTask() != 'apply') { // Redirect to the main page. - $this->setRedirect(JRoute::_('index.php', false)); + $this->setRedirect(\JRoute::_('index.php', false)); } return $return; @@ -72,7 +75,7 @@ public function cancel($key = null) $return = parent::cancel($key); // Redirect to the main page. - $this->setRedirect(JRoute::_('index.php', false)); + $this->setRedirect(\JRoute::_('index.php', false)); return $return; } diff --git a/administrator/components/com_admin/models/help.php b/administrator/components/com_admin/Model/Help.php similarity index 85% rename from administrator/components/com_admin/models/help.php rename to administrator/components/com_admin/Model/Help.php index 9d08624249b92..e81db8c40ee8d 100644 --- a/administrator/components/com_admin/models/help.php +++ b/administrator/components/com_admin/Model/Help.php @@ -6,9 +6,12 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\Model; defined('_JEXEC') or die; +use Joomla\CMS\Help\Help as JHelp; +use Joomla\CMS\Model\Model; use Joomla\String\StringHelper; /** @@ -16,7 +19,7 @@ * * @since 1.6 */ -class AdminModelHelp extends JModelLegacy +class Help extends Model { /** * The search string @@ -69,7 +72,7 @@ public function &getHelpSearch() { if (is_null($this->help_search)) { - $this->help_search = JFactory::getApplication()->input->getString('helpsearch'); + $this->help_search = \JFactory::getApplication()->input->getString('helpsearch'); } return $this->help_search; @@ -86,7 +89,7 @@ public function &getPage() { if (is_null($this->page)) { - $this->page = JHelp::createUrl(JFactory::getApplication()->input->get('page', 'JHELP_START_HERE')); + $this->page = JHelp::createUrl(\JFactory::getApplication()->input->get('page', 'JHELP_START_HERE')); } return $this->page; @@ -103,7 +106,7 @@ public function getLangTag() { if (is_null($this->lang_tag)) { - $this->lang_tag = JFactory::getLanguage()->getTag(); + $this->lang_tag = \JFactory::getLanguage()->getTag(); if (!is_dir(JPATH_BASE . '/help/' . $this->lang_tag)) { @@ -131,7 +134,7 @@ public function &getToc() $lang_tag = $this->getLangTag(); $help_search = $this->getHelpSearch(); - // New style - Check for a TOC JSON file + // New style - Check for a TOC \JSON file if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')) { $data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json')); @@ -139,7 +142,7 @@ public function &getToc() // Loop through the data array foreach ($data as $key => $value) { - $this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value); + $this->toc[$key] = \JText::_('COM_ADMIN_HELP_' . $value); } // Sort the Table of Contents @@ -150,7 +153,7 @@ public function &getToc() // Get Help files jimport('joomla.filesystem.folder'); - $files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$'); + $files = \JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$'); $this->toc = array(); foreach ($files as $file) @@ -170,7 +173,7 @@ public function &getToc() } // Translate the page title - $title = JText::_($title); + $title = \JText::_($title); // Strip the extension $file = preg_replace('#\.xml$|\.html$#', '', $file); diff --git a/administrator/components/com_admin/models/profile.php b/administrator/components/com_admin/Model/Profile.php similarity index 80% rename from administrator/components/com_admin/models/profile.php rename to administrator/components/com_admin/Model/Profile.php index 9cc985eb23d01..8012b7cde4cf3 100644 --- a/administrator/components/com_admin/models/profile.php +++ b/administrator/components/com_admin/Model/Profile.php @@ -6,17 +6,21 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\Model; defined('_JEXEC') or die; -JLoader::register('UsersModelUser', JPATH_ADMINISTRATOR . '/components/com_users/models/user.php'); +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\Component\Users\Administrator\Model\User; /** * User model. * * @since 1.6 */ -class AdminModelProfile extends UsersModelUser +class Profile extends User { /** * Method to get the record form. @@ -24,7 +28,7 @@ class AdminModelProfile extends UsersModelUser * @param array $data An optional array of data for the form to interogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return JForm A JForm object on success, false on failure + * @return \JForm A \JForm object on success, false on failure * * @since 1.6 */ @@ -50,7 +54,7 @@ public function getForm($data = array(), $loadData = true) $this->setState('user.username.compliant', $isUsernameCompliant); - if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) + if (!ComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) { $form->setFieldAttribute('username', 'required', 'false'); $form->setFieldAttribute('username', 'readonly', 'true'); @@ -58,13 +62,13 @@ public function getForm($data = array(), $loadData = true) } // When multilanguage is set, a user's default site language should also be a Content Language - if (JLanguageMultilang::isEnabled()) + if (Multilanguage::isEnabled()) { $form->setFieldAttribute('language', 'type', 'frontend_language', 'params'); } // If the user needs to change their password, mark the password fields as required - if (JFactory::getUser()->requireReset) + if (\JFactory::getUser()->requireReset) { $form->setFieldAttribute('password', 'required', 'true'); $form->setFieldAttribute('password2', 'required', 'true'); @@ -83,7 +87,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_users.edit.user.data', array()); + $data = \JFactory::getApplication()->getUserState('com_users.edit.user.data', array()); if (empty($data)) { @@ -91,7 +95,7 @@ protected function loadFormData() } // Load the users plugins. - JPluginHelper::importPlugin('user'); + PluginHelper::importPlugin('user'); $this->preprocessData('com_admin.profile', $data); @@ -109,7 +113,7 @@ protected function loadFormData() */ public function getItem($pk = null) { - return parent::getItem(JFactory::getUser()->id); + return parent::getItem(\JFactory::getUser()->id); } /** @@ -123,7 +127,7 @@ public function getItem($pk = null) */ public function save($data) { - $user = JFactory::getUser(); + $user = \JFactory::getUser(); unset($data['id']); unset($data['groups']); @@ -132,7 +136,7 @@ public function save($data) $isUsernameCompliant = $this->getState('user.username.compliant'); - if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) + if (!ComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) { unset($data['username']); } diff --git a/administrator/components/com_admin/models/sysinfo.php b/administrator/components/com_admin/Model/Sysinfo.php similarity index 91% rename from administrator/components/com_admin/models/sysinfo.php rename to administrator/components/com_admin/Model/Sysinfo.php index 646377dd3d0d7..1bf27a724f36b 100644 --- a/administrator/components/com_admin/models/sysinfo.php +++ b/administrator/components/com_admin/Model/Sysinfo.php @@ -6,9 +6,13 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\Model; defined('_JEXEC') or die; +use Joomla\CMS\Component\ComponentHelper; +use Joomla\CMS\Model\Model; +use Joomla\CMS\Version; use Joomla\Registry\Registry; /** @@ -16,7 +20,7 @@ * * @since 1.6 */ -class AdminModelSysInfo extends JModelLegacy +class SysInfo extends Model { /** * Some PHP settings @@ -271,7 +275,7 @@ public function &getConfig() return $this->config; } - $registry = new Registry(new JConfig); + $registry = new Registry(new \JConfig); $this->config = $registry->toArray(); $hidden = array('host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass',); @@ -307,7 +311,7 @@ public function &getInfo() 'phpversion' => phpversion(), 'server' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : getenv('SERVER_SOFTWARE'), 'sapi_name' => php_sapi_name(), - 'version' => (new JVersion)->getLongVersion(), + 'version' => (new Version)->getLongVersion(), 'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', ); @@ -368,7 +372,7 @@ public function &getPHPInfo() { if (!$this->phpinfoEnabled()) { - $this->php_info = JText::_('COM_ADMIN_PHPINFO_DISABLED'); + $this->php_info = \JText::_('COM_ADMIN_PHPINFO_DISABLED'); return $this->php_info; } @@ -428,7 +432,7 @@ public function getPhpInfoArray() public function getExtensions() { $installed = array(); - $db = JFactory::getDbo(); + $db = \JFactory::getDbo(); $query = $db->getQuery(true) ->select('*') ->from($db->qn('#__extensions')); @@ -438,16 +442,16 @@ public function getExtensions() { $extensions = $db->loadObjectList(); } - catch (Exception $e) + catch (\Exception $e) { try { - JLog::add(JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), JLog::WARNING, 'jerror'); + \JLog::add(\JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), \JLog::WARNING, 'jerror'); } - catch (RuntimeException $exception) + catch (\RuntimeException $exception) { - JFactory::getApplication()->enqueueMessage( - JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), + \JFactory::getApplication()->enqueueMessage( + \JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), 'warning' ); } @@ -470,7 +474,7 @@ public function getExtensions() $installed[$extension->name] = array( 'name' => $extension->name, 'type' => $extension->type, - 'state' => $extension->enabled ? JText::_('JENABLED') : JText::_('JDISABLED'), + 'state' => $extension->enabled ? \JText::_('JENABLED') : \JText::_('JDISABLED'), 'author' => 'unknown', 'version' => 'unknown', 'creationDate' => 'unknown', @@ -479,7 +483,7 @@ public function getExtensions() $manifest = json_decode($extension->manifest_cache); - if (!$manifest instanceof stdClass) + if (!$manifest instanceof \stdClass) { continue; } @@ -515,14 +519,14 @@ public function getDirectory($public = false) $this->directories = array(); - $registry = JFactory::getConfig(); - $cparams = JComponentHelper::getParams('com_media'); + $registry = \JFactory::getApplication()->getConfig(); + $cparams = ComponentHelper::getParams('com_media'); $this->addDirectory('administrator/components', JPATH_ADMINISTRATOR . '/components'); $this->addDirectory('administrator/language', JPATH_ADMINISTRATOR . '/language'); // List all admin languages - $admin_langs = new DirectoryIterator(JPATH_ADMINISTRATOR . '/language'); + $admin_langs = new \DirectoryIterator(JPATH_ADMINISTRATOR . '/language'); foreach ($admin_langs as $folder) { @@ -538,7 +542,7 @@ public function getDirectory($public = false) } // List all manifests folders - $manifests = new DirectoryIterator(JPATH_ADMINISTRATOR . '/manifests'); + $manifests = new \DirectoryIterator(JPATH_ADMINISTRATOR . '/manifests'); foreach ($manifests as $folder) { @@ -561,7 +565,7 @@ public function getDirectory($public = false) $this->addDirectory($cparams->get('image_path'), JPATH_SITE . '/' . $cparams->get('image_path')); // List all images folders - $image_folders = new DirectoryIterator(JPATH_SITE . '/' . $cparams->get('image_path')); + $image_folders = new \DirectoryIterator(JPATH_SITE . '/' . $cparams->get('image_path')); foreach ($image_folders as $folder) { @@ -579,7 +583,7 @@ public function getDirectory($public = false) $this->addDirectory('language', JPATH_SITE . '/language'); // List all site languages - $site_langs = new DirectoryIterator(JPATH_SITE . '/language'); + $site_langs = new \DirectoryIterator(JPATH_SITE . '/language'); foreach ($site_langs as $folder) { @@ -597,7 +601,7 @@ public function getDirectory($public = false) $this->addDirectory('modules', JPATH_SITE . '/modules'); $this->addDirectory('plugins', JPATH_PLUGINS); - $plugin_groups = new DirectoryIterator(JPATH_SITE . '/plugins'); + $plugin_groups = new \DirectoryIterator(JPATH_SITE . '/plugins'); foreach ($plugin_groups as $folder) { @@ -685,7 +689,7 @@ public function &getEditor() return $this->editor; } - $this->editor = JFactory::getConfig()->get('editor'); + $this->editor = \JFactory::getApplication()->get('editor'); return $this->editor; } diff --git a/administrator/components/com_admin/views/help/view.html.php b/administrator/components/com_admin/View/Help/Html.php similarity index 90% rename from administrator/components/com_admin/views/help/view.html.php rename to administrator/components/com_admin/View/Help/Html.php index f872b010e0ea4..2d91416ad166d 100644 --- a/administrator/components/com_admin/views/help/view.html.php +++ b/administrator/components/com_admin/View/Help/Html.php @@ -6,15 +6,18 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\View\Help; defined('_JEXEC') or die; +use Joomla\CMS\View\HtmlView; + /** * HTML View class for the Admin component * * @since 1.6 */ -class AdminViewHelp extends JViewLegacy +class Html extends HtmlView { /** * The search string @@ -95,6 +98,6 @@ public function display($tpl = null) */ protected function addToolbar() { - JToolbarHelper::title(JText::_('COM_ADMIN_HELP'), 'support help_header'); + \JToolbarHelper::title(\JText::_('COM_ADMIN_HELP'), 'support help_header'); } } diff --git a/administrator/components/com_admin/views/profile/view.html.php b/administrator/components/com_admin/View/Profile/Html.php similarity index 72% rename from administrator/components/com_admin/views/profile/view.html.php rename to administrator/components/com_admin/View/Profile/Html.php index 9b9233379f1c6..80d2955754e6c 100644 --- a/administrator/components/com_admin/views/profile/view.html.php +++ b/administrator/components/com_admin/View/Profile/Html.php @@ -6,20 +6,24 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\View\Profile; defined('_JEXEC') or die; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\View\HtmlView; + /** * View class to allow users edit their own profile. * * @since 1.6 */ -class AdminViewProfile extends JViewLegacy +class Html extends HtmlView { /** - * The JForm object + * The \JForm object * - * @var JForm + * @var \JForm * @since 1.6 */ protected $form; @@ -58,7 +62,7 @@ public function display($tpl = null) // Check for errors. if (count($errors = $this->get('Errors'))) { - throw new JViewGenericdataexception(implode("\n", $errors), 500); + throw new \JViewGenericdataexception(implode("\n", $errors), 500); } $this->form->setValue('password', null); @@ -78,11 +82,11 @@ public function display($tpl = null) */ protected function addToolbar() { - JFactory::getApplication()->input->set('hidemainmenu', 1); + \JFactory::getApplication()->input->set('hidemainmenu', 1); - JToolbarHelper::title(JText::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile'); + ToolbarHelper::title(\JText::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile'); - JToolbarHelper::saveGroup( + ToolbarHelper::saveGroup( [ ['apply', 'profile.apply'], ['save', 'profile.save'] @@ -90,8 +94,8 @@ protected function addToolbar() 'btn-success' ); - JToolbarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE'); - JToolbarHelper::divider(); - JToolbarHelper::help('JHELP_ADMIN_USER_PROFILE_EDIT'); + ToolbarHelper::cancel('profile.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::divider(); + ToolbarHelper::help('JHELP_ADMIN_USER_PROFILE_EDIT'); } } diff --git a/administrator/components/com_admin/views/sysinfo/view.html.php b/administrator/components/com_admin/View/Sysinfo/Html.php similarity index 77% rename from administrator/components/com_admin/views/sysinfo/view.html.php rename to administrator/components/com_admin/View/Sysinfo/Html.php index bd07f7dcc9fde..b93adc99760fe 100644 --- a/administrator/components/com_admin/views/sysinfo/view.html.php +++ b/administrator/components/com_admin/View/Sysinfo/Html.php @@ -6,15 +6,19 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\View\Sysinfo; defined('_JEXEC') or die; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\View\HtmlView; + /** * Sysinfo View class for the Admin component * * @since 1.6 */ -class AdminViewSysinfo extends JViewLegacy +class Html extends HtmlView { /** * Some PHP settings @@ -68,9 +72,9 @@ class AdminViewSysinfo extends JViewLegacy public function display($tpl = null) { // Access check. - if (!JFactory::getUser()->authorise('core.admin')) + if (!\JFactory::getUser()->authorise('core.admin')) { - throw new JUserAuthorizationexception(JText::_('JERROR_ALERTNOAUTHOR'), 403); + throw new \JUserAuthorizationexception(\JText::_('JERROR_ALERTNOAUTHOR'), 403); } $this->php_settings = $this->get('PhpSettings'); @@ -93,9 +97,9 @@ public function display($tpl = null) */ protected function addToolbar() { - JToolbarHelper::title(JText::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-2 systeminfo'); - JToolbarHelper::link(JRoute::_('index.php?option=com_admin&view=sysinfo&format=text'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT', 'download'); - JToolbarHelper::link(JRoute::_('index.php?option=com_admin&view=sysinfo&format=json'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON', 'download'); - JToolbarHelper::help('JHELP_SITE_SYSTEM_INFORMATION'); + ToolbarHelper::title(\JText::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-2 systeminfo'); + ToolbarHelper::link(\JRoute::_('index.php?option=com_admin&view=sysinfo&format=text'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT', 'download'); + ToolbarHelper::link(\JRoute::_('index.php?option=com_admin&view=sysinfo&format=json'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON', 'download'); + ToolbarHelper::help('JHELP_SITE_SYSTEM_INFORMATION'); } } diff --git a/administrator/components/com_admin/views/sysinfo/view.json.php b/administrator/components/com_admin/View/Sysinfo/Json.php similarity index 79% rename from administrator/components/com_admin/views/sysinfo/view.json.php rename to administrator/components/com_admin/View/Sysinfo/Json.php index 78e03aa1428c3..37c695480ceae 100644 --- a/administrator/components/com_admin/views/sysinfo/view.json.php +++ b/administrator/components/com_admin/View/Sysinfo/Json.php @@ -6,15 +6,18 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\View\Sysinfo; defined('_JEXEC') or die; +use Joomla\CMS\View\AbstractView; + /** * Sysinfo View class for the Admin component * * @since 3.5 */ -class AdminViewSysinfo extends JViewLegacy +class Json extends AbstractView { /** * Execute and display a template script. @@ -28,9 +31,9 @@ class AdminViewSysinfo extends JViewLegacy public function display($tpl = null) { // Access check. - if (!JFactory::getUser()->authorise('core.admin')) + if (!\JFactory::getUser()->authorise('core.admin')) { - throw new JUserAuthorizationexception(JText::_('JERROR_ALERTNOAUTHOR'), 403); + throw new \JUserAuthorizationexception(\JText::_('JERROR_ALERTNOAUTHOR'), 403); } header('MIME-Version: 1.0'); @@ -41,7 +44,7 @@ public function display($tpl = null) echo json_encode($data); - JFactory::getApplication()->close(); + \JFactory::getApplication()->close(); } /** @@ -53,6 +56,7 @@ public function display($tpl = null) */ protected function getLayoutData() { + /* @var \Joomla\Component\Admin\Administrator\Model\SysInfo $model */ $model = $this->getModel(); return array( diff --git a/administrator/components/com_admin/views/sysinfo/view.text.php b/administrator/components/com_admin/View/Sysinfo/Text.php similarity index 83% rename from administrator/components/com_admin/views/sysinfo/view.text.php rename to administrator/components/com_admin/View/Sysinfo/Text.php index 7a8e2588790c9..431fc8d934615 100644 --- a/administrator/components/com_admin/views/sysinfo/view.text.php +++ b/administrator/components/com_admin/View/Sysinfo/Text.php @@ -6,6 +6,9 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Component\Admin\Administrator\View\Sysinfo; + +use Joomla\CMS\View\AbstractView; defined('_JEXEC') or die; @@ -14,7 +17,7 @@ * * @since 3.5 */ -class AdminViewSysinfo extends JViewLegacy +class Text extends AbstractView { /** * Execute and display a template script. @@ -28,9 +31,9 @@ class AdminViewSysinfo extends JViewLegacy public function display($tpl = null) { // Access check. - if (!JFactory::getUser()->authorise('core.admin')) + if (!\JFactory::getUser()->authorise('core.admin')) { - throw new JUserAuthorizationexception(JText::_('JERROR_ALERTNOAUTHOR'), 403); + throw new \JUserAuthorizationexception(\JText::_('JERROR_ALERTNOAUTHOR'), 403); } header('Content-Type: text/plain; charset=utf-8'); @@ -58,7 +61,7 @@ public function display($tpl = null) echo str_replace(JPATH_ROOT, 'xxxxxx', implode("\n\n", $lines)); - JFactory::getApplication()->close(); + \JFactory::getApplication()->close(); } /** @@ -70,31 +73,32 @@ public function display($tpl = null) */ protected function getLayoutData() { + /* @var \Joomla\Component\Admin\Administrator\Model\SysInfo $model */ $model = $this->getModel(); return array( 'info' => array( - 'title' => JText::_('COM_ADMIN_SYSTEM_INFORMATION', true), + 'title' => \JText::_('COM_ADMIN_SYSTEM_INFORMATION', true), 'data' => $model->getSafeData('info') ), 'phpSettings' => array( - 'title' => JText::_('COM_ADMIN_PHP_SETTINGS', true), + 'title' => \JText::_('COM_ADMIN_PHP_SETTINGS', true), 'data' => $model->getSafeData('phpSettings') ), 'config' => array( - 'title' => JText::_('COM_ADMIN_CONFIGURATION_FILE', true), + 'title' => \JText::_('COM_ADMIN_CONFIGURATION_FILE', true), 'data' => $model->getSafeData('config') ), 'directories' => array( - 'title' => JText::_('COM_ADMIN_DIRECTORY_PERMISSIONS', true), + 'title' => \JText::_('COM_ADMIN_DIRECTORY_PERMISSIONS', true), 'data' => $model->getSafeData('directory', true) ), 'phpInfo' => array( - 'title' => JText::_('COM_ADMIN_PHP_INFORMATION', true), + 'title' => \JText::_('COM_ADMIN_PHP_INFORMATION', true), 'data' => $model->getSafeData('phpInfoArray') ), 'extensions' => array( - 'title' => JText::_('COM_ADMIN_EXTENSIONS', true), + 'title' => \JText::_('COM_ADMIN_EXTENSIONS', true), 'data' => $model->getSafeData('extensions') ) ); diff --git a/administrator/components/com_admin/admin.php b/administrator/components/com_admin/admin.php deleted file mode 100644 index d178abe277ba1..0000000000000 --- a/administrator/components/com_admin/admin.php +++ /dev/null @@ -1,16 +0,0 @@ -execute(JFactory::getApplication()->input->get('task')); -$controller->redirect(); diff --git a/administrator/components/com_admin/dispatcher.php b/administrator/components/com_admin/dispatcher.php new file mode 100644 index 0000000000000..56f75c27a3e50 --- /dev/null +++ b/administrator/components/com_admin/dispatcher.php @@ -0,0 +1,39 @@ +