Код файла installer.php
defined('_JEXEC') or die;
JHtml::_('behavior.tabstate');
if (!JFactory::getUser()->authorise('core.manage', 'com_installer'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
$controller = JControllerLegacy::getInstance('Installer');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
Код файла controller.php
<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer Controller
*
* @since 1.5
*/
class InstallerController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php');
// Get the document object.
$document = JFactory::getDocument();
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'install');
$vFormat = $document->getType();
$lName = $this->input->get('layout', 'default', 'string');
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$view->ftp = &$ftp;
// Get the model for the view.
$model = $this->getModel($vName);
// Push the model into the view (as default).
$view->setModel($model, true);
$view->setLayout($lName);
// Push document object into the view.
$view->document = $document;
// Load the submenu.
InstallerHelper::addSubmenu($vName);
$view->display();
}
return $this;
}
}
Код файла config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="preferences"
label="COM_INSTALLER_PREFERENCES_LABEL"
description="COM_INSTALLER_PREFERENCES_DESCRIPTION"
>
<field
name="show_jed_info"
type="radio"
label="COM_INSTALLER_SHOW_JED_INFORMATION_LABEL"
description="COM_INSTALLER_SHOW_JED_INFORMATION_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">COM_INSTALLER_SHOW_JED_INFORMATION_SHOW_MESSAGE</option>
<option value="0">COM_INSTALLER_SHOW_JED_INFORMATION_HIDE_MESSAGE</option>
</field>
<field
name="cachetimeout"
type="integer"
label="COM_INSTALLER_CACHETIMEOUT_LABEL"
description="COM_INSTALLER_CACHETIMEOUT_DESC"
first="0"
last="24"
step="1"
default="6"
/>
<field
name="minimum_stability"
type="list"
label="COM_INSTALLER_MINIMUM_STABILITY_LABEL"
description="COM_INSTALLER_MINIMUM_STABILITY_DESC"
default="4"
>
<option value="0">COM_INSTALLER_MINIMUM_STABILITY_DEV</option>
<option value="1">COM_INSTALLER_MINIMUM_STABILITY_ALPHA</option>
<option value="2">COM_INSTALLER_MINIMUM_STABILITY_BETA</option>
<option value="3">COM_INSTALLER_MINIMUM_STABILITY_RC</option>
<option value="4">COM_INSTALLER_MINIMUM_STABILITY_STABLE</option>
</field>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_installer"
section="component"
/>
</fieldset>
</config>
Код файла installer.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_installer</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2005 - 2017 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_INSTALLER_XML_DESCRIPTION</description>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>installer.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_installer.ini</language>
<language tag="en-GB">language/en-GB.com_installer.sys.ini</language>
</languages>
</administration>
</extension>