Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
access.xml000064400000001166151161640610006534 0ustar00<?xml
version="1.0" encoding="utf-8" ?>
<access component="com_installer">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.options"
title="JACTION_OPTIONS"
description="JACTION_OPTIONS_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE"
description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE"
description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit.state"
title="JACTION_EDITSTATE"
description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>
config.xml000064400000003115151161640610006534 0ustar00<?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>
controller.php000064400000003277151161640610007452 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 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;
}
}
controllers/database.php000064400000002136151161640610011372
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer Database Controller
*
* @since 2.5
*/
class InstallerControllerDatabase extends JControllerLegacy
{
/**
* Tries to fix missing database updates
*
* @return void
*
* @since 2.5
* @todo Purge updates has to be replaced with an events system
*/
public function fix()
{
// Check for request forgeries.
$this->checkToken();
$model = $this->getModel('database');
$model->fix();
// Purge updates
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_joomlaupdate/models',
'JoomlaupdateModel');
$updateModel = JModelLegacy::getInstance('default',
'JoomlaupdateModel');
$updateModel->purge();
// Refresh versionable assets cache
JFactory::getApplication()->flushAssets();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=database',
false));
}
}
controllers/discover.php000064400000002452151161640610011445
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Discover Installation Controller
*
* @since 1.6
*/
class InstallerControllerDiscover extends JControllerLegacy
{
/**
* Refreshes the cache of discovered extensions.
*
* @return void
*
* @since 1.6
*/
public function refresh()
{
$this->checkToken();
$model = $this->getModel('discover');
$model->discover();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=discover',
false));
}
/**
* Install a discovered extension.
*
* @return void
*
* @since 1.6
*/
public function install()
{
$this->checkToken();
$this->getModel('discover')->discover_install();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=discover',
false));
}
/**
* Clean out the discovered extension cache.
*
* @return void
*
* @since 1.6
*/
public function purge()
{
$this->checkToken();
$model = $this->getModel('discover');
$model->purge();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=discover',
false), $model->_message);
}
}
controllers/install.php000064400000004514151161640610011276
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 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 for Joomla! installer class.
*
* @since 1.5
*/
class InstallerControllerInstall extends JControllerLegacy
{
/**
* Install an extension.
*
* @return boolean
*
* @since 1.5
*/
public function install()
{
// Check for request forgeries.
$this->checkToken();
/** @var InstallerModelInstall $model */
$model = $this->getModel('install');
// TODO: Reset the users acl here as well to kill off any missing bits.
$result = $model->install();
$app = JFactory::getApplication();
$redirect_url =
$app->getUserState('com_installer.redirect_url');
if (!$redirect_url)
{
$redirect_url = base64_decode($app->input->get('return',
null, 'BASE64'));
}
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect_url))
{
$redirect_url = '';
}
if (empty($redirect_url))
{
$redirect_url =
JRoute::_('index.php?option=com_installer&view=install',
false);
}
else
{
// Wipe out the user state when we're going to redirect.
$app->setUserState('com_installer.redirect_url',
'');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
}
$this->setRedirect($redirect_url);
return $result;
}
/**
* Install an extension from drag & drop ajax upload.
*
* @return void
*
* @since 3.7.0
*/
public function ajax_upload()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$message = $app->getUserState('com_installer.message');
// Do install
$result = $this->install();
// Get redirect URL
$redirect = $this->redirect;
// Push message queue to session because we will redirect page by
Javascript, not $app->redirect().
// The "application.queue" is only set in redirect() method, so
we must manually store it.
$app->getSession()->set('application.queue',
$app->getMessageQueue());
header('Content-Type: application/json');
echo new JResponseJson(array('redirect' => $redirect),
$message, !$result);
exit();
}
}
controllers/manage.php000064400000005544151161640610011064 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Installer Manage Controller
*
* @since 1.6
*/
class InstallerControllerManage extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('unpublish', 'publish');
$this->registerTask('publish', 'publish');
}
/**
* Enable/Disable an extension (if supported).
*
* @return void
*
* @since 1.6
*/
public function publish()
{
// Check for request forgeries.
$this->checkToken();
$ids = $this->input->get('cid', array(),
'array');
$values = array('publish' => 1, 'unpublish' =>
0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids))
{
JError::raiseWarning(500,
JText::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'));
}
else
{
// Get the model.
/** @var InstallerModelManage $model */
$model = $this->getModel('manage');
// Change the state of the records.
if (!$model->publish($ids, $value))
{
JError::raiseWarning(500, implode('<br />',
$model->getErrors()));
}
else
{
if ($value == 1)
{
$ntext = 'COM_INSTALLER_N_EXTENSIONS_PUBLISHED';
}
elseif ($value == 0)
{
$ntext = 'COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED';
}
$this->setMessage(JText::plural($ntext, count($ids)));
}
}
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage',
false));
}
/**
* Remove an extension (Uninstall).
*
* @return void
*
* @since 1.5
*/
public function remove()
{
// Check for request forgeries.
$this->checkToken();
$eid = $this->input->get('cid', array(),
'array');
/** @var InstallerModelManage $model */
$model = $this->getModel('manage');
$eid = ArrayHelper::toInteger($eid, array());
$model->remove($eid);
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage',
false));
}
/**
* Refreshes the cached metadata about an extension.
*
* Useful for debugging and testing purposes when the XML file might
change.
*
* @return void
*
* @since 1.6
*/
public function refresh()
{
// Check for request forgeries.
$this->checkToken();
$uid = $this->input->get('cid', array(),
'array');
$model = $this->getModel('manage');
$uid = ArrayHelper::toInteger($uid, array());
$model->refresh($uid);
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage',
false));
}
}
controllers/update.php000064400000011360151161640610011107 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Installer Update Controller
*
* @since 1.6
*/
class InstallerControllerUpdate extends JControllerLegacy
{
/**
* Update a set of extensions.
*
* @return void
*
* @since 1.6
*/
public function update()
{
// Check for request forgeries.
$this->checkToken();
/** @var InstallerModelUpdate $model */
$model = $this->getModel('update');
$uid = $this->input->get('cid', array(),
'array');
$uid = ArrayHelper::toInteger($uid, array());
// Get the minimum stability.
$component =
JComponentHelper::getComponent('com_installer');
$params = $component->params;
$minimum_stability = (int) $params->get('minimum_stability',
JUpdater::STABILITY_STABLE);
$model->update($uid, $minimum_stability);
$app = JFactory::getApplication();
$redirect_url =
$app->getUserState('com_installer.redirect_url');
// Don't redirect to an external URL.
if (!JUri::isInternal($redirect_url))
{
$redirect_url = '';
}
if (empty($redirect_url))
{
$redirect_url =
JRoute::_('index.php?option=com_installer&view=update',
false);
}
else
{
// Wipe out the user state when we're going to redirect.
$app->setUserState('com_installer.redirect_url',
'');
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
}
$this->setRedirect($redirect_url);
}
/**
* Find new updates.
*
* @return void
*
* @since 1.6
*/
public function find()
{
$this->checkToken('request');
// Get the caching duration.
$component =
JComponentHelper::getComponent('com_installer');
$params = $component->params;
$cache_timeout = (int) $params->get('cachetimeout', 6);
$cache_timeout = 3600 * $cache_timeout;
// Get the minimum stability.
$minimum_stability = (int) $params->get('minimum_stability',
JUpdater::STABILITY_STABLE);
// Find updates.
/** @var InstallerModelUpdate $model */
$model = $this->getModel('update');
$disabledUpdateSites = $model->getDisabledUpdateSites();
if ($disabledUpdateSites)
{
$updateSitesUrl =
JRoute::_('index.php?option=com_installer&view=updatesites');
$this->setMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATE_SITES_COUNT_CHECK',
$updateSitesUrl), 'warning');
}
$model->findUpdates(0, $cache_timeout, $minimum_stability);
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=update',
false));
}
/**
* Purges updates.
*
* @return void
*
* @since 1.6
*/
public function purge()
{
// Check for request forgeries.
$this->checkToken();
$model = $this->getModel('update');
$model->purge();
/**
* We no longer need to enable update sites in Joomla! 3.4 as we now
allow the users to manage update sites
* themselves.
* $model->enableSites();
*/
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=update',
false), $model->_message);
}
/**
* Fetch and report updates in JSON format, for AJAX requests
*
* @return void
*
* @since 2.5
*/
public function ajax()
{
$app = JFactory::getApplication();
if (!JSession::checkToken('get'))
{
$app->setHeader('status', 403, true);
$app->sendHeaders();
echo JText::_('JINVALID_TOKEN_NOTICE');
$app->close();
}
$eid = $this->input->getInt('eid', 0);
$skip = $this->input->get('skip', array(),
'array');
$cache_timeout =
$this->input->getInt('cache_timeout', 0);
$minimum_stability =
$this->input->getInt('minimum_stability', -1);
$component =
JComponentHelper::getComponent('com_installer');
$params = $component->params;
if ($cache_timeout == 0)
{
$cache_timeout = (int) $params->get('cachetimeout', 6);
$cache_timeout = 3600 * $cache_timeout;
}
if ($minimum_stability < 0)
{
$minimum_stability = (int)
$params->get('minimum_stability', JUpdater::STABILITY_STABLE);
}
/** @var InstallerModelUpdate $model */
$model = $this->getModel('update');
$model->findUpdates($eid, $cache_timeout, $minimum_stability);
$model->setState('list.start', 0);
$model->setState('list.limit', 0);
if ($eid != 0)
{
$model->setState('filter.extension_id', $eid);
}
$updates = $model->getItems();
if (!empty($skip))
{
$unfiltered_updates = $updates;
$updates = array();
foreach ($unfiltered_updates as $update)
{
if (!in_array($update->extension_id, $skip))
{
$updates[] = $update;
}
}
}
echo json_encode($updates);
$app->close();
}
}
controllers/updatesites.php000064400000005500151161640610012156
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Installer Update Sites Controller
*
* @package Joomla.Administrator
* @subpackage com_installer
* @since 3.4
*/
class InstallerControllerUpdatesites extends JControllerLegacy
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 3.4
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('unpublish', 'publish');
$this->registerTask('publish', 'publish');
$this->registerTask('delete', 'delete');
$this->registerTask('rebuild', 'rebuild');
}
/**
* Enable/Disable an extension (if supported).
*
* @return void
*
* @since 3.4
*
* @throws Exception on error
*/
public function publish()
{
// Check for request forgeries.
$this->checkToken();
$ids = $this->input->get('cid', array(),
'array');
$values = array('publish' => 1, 'unpublish' =>
0);
$task = $this->getTask();
$value = ArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids))
{
throw new
Exception(JText::_('COM_INSTALLER_ERROR_NO_UPDATESITES_SELECTED'),
500);
}
// Get the model.
$model = $this->getModel('Updatesites');
// Change the state of the records.
if (!$model->publish($ids, $value))
{
throw new Exception(implode('<br />',
$model->getErrors()), 500);
}
$ntext = ($value == 0) ?
'COM_INSTALLER_N_UPDATESITES_UNPUBLISHED' :
'COM_INSTALLER_N_UPDATESITES_PUBLISHED';
$this->setMessage(JText::plural($ntext, count($ids)));
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites',
false));
}
/**
* Deletes an update site (if supported).
*
* @return void
*
* @since 3.6
*
* @throws Exception on error
*/
public function delete()
{
// Check for request forgeries.
$this->checkToken();
$ids = $this->input->get('cid', array(),
'array');
if (empty($ids))
{
throw new
Exception(JText::_('COM_INSTALLER_ERROR_NO_UPDATESITES_SELECTED'),
500);
}
// Delete the records.
$this->getModel('Updatesites')->delete($ids);
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites',
false));
}
/**
* Rebuild update sites tables.
*
* @return void
*
* @since 3.6
*/
public function rebuild()
{
// Check for request forgeries.
$this->checkToken();
// Rebuild the update sites.
$this->getModel('Updatesites')->rebuild();
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites',
false));
}
}
helpers/html/manage.php000064400000002774151161640610011126
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer HTML class.
*
* @since 2.5
*/
abstract class InstallerHtmlManage
{
/**
* Returns a published state on a grid.
*
* @param integer $value The state value.
* @param integer $i The row index.
* @param boolean $enabled An optional setting for access control on
the action.
* @param string $checkbox An optional prefix for checkboxes.
*
* @return string The Html code
*
* @see JHtmlJGrid::state
*
* @since 2.5
*/
public static function state($value, $i, $enabled = true, $checkbox =
'cb')
{
$states = array(
2 => array(
'',
'COM_INSTALLER_EXTENSION_PROTECTED',
'',
'COM_INSTALLER_EXTENSION_PROTECTED',
true,
'protected',
'protected',
),
1 => array(
'unpublish',
'COM_INSTALLER_EXTENSION_ENABLED',
'COM_INSTALLER_EXTENSION_DISABLE',
'COM_INSTALLER_EXTENSION_ENABLED',
true,
'publish',
'publish',
),
0 => array(
'publish',
'COM_INSTALLER_EXTENSION_DISABLED',
'COM_INSTALLER_EXTENSION_ENABLE',
'COM_INSTALLER_EXTENSION_DISABLED',
true,
'unpublish',
'unpublish',
),
);
return JHtml::_('jgrid.state', $states, $value, $i,
'manage.', $enabled, true, $checkbox);
}
}
helpers/html/updatesites.php000064400000002546151161640610012225
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer HTML class.
*
* @since 3.5
*/
abstract class InstallerHtmlUpdatesites
{
/**
* Returns a published state on a grid.
*
* @param integer $value The state value.
* @param integer $i The row index.
* @param boolean $enabled An optional setting for access control on
the action.
* @param string $checkbox An optional prefix for checkboxes.
*
* @return string The HTML code
*
* @see JHtmlJGrid::state()
* @since 3.5
*/
public static function state($value, $i, $enabled = true, $checkbox =
'cb')
{
$states = array(
1 => array(
'unpublish',
'COM_INSTALLER_UPDATESITE_ENABLED',
'COM_INSTALLER_UPDATESITE_DISABLE',
'COM_INSTALLER_UPDATESITE_ENABLED',
true,
'publish',
'publish',
),
0 => array(
'publish',
'COM_INSTALLER_UPDATESITE_DISABLED',
'COM_INSTALLER_UPDATESITE_ENABLE',
'COM_INSTALLER_UPDATESITE_DISABLED',
true,
'unpublish',
'unpublish',
),
);
return JHtml::_('jgrid.state', $states, $value, $i,
'updatesites.', $enabled, true, $checkbox);
}
}
helpers/installer.php000064400000010534151161640610010720 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer helper.
*
* @since 1.6
*/
class InstallerHelper
{
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
*/
public static function addSubmenu($vName = 'install')
{
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_INSTALL'),
'index.php?option=com_installer',
$vName == 'install'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_UPDATE'),
'index.php?option=com_installer&view=update',
$vName == 'update'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_MANAGE'),
'index.php?option=com_installer&view=manage',
$vName == 'manage'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_DISCOVER'),
'index.php?option=com_installer&view=discover',
$vName == 'discover'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_DATABASE'),
'index.php?option=com_installer&view=database',
$vName == 'database'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_WARNINGS'),
'index.php?option=com_installer&view=warnings',
$vName == 'warnings'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_LANGUAGES'),
'index.php?option=com_installer&view=languages',
$vName == 'languages'
);
JHtmlSidebar::addEntry(
JText::_('COM_INSTALLER_SUBMENU_UPDATESITES'),
'index.php?option=com_installer&view=updatesites',
$vName == 'updatesites'
);
}
/**
* Get a list of filter options for the extension types.
*
* @return array An array of stdClass objects.
*
* @since 3.0
*/
public static function getExtensionTypes()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT type')
->from('#__extensions');
$db->setQuery($query);
$types = $db->loadColumn();
$options = array();
foreach ($types as $type)
{
$options[] = JHtml::_('select.option', $type,
JText::_('COM_INSTALLER_TYPE_' . strtoupper($type)));
}
return $options;
}
/**
* Get a list of filter options for the extension types.
*
* @return array An array of stdClass objects.
*
* @since 3.0
*/
public static function getExtensionGroupes()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('DISTINCT folder')
->from('#__extensions')
->where('folder != ' . $db->quote(''))
->order('folder');
$db->setQuery($query);
$folders = $db->loadColumn();
$options = array();
foreach ($folders as $folder)
{
$options[] = JHtml::_('select.option', $folder, $folder);
}
return $options;
}
/**
* Gets a list of the actions that can be performed.
*
* @return JObject
*
* @since 1.6
* @deprecated 3.2 Use JHelperContent::getActions() instead
*/
public static function getActions()
{
// Log usage of deprecated function
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperContent::getActions() with
new arguments order instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
// Get list of actions
return JHelperContent::getActions('com_installer');
}
/**
* Get a list of filter options for the application clients.
*
* @return array An array of JHtmlOption elements.
*
* @since 3.5
*/
public static function getClientOptions()
{
// Build the filter options.
$options = array();
$options[] = JHtml::_('select.option', '0',
JText::_('JSITE'));
$options[] = JHtml::_('select.option', '1',
JText::_('JADMINISTRATOR'));
return $options;
}
/**
* Get a list of filter options for the application statuses.
*
* @return array An array of JHtmlOption elements.
*
* @since 3.5
*/
public static function getStateOptions()
{
// Build the filter options.
$options = array();
$options[] = JHtml::_('select.option', '0',
JText::_('JDISABLED'));
$options[] = JHtml::_('select.option', '1',
JText::_('JENABLED'));
$options[] = JHtml::_('select.option', '2',
JText::_('JPROTECTED'));
$options[] = JHtml::_('select.option', '3',
JText::_('JUNPROTECTED'));
return $options;
}
}
installer.php000064400000001151151161640610007251 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
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();
installer.xml000064400000002011151161640610007256 0ustar00<?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 - 2020 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>
models/database.php000064400000017210151161640610010306 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JLoader::register('InstallerModel', __DIR__ .
'/extension.php');
JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR .
'/components/com_admin/script.php');
/**
* Installer Database Model
*
* @since 1.6
*/
class InstallerModelDatabase extends InstallerModel
{
protected $_context = 'com_installer.discover';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = 'name', $direction
= 'asc')
{
$app = JFactory::getApplication();
$this->setState('message',
$app->getUserState('com_installer.message'));
$this->setState('extension_message',
$app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
// Prepare the utf8mb4 conversion check table
$this->prepareUtf8mb4StatusTable();
parent::populateState($ordering, $direction);
}
/**
* Fixes database problems.
*
* @return void
*/
public function fix()
{
if (!$changeSet = $this->getItems())
{
return false;
}
$changeSet->fix();
$this->fixSchemaVersion($changeSet);
$this->fixUpdateVersion();
$installer = new JoomlaInstallerScript;
$installer->deleteUnexistingFiles();
$this->fixDefaultTextFilters();
/*
* Finally, if the schema updates succeeded, make sure the database is
* converted to utf8mb4 or, if not supported by the server, compatible to
it.
*/
$statusArray = $changeSet->getStatus();
if (count($statusArray['error']) == 0)
{
$installer->convertTablesToUtf8mb4(false);
}
}
/**
* Gets the changeset object.
*
* @return JSchemaChangeset
*/
public function getItems()
{
$folder = JPATH_ADMINISTRATOR .
'/components/com_admin/sql/updates/';
try
{
$changeSet = JSchemaChangeset::getInstance($this->getDbo(), $folder);
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage(),
'warning');
return false;
}
return $changeSet;
}
/**
* Method to get a JPagination object for the data set.
*
* @return boolean
*
* @since 3.0.1
*/
public function getPagination()
{
return true;
}
/**
* Get version from #__schemas table.
*
* @return mixed the return value from the query, or null if the query
fails.
*
* @throws Exception
*/
public function getSchemaVersion()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('version_id')
->from($db->quoteName('#__schemas'))
->where('extension_id = 700');
$db->setQuery($query);
$result = $db->loadResult();
return $result;
}
/**
* Fix schema version if wrong.
*
* @param JSchemaChangeSet $changeSet Schema change set.
*
* @return mixed string schema version if success, false if fail.
*/
public function fixSchemaVersion($changeSet)
{
// Get correct schema version -- last file in array.
$schema = $changeSet->getSchema();
// Check value. If ok, don't do update.
if ($schema == $this->getSchemaVersion())
{
return $schema;
}
// Delete old row.
$db = $this->getDbo();
$query = $db->getQuery(true)
->delete($db->quoteName('#__schemas'))
->where($db->quoteName('extension_id') . ' =
700');
$db->setQuery($query);
$db->execute();
// Add new row.
$query->clear()
->insert($db->quoteName('#__schemas'))
->columns($db->quoteName('extension_id') . ','
. $db->quoteName('version_id'))
->values('700, ' . $db->quote($schema));
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
return false;
}
return $schema;
}
/**
* Get current version from #__extensions table.
*
* @return mixed version if successful, false if fail.
*/
public function getUpdateVersion()
{
$table = JTable::getInstance('Extension');
$table->load('700');
$cache = new Registry($table->manifest_cache);
return $cache->get('version');
}
/**
* Fix Joomla version in #__extensions table if wrong (doesn't equal
JVersion short version).
*
* @return mixed string update version if success, false if fail.
*/
public function fixUpdateVersion()
{
$table = JTable::getInstance('Extension');
$table->load('700');
$cache = new Registry($table->manifest_cache);
$updateVersion = $cache->get('version');
$cmsVersion = new JVersion;
if ($updateVersion == $cmsVersion->getShortVersion())
{
return $updateVersion;
}
$cache->set('version', $cmsVersion->getShortVersion());
$table->manifest_cache = $cache->toString();
if ($table->store())
{
return $cmsVersion->getShortVersion();
}
return false;
}
/**
* For version 2.5.x only
* Check if com_config parameters are blank.
*
* @return string default text filters (if any).
*/
public function getDefaultTextFilters()
{
$table = JTable::getInstance('Extension');
$table->load($table->find(array('name' =>
'com_config')));
return $table->params;
}
/**
* For version 2.5.x only
* Check if com_config parameters are blank. If so, populate with
com_content text filters.
*
* @return mixed boolean true if params are updated, null otherwise.
*/
public function fixDefaultTextFilters()
{
$table = JTable::getInstance('Extension');
$table->load($table->find(array('name' =>
'com_config')));
// Check for empty $config and non-empty content filters.
if (!$table->params)
{
// Get filters from com_content and store if you find them.
$contentParams = JComponentHelper::getParams('com_content');
if ($contentParams->get('filters'))
{
$newParams = new Registry;
$newParams->set('filters',
$contentParams->get('filters'));
$table->params = (string) $newParams;
$table->store();
return true;
}
}
}
/**
* Prepare the table to save the status of utf8mb4 conversion
* Make sure it contains 1 initialized record if there is not
* already exactly 1 record.
*
* @return void
*
* @since 3.5
*/
private function prepareUtf8mb4StatusTable()
{
$db = JFactory::getDbo();
$serverType = $db->getServerType();
if ($serverType != 'mysql')
{
return;
}
$creaTabSql = 'CREATE TABLE IF NOT EXISTS ' .
$db->quoteName('#__utf8_conversion')
. ' (' . $db->quoteName('converted') . '
tinyint(4) NOT NULL DEFAULT 0'
. ') ENGINE=InnoDB';
if ($db->hasUTF8mb4Support())
{
$creaTabSql = $creaTabSql
. ' DEFAULT CHARSET=utf8mb4 DEFAULT
COLLATE=utf8mb4_unicode_ci;';
}
else
{
$creaTabSql = $creaTabSql
. ' DEFAULT CHARSET=utf8 DEFAULT COLLATE=utf8_unicode_ci;';
}
$db->setQuery($creaTabSql)->execute();
$db->setQuery('SELECT COUNT(*) FROM ' .
$db->quoteName('#__utf8_conversion') . ';');
$count = $db->loadResult();
if ($count > 1)
{
// Table messed up somehow, clear it
$db->setQuery('DELETE FROM ' .
$db->quoteName('#__utf8_conversion') . ';')
->execute();
$db->setQuery('INSERT INTO ' .
$db->quoteName('#__utf8_conversion')
. ' (' . $db->quoteName('converted') . ')
VALUES (0);'
)->execute();
}
elseif ($count == 0)
{
// Record missing somehow, fix this
$db->setQuery('INSERT INTO ' .
$db->quoteName('#__utf8_conversion')
. ' (' . $db->quoteName('converted') . ')
VALUES (0);'
)->execute();
}
}
}
models/discover.php000064400000014565151161640610010372 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
JLoader::register('InstallerModel', __DIR__ .
'/extension.php');
/**
* Installer Discover Model
*
* @since 1.6
*/
class InstallerModelDiscover extends InstallerModel
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 3.5
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'name',
'client_id',
'client', 'client_translated',
'type', 'type_translated',
'folder', 'folder_translated',
'extension_id',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 3.1
*/
protected function populateState($ordering = 'name', $direction
= 'asc')
{
$app = JFactory::getApplication();
// Load the filter state.
$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
$this->setState('filter.client_id',
$this->getUserStateFromRequest($this->context .
'.filter.client_id', 'filter_client_id', null,
'int'));
$this->setState('filter.type',
$this->getUserStateFromRequest($this->context .
'.filter.type', 'filter_type', '',
'string'));
$this->setState('filter.folder',
$this->getUserStateFromRequest($this->context .
'.filter.folder', 'filter_folder', '',
'string'));
$this->setState('message',
$app->getUserState('com_installer.message'));
$this->setState('extension_message',
$app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
parent::populateState($ordering, $direction);
}
/**
* Method to get the database query.
*
* @return JDatabaseQuery the database query
*
* @since 3.1
*/
protected function getListQuery()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__extensions'))
->where($db->quoteName('state') . ' = -1');
// Process select filters.
$type = $this->getState('filter.type');
$clientId = $this->getState('filter.client_id');
$folder = $this->getState('filter.folder');
if ($type)
{
$query->where($db->quoteName('type') . ' = ' .
$db->quote($type));
}
if ($clientId != '')
{
$query->where($db->quoteName('client_id') . ' =
' . (int) $clientId);
}
if ($folder != '' && in_array($type,
array('plugin', 'library', '')))
{
$query->where($db->quoteName('folder') . ' = '
. $db->quote($folder == '*' ? '' : $folder));
}
// Process search filter.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'id:') === 0)
{
$query->where($db->quoteName('extension_id') . ' =
' . (int) substr($search, 3));
}
}
// Note: The search for name, ordering and pagination are processed by
the parent InstallerModel class (in extension.php).
return $query;
}
/**
* Discover extensions.
*
* Finds uninstalled extensions
*
* @return void
*
* @since 1.6
*/
public function discover()
{
// Purge the list of discovered extensions and fetch them again.
$this->purge();
$results = JInstaller::getInstance()->discover();
// Get all templates, including discovered ones
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('extension_id',
'element', 'folder', 'client_id',
'type')))
->from($db->quoteName('#__extensions'));
$db->setQuery($query);
$installedtmp = $db->loadObjectList();
$extensions = array();
foreach ($installedtmp as $install)
{
$key = implode(':', array($install->type,
$install->element, $install->folder, $install->client_id));
$extensions[$key] = $install;
}
foreach ($results as $result)
{
// Check if we have a match on the element
$key = implode(':', array($result->type,
$result->element, $result->folder, $result->client_id));
if (!array_key_exists($key, $extensions))
{
// Put it into the table
$result->check();
$result->store();
}
}
}
/**
* Installs a discovered extension.
*
* @return void
*
* @since 1.6
*/
public function discover_install()
{
$app = JFactory::getApplication();
$input = $app->input;
$eid = $input->get('cid', 0, 'array');
if (is_array($eid) || $eid)
{
if (!is_array($eid))
{
$eid = array($eid);
}
$eid = ArrayHelper::toInteger($eid);
$failed = false;
foreach ($eid as $id)
{
$installer = new JInstaller;
$result = $installer->discover_install($id);
if (!$result)
{
$failed = true;
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_INSTALLFAILED')
. ': ' . $id);
}
}
// TODO - We are only receiving the message for the last JInstaller
instance
$this->setState('action', 'remove');
$this->setState('name',
$installer->get('name'));
$app->setUserState('com_installer.message',
$installer->message);
$app->setUserState('com_installer.extension_message',
$installer->get('extension_message'));
if (!$failed)
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_INSTALLSUCCESSFUL'));
}
}
else
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_NOEXTENSIONSELECTED'));
}
}
/**
* Cleans out the list of discovered extensions.
*
* @return boolean True on success
*
* @since 1.6
*/
public function purge()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->delete($db->quoteName('#__extensions'))
->where($db->quoteName('state') . ' = -1');
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
$this->_message =
JText::_('COM_INSTALLER_MSG_DISCOVER_FAILEDTOPURGEEXTENSIONS');
return false;
}
$this->_message =
JText::_('COM_INSTALLER_MSG_DISCOVER_PURGEDDISCOVEREDEXTENSIONS');
return true;
}
}
models/extension.php000064400000015326151161640610010564 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Extension Manager Abstract Extension Model.
*
* @since 1.5
*/
class InstallerModel extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'name',
'client_id',
'client', 'client_translated',
'enabled',
'type', 'type_translated',
'folder', 'folder_translated',
'extension_id',
);
}
parent::__construct($config);
}
/**
* Returns an object list
*
* @param string $query The query
* @param int $limitstart Offset
* @param int $limit The number of records
*
* @return array
*/
protected function _getList($query, $limitstart = 0, $limit = 0)
{
$listOrder = $this->getState('list.ordering',
'name');
$listDirn = $this->getState('list.direction',
'asc');
// Replace slashes so preg_match will work
$search = $this->getState('filter.search');
$search = str_replace('/', ' ', $search);
$db = $this->getDbo();
// Define which fields have to be processed in a custom way because of
translation.
$customOrderFields = array('name',
'client_translated', 'type_translated',
'folder_translated');
// Process searching, ordering and pagination for fields that need to be
translated.
if (in_array($listOrder, $customOrderFields) || (!empty($search)
&& stripos($search, 'id:') !== 0))
{
// Get results from database and translate them.
$db->setQuery($query);
$result = $db->loadObjectList();
$this->translate($result);
// Process searching.
if (!empty($search) && stripos($search, 'id:') !== 0)
{
$escapedSearchString = $this->refineSearchStringToRegex($search,
'/');
// By default search only the extension name field.
$searchFields = array('name');
// If in update sites view search also in the update site name field.
if ($this instanceof InstallerModelUpdatesites)
{
$searchFields[] = 'update_site_name';
}
foreach ($result as $i => $item)
{
// Check if search string exists in any of the fields to be searched.
$found = 0;
foreach ($searchFields as $key => $field)
{
if (!$found && preg_match('/' .
$escapedSearchString . '/i', $item->{$field}))
{
$found = 1;
}
}
// If search string was not found in any of the fields searched remove
it from results array.
if (!$found)
{
unset($result[$i]);
}
}
}
// Process ordering.
// Sort array object by selected ordering and selected direction. Sort
is case insensitive and using locale sorting.
$result = ArrayHelper::sortObjects($result, $listOrder,
strtolower($listDirn) == 'desc' ? -1 : 1, false, true);
// Process pagination.
$total = count($result);
$this->cache[$this->getStoreId('getTotal')] = $total;
if ($total <= $limitstart)
{
$limitstart = 0;
$this->setState('list.limitstart', 0);
}
return array_slice($result, $limitstart, $limit ?: null);
}
// Process searching, ordering and pagination for regular database
fields.
$query->order($db->quoteName($listOrder) . ' ' .
$db->escape($listDirn));
$result = parent::_getList($query, $limitstart, $limit);
$this->translate($result);
return $result;
}
/**
* Translate a list of objects
*
* @param array $items The array of objects
*
* @return array The array of translated objects
*/
protected function translate(&$items)
{
$lang = JFactory::getLanguage();
foreach ($items as &$item)
{
if (strlen($item->manifest_cache) && $data =
json_decode($item->manifest_cache))
{
foreach ($data as $key => $value)
{
if ($key == 'type')
{
// Ignore the type field
continue;
}
$item->$key = $value;
}
}
$item->author_info = @$item->authorEmail . '<br
/>' . @$item->authorUrl;
$item->client = $item->client_id ?
JText::_('JADMINISTRATOR') : JText::_('JSITE');
$item->client_translated = $item->client;
$item->type_translated = JText::_('COM_INSTALLER_TYPE_' .
strtoupper($item->type));
$item->folder_translated = @$item->folder ? $item->folder :
JText::_('COM_INSTALLER_TYPE_NONAPPLICABLE');
$path = $item->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE;
switch ($item->type)
{
case 'component':
$extension = $item->element;
$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null,
false, true)
|| $lang->load("$extension.sys", $source, null, false,
true);
break;
case 'file':
$extension = 'files_' . $item->element;
$lang->load("$extension.sys", JPATH_SITE, null, false,
true);
break;
case 'library':
$parts = explode('/', $item->element);
$vendor = (isset($parts[1]) ? $parts[0] : null);
$extension = 'lib_' . ($vendor ? implode('_',
$parts) : $item->element);
if (!$lang->load("$extension.sys", $path, null, false,
true))
{
$source = $path . '/libraries/' . ($vendor ? $vendor .
'/' . $parts[1] : $item->element);
$lang->load("$extension.sys", $source, null, false,
true);
}
break;
case 'module':
$extension = $item->element;
$source = $path . '/modules/' . $extension;
$lang->load("$extension.sys", $path, null, false, true)
|| $lang->load("$extension.sys", $source, null, false,
true);
break;
case 'plugin':
$extension = 'plg_' . $item->folder . '_' .
$item->element;
$source = JPATH_PLUGINS . '/' . $item->folder .
'/' . $item->element;
$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null,
false, true)
|| $lang->load("$extension.sys", $source, null, false,
true);
break;
case 'template':
$extension = 'tpl_' . $item->element;
$source = $path . '/templates/' . $item->element;
$lang->load("$extension.sys", $path, null, false, true)
|| $lang->load("$extension.sys", $source, null, false,
true);
break;
case 'package':
default:
$extension = $item->element;
$lang->load("$extension.sys", JPATH_SITE, null, false,
true);
break;
}
// Translate the extension name if possible
$item->name = JText::_($item->name);
settype($item->description, 'string');
if (!in_array($item->type, array('language')))
{
$item->description = JText::_($item->description);
}
}
}
}
models/fields/extensionstatus.php000064400000001621151161640610013267
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR .
'/components/com_installer/helpers/installer.php');
JFormHelper::loadFieldClass('list');
/**
* Extension Status field.
*
* @since 3.5
*/
class JFormFieldExtensionStatus extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.5
*/
protected $type = 'ExtensionStatus';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 3.5
*/
public function getOptions()
{
$options = InstallerHelper::getStateOptions();
return array_merge(parent::getOptions(), $options);
}
}
models/fields/folder.php000064400000001571151161640610011266
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR .
'/components/com_installer/helpers/installer.php');
JFormHelper::loadFieldClass('list');
/**
* Folder field.
*
* @since 3.5
*/
class JFormFieldFolder extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.5
*/
protected $type = 'Folder';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 3.5
*/
public function getOptions()
{
$options = InstallerHelper::getExtensionGroupes();
return array_merge(parent::getOptions(), $options);
}
}
models/fields/location.php000064400000001574151161640610011626
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR .
'/components/com_installer/helpers/installer.php');
JFormHelper::loadFieldClass('list');
/**
* Location field.
*
* @since 3.5
*/
class JFormFieldLocation extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.5
*/
protected $type = 'Location';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 3.5
*/
public function getOptions()
{
$options = InstallerHelper::getClientOptions();
return array_merge(parent::getOptions(), $options);
}
}
models/fields/type.php000064400000001617151161640610010775 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR .
'/components/com_installer/helpers/installer.php');
JFormHelper::loadFieldClass('list');
/**
* Form field for a list of extension types.
*
* @since 3.5
*/
class JFormFieldType extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 3.5
*/
protected $type = 'Type';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 3.5
*/
public function getOptions()
{
$options = InstallerHelper::getExtensionTypes();
return array_merge(parent::getOptions(), $options);
}
}
models/forms/filter_discover.xml000064400000004036151161640610013066
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_installer/models/fields"/>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_DISCOVER_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_DISCOVER_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="client_id"
type="location"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_CLIENT_SELECT</option>
</field>
<field
name="type"
type="type"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_TYPE_SELECT</option>
</field>
<field
name="folder"
type="folder"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_FOLDER_SELECT</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="name
ASC">COM_INSTALLER_HEADING_NAME_ASC</option>
<option value="name
DESC">COM_INSTALLER_HEADING_NAME_DESC</option>
<option value="client_translated
ASC">COM_INSTALLER_HEADING_LOCATION_ASC</option>
<option value="client_translated
DESC">COM_INSTALLER_HEADING_LOCATION_DESC</option>
<option value="type_translated
ASC">COM_INSTALLER_HEADING_TYPE_ASC</option>
<option value="type_translated
DESC">COM_INSTALLER_HEADING_TYPE_DESC</option>
<option value="folder_translated
ASC">COM_INSTALLER_HEADING_FOLDER_ASC</option>
<option value="folder_translated
DESC">COM_INSTALLER_HEADING_FOLDER_DESC</option>
<option value="extension_id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="extension_id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIMIT"
description="JGLOBAL_LIMIT"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
models/forms/filter_languages.xml000064400000002027151161640610013214
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_LANGUAGES_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_LANGUAGES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="name
ASC">JGRID_HEADING_LANGUAGE_ASC</option>
<option value="name
DESC">JGRID_HEADING_LANGUAGE_DESC</option>
<option value="element
ASC">COM_INSTALLER_HEADING_LANGUAGE_TAG_ASC</option>
<option value="element
DESC">COM_INSTALLER_HEADING_LANGUAGE_TAG_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIMIT"
description="JGLOBAL_LIMIT"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
models/forms/filter_manage.xml000064400000005035151161640610012500
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_installer/models/fields"
/>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_MANAGE_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_MANAGE_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="status"
type="extensionstatus"
label="COM_PLUGINS_FILTER_PUBLISHED"
description="COM_PLUGINS_FILTER_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="client_id"
type="location"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_CLIENT_SELECT</option>
</field>
<field
name="type"
type="type"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_TYPE_SELECT</option>
</field>
<field
name="folder"
type="folder"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_FOLDER_SELECT</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="status ASC">JSTATUS_ASC</option>
<option value="status DESC">JSTATUS_DESC</option>
<option value="name
ASC">COM_INSTALLER_HEADING_NAME_ASC</option>
<option value="name
DESC">COM_INSTALLER_HEADING_NAME_DESC</option>
<option value="client_translated
ASC">COM_INSTALLER_HEADING_LOCATION_ASC</option>
<option value="client_translated
DESC">COM_INSTALLER_HEADING_LOCATION_DESC</option>
<option value="type_translated
ASC">COM_INSTALLER_HEADING_TYPE_ASC</option>
<option value="type_translated
DESC">COM_INSTALLER_HEADING_TYPE_DESC</option>
<option value="folder_translated
ASC">COM_INSTALLER_HEADING_FOLDER_ASC</option>
<option value="folder_translated
DESC">COM_INSTALLER_HEADING_FOLDER_DESC</option>
<option value="package_id
ASC">COM_INSTALLER_HEADING_PACKAGE_ID_ASC</option>
<option value="package_id
DESC">COM_INSTALLER_HEADING_PACKAGE_ID_DESC</option>
<option value="extension_id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="extension_id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIMIT"
description="JGLOBAL_LIMIT"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
models/forms/filter_update.xml000064400000003625151161640610012535
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_installer/models/fields"/>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_UPDATE_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_UPDATE_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="client_id"
type="location"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_CLIENT_SELECT</option>
</field>
<field
name="type"
type="type"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_TYPE_SELECT</option>
</field>
<field
name="folder"
type="folder"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_FOLDER_SELECT</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="u.name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="u.name
ASC">COM_INSTALLER_HEADING_NAME_ASC</option>
<option value="u.name
DESC">COM_INSTALLER_HEADING_NAME_DESC</option>
<option value="client_translated
ASC">COM_INSTALLER_HEADING_LOCATION_ASC</option>
<option value="client_translated
DESC">COM_INSTALLER_HEADING_LOCATION_DESC</option>
<option value="type_translated
ASC">COM_INSTALLER_HEADING_TYPE_ASC</option>
<option value="type_translated
DESC">COM_INSTALLER_HEADING_TYPE_DESC</option>
<option value="folder_translated
ASC">COM_INSTALLER_HEADING_FOLDER_ASC</option>
<option value="folder_translated
DESC">COM_INSTALLER_HEADING_FOLDER_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIMIT"
description="JGLOBAL_LIMIT"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
models/forms/filter_updatesites.xml000064400000005201151161640610013575
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset
addfieldpath="/administrator/components/com_installer/models/fields"/>
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_INSTALLER_UPDATESITES_FILTER_SEARCH_LABEL"
description="COM_INSTALLER_UPDATESITES_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="enabled"
type="list"
label="COM_PLUGINS_FILTER_PUBLISHED"
description="COM_PLUGINS_FILTER_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
<option value="0">JDISABLED</option>
<option value="1">JENABLED</option>
</field>
<field
name="client_id"
type="location"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_CLIENT_SELECT</option>
</field>
<field
name="type"
type="type"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_TYPE_SELECT</option>
</field>
<field
name="folder"
type="folder"
onchange="this.form.submit();"
>
<option
value="">COM_INSTALLER_VALUE_FOLDER_SELECT</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
description="JGLOBAL_SORT_BY"
onchange="this.form.submit();"
default="name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="enabled ASC">JSTATUS_ASC</option>
<option value="enabled DESC">JSTATUS_DESC</option>
<option value="update_site_name
ASC">COM_INSTALLER_HEADING_UPDATESITE_NAME_ASC</option>
<option value="update_site_name
DESC">COM_INSTALLER_HEADING_UPDATESITE_NAME_DESC</option>
<option value="name
ASC">COM_INSTALLER_HEADING_NAME_ASC</option>
<option value="name
DESC">COM_INSTALLER_HEADING_NAME_DESC</option>
<option value="client_translated
ASC">COM_INSTALLER_HEADING_LOCATION_ASC</option>
<option value="client_translated
DESC">COM_INSTALLER_HEADING_LOCATION_DESC</option>
<option value="type_translated
ASC">COM_INSTALLER_HEADING_TYPE_ASC</option>
<option value="type_translated
DESC">COM_INSTALLER_HEADING_TYPE_DESC</option>
<option value="folder_translated
ASC">COM_INSTALLER_HEADING_FOLDER_ASC</option>
<option value="folder_translated
DESC">COM_INSTALLER_HEADING_FOLDER_DESC</option>
<option value="update_site_id
ASC">JGRID_HEADING_ID_ASC</option>
<option value="update_site_id
DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIMIT"
description="JGLOBAL_LIMIT"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>
models/install.php000064400000025706151161640610010221 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Extension Manager Install Model
*
* @since 1.5
*/
class InstallerModelInstall extends JModelLegacy
{
/**
* @var object JTable object
*/
protected $_table = null;
/**
* @var object JTable object
*/
protected $_url = null;
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_installer.install';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*
* @since 1.6
*/
protected function populateState()
{
$app = JFactory::getApplication('administrator');
$this->setState('message',
$app->getUserState('com_installer.message'));
$this->setState('extension_message',
$app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
parent::populateState();
}
/**
* Install an extension from either folder, URL or upload.
*
* @return boolean result of install.
*
* @since 1.5
*/
public function install()
{
$this->setState('action', 'install');
// Set FTP credentials, if given.
JClientHelper::setCredentialsFromRequest('ftp');
$app = JFactory::getApplication();
// Load installer plugins for assistance if required:
JPluginHelper::importPlugin('installer');
$dispatcher = JEventDispatcher::getInstance();
$package = null;
// This event allows an input pre-treatment, a custom pre-packing or
custom installation.
// (e.g. from a JSON description).
$results =
$dispatcher->trigger('onInstallerBeforeInstallation',
array($this, &$package));
if (in_array(true, $results, true))
{
return true;
}
if (in_array(false, $results, true))
{
return false;
}
$installType = $app->input->getWord('installtype');
if ($package === null)
{
switch ($installType)
{
case 'folder':
// Remember the 'Install from Directory' path.
$app->getUserStateFromRequest($this->_context .
'.install_directory', 'install_directory');
$package = $this->_getPackageFromFolder();
break;
case 'upload':
$package = $this->_getPackageFromUpload();
break;
case 'url':
$package = $this->_getPackageFromUrl();
break;
default:
$app->setUserState('com_installer.message',
JText::_('COM_INSTALLER_NO_INSTALL_TYPE_FOUND'));
return false;
break;
}
}
// This event allows a custom installation of the package or a
customization of the package:
$results =
$dispatcher->trigger('onInstallerBeforeInstaller',
array($this, &$package));
if (in_array(true, $results, true))
{
return true;
}
if (in_array(false, $results, true))
{
if (in_array($installType, array('upload', 'url')))
{
JInstallerHelper::cleanupInstall($package['packagefile'],
$package['extractdir']);
}
return false;
}
// Check if package was uploaded successfully.
if (!\is_array($package))
{
$app->enqueueMessage(JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'),
'error');
return false;
}
// Get an installer instance.
$installer = JInstaller::getInstance();
/*
* Check for a Joomla core package.
* To do this we need to set the source path to find the manifest (the
same first step as JInstaller::install())
*
* This must be done before the unpacked check because
JInstallerHelper::detectType() returns a boolean false since the manifest
* can't be found in the expected location.
*/
if (isset($package['dir']) &&
is_dir($package['dir']))
{
$installer->setPath('source', $package['dir']);
if (!$installer->findManifest())
{
// If a manifest isn't found at the source, this may be a Joomla
package; check the package directory for the Joomla manifest
if (file_exists($package['dir'] .
'/administrator/manifests/files/joomla.xml'))
{
// We have a Joomla package
if (in_array($installType, array('upload',
'url')))
{
JInstallerHelper::cleanupInstall($package['packagefile'],
$package['extractdir']);
}
$app->enqueueMessage(
JText::sprintf('COM_INSTALLER_UNABLE_TO_INSTALL_JOOMLA_PACKAGE',
JRoute::_('index.php?option=com_joomlaupdate')),
'warning'
);
return false;
}
}
}
// Was the package unpacked?
if (empty($package['type']))
{
if (in_array($installType, array('upload', 'url')))
{
JInstallerHelper::cleanupInstall($package['packagefile'],
$package['extractdir']);
}
$app->enqueueMessage(JText::_('JLIB_INSTALLER_ABORT_DETECTMANIFEST'),
'error');
return false;
}
// Install the package.
if (!$installer->install($package['dir']))
{
// There was an error installing the package.
$msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR',
JText::_('COM_INSTALLER_TYPE_TYPE_' .
strtoupper($package['type'])));
$result = false;
$msgType = 'error';
}
else
{
// Package installed successfully.
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS',
JText::_('COM_INSTALLER_TYPE_TYPE_' .
strtoupper($package['type'])));
$result = true;
$msgType = 'message';
}
// This event allows a custom a post-flight:
$dispatcher->trigger('onInstallerAfterInstaller',
array($this, &$package, $installer, &$result, &$msg));
// Set some model state values.
$app = JFactory::getApplication();
$app->enqueueMessage($msg, $msgType);
$this->setState('name',
$installer->get('name'));
$this->setState('result', $result);
$app->setUserState('com_installer.message',
$installer->message);
$app->setUserState('com_installer.extension_message',
$installer->get('extension_message'));
$app->setUserState('com_installer.redirect_url',
$installer->get('redirect_url'));
// Cleanup the install files.
if (!is_file($package['packagefile']))
{
$config = JFactory::getConfig();
$package['packagefile'] =
$config->get('tmp_path') . '/' .
$package['packagefile'];
}
JInstallerHelper::cleanupInstall($package['packagefile'],
$package['extractdir']);
// Clear the cached extension data and menu cache
$this->cleanCache('_system', 0);
$this->cleanCache('_system', 1);
$this->cleanCache('com_modules', 0);
$this->cleanCache('com_modules', 1);
$this->cleanCache('com_plugins', 0);
$this->cleanCache('com_plugins', 1);
$this->cleanCache('mod_menu', 0);
$this->cleanCache('mod_menu', 1);
return $result;
}
/**
* Works out an installation package from a HTTP upload.
*
* @return package definition or false on failure.
*/
protected function _getPackageFromUpload()
{
// Get the uploaded file information.
$input = JFactory::getApplication()->input;
// Do not change the filter type 'raw'. We need this to let
files containing PHP code to upload. See JInputFiles::get.
$userfile = $input->files->get('install_package', null,
'raw');
// Make sure that file uploads are enabled in php.
if (!(bool) ini_get('file_uploads'))
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE'));
return false;
}
// Make sure that zlib is loaded so that the package can be unpacked.
if (!extension_loaded('zlib'))
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB'));
return false;
}
// If there is no uploaded file, we have a problem...
if (!is_array($userfile))
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED'));
return false;
}
// Is the PHP tmp directory missing?
if ($userfile['error'] && ($userfile['error']
== UPLOAD_ERR_NO_TMP_DIR))
{
JError::raiseWarning(
'',
JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR')
. '<br />' .
JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET')
);
return false;
}
// Is the max upload size too small in php.ini?
if ($userfile['error'] && ($userfile['error']
== UPLOAD_ERR_INI_SIZE))
{
JError::raiseWarning(
'',
JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR')
. '<br />' .
JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE')
);
return false;
}
// Check if there was a different problem uploading the file.
if ($userfile['error'] || $userfile['size'] < 1)
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR'));
return false;
}
// Build the appropriate paths.
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path') . '/' .
$userfile['name'];
$tmp_src = $userfile['tmp_name'];
// Move uploaded file.
jimport('joomla.filesystem.file');
JFile::upload($tmp_src, $tmp_dest, false, true);
// Unpack the downloaded package file.
$package = JInstallerHelper::unpack($tmp_dest, true);
return $package;
}
/**
* Install an extension from a directory
*
* @return array Package details or false on failure
*
* @since 1.5
*/
protected function _getPackageFromFolder()
{
$input = JFactory::getApplication()->input;
// Get the path to the package to install.
$p_dir = $input->getString('install_directory');
$p_dir = JPath::clean($p_dir);
// Did you give us a valid directory?
if (!is_dir($p_dir))
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY'));
return false;
}
// Detect the package type
$type = JInstallerHelper::detectType($p_dir);
// Did you give us a valid package?
if (!$type)
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'));
}
$package['packagefile'] = null;
$package['extractdir'] = null;
$package['dir'] = $p_dir;
$package['type'] = $type;
return $package;
}
/**
* Install an extension from a URL.
*
* @return Package details or false on failure.
*
* @since 1.5
*/
protected function _getPackageFromUrl()
{
$input = JFactory::getApplication()->input;
// Get the URL of the package to install.
$url = $input->getString('install_url');
// Did you give us a URL?
if (!$url)
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL'));
return false;
}
// Handle updater XML file case:
if (preg_match('/\.xml\s*$/', $url))
{
jimport('joomla.updater.update');
$update = new JUpdate;
$update->loadFromXml($url);
$package_url = trim($update->get('downloadurl',
false)->_data);
if ($package_url)
{
$url = $package_url;
}
unset($update);
}
// Download the package at the URL given.
$p_file = JInstallerHelper::downloadPackage($url);
// Was the package downloaded?
if (!$p_file)
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'));
return false;
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
// Unpack the downloaded package file.
$package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file,
true);
return $package;
}
}
models/languages.php000064400000013642151161640610010515 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.updater.update');
use Joomla\String\StringHelper;
/**
* Languages Installer Model
*
* @since 2.5.7
*/
class InstallerModelLanguages extends JModelList
{
/**
* Language count
*
* @var integer
* @since 3.7.0
*/
private $languageCount;
/**
* Constructor override, defines a whitelist of column filters.
*
* @param array $config An optional associative array of configuration
settings.
*
* @since 2.5.7
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'name',
'element',
);
}
parent::__construct($config);
}
/**
* Get the Update Site
*
* @since 3.7.0
*
* @return string The URL of the Accredited Languagepack Updatesite XML
*/
private function getUpdateSite()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->qn('us.location'))
->from($db->qn('#__extensions', 'e'))
->where($db->qn('e.type') . ' = ' .
$db->q('package'))
->where($db->qn('e.element') . ' = ' .
$db->q('pkg_en-GB'))
->where($db->qn('e.client_id') . ' = 0')
->join('LEFT',
$db->qn('#__update_sites_extensions', 'use') .
' ON ' . $db->qn('use.extension_id') . ' =
' . $db->qn('e.extension_id'))
->join('LEFT', $db->qn('#__update_sites',
'us') . ' ON ' .
$db->qn('us.update_site_id') . ' = ' .
$db->qn('use.update_site_id'));
return $db->setQuery($query)->loadResult();
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*
* @since 3.7.0
*/
public function getItems()
{
// Get a storage key.
$store = $this->getStoreId();
// Try to load the data from internal storage.
if (isset($this->cache[$store]))
{
return $this->cache[$store];
}
try
{
// Load the list items and add the items to the internal cache.
$this->cache[$store] = $this->getLanguages();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
return $this->cache[$store];
}
/**
* Gets an array of objects from the updatesite.
*
* @return object[] An array of results.
*
* @since 3.0
* @throws RuntimeException
*/
protected function getLanguages()
{
$updateSite = $this->getUpdateSite();
// Check whether the updateserver is found
if (empty($updateSite))
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNING_NO_LANGUAGES_UPDATESERVER'),
'warning');
return;
}
$http = new JHttp;
try
{
$response = $http->get($updateSite);
}
catch (RuntimeException $e)
{
$response = null;
}
if ($response === null || $response->code !== 200)
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_ERROR_CANT_CONNECT_TO_UPDATESERVER',
$updateSite), 'error');
return;
}
$updateSiteXML = simplexml_load_string($response->body);
$languages = array();
$search =
strtolower($this->getState('filter.search'));
foreach ($updateSiteXML->extension as $extension)
{
$language = new stdClass;
foreach ($extension->attributes() as $key => $value)
{
$language->$key = (string) $value;
}
if ($search)
{
if (strpos(strtolower($language->name), $search) === false
&& strpos(strtolower($language->element), $search) ===
false)
{
continue;
}
}
$languages[$language->name] = $language;
}
// Workaround for php 5.3
$that = $this;
// Sort the array by value of subarray
usort(
$languages,
function($a, $b) use ($that)
{
$ordering = $that->getState('list.ordering');
if (strtolower($that->getState('list.direction')) ===
'asc')
{
return StringHelper::strcmp($a->$ordering, $b->$ordering);
}
else
{
return StringHelper::strcmp($b->$ordering, $a->$ordering);
}
}
);
// Count the non-paginated list
$this->languageCount = count($languages);
$limit = ($this->getState('list.limit') >
0) ? $this->getState('list.limit') : $this->languageCount;
return array_slice($languages, $this->getStart(), $limit);
}
/**
* Returns a record count for the updatesite.
*
* @param JDatabaseQuery|string $query The query.
*
* @return integer Number of rows for query.
*
* @since 3.7.0
*/
protected function _getListCount($query)
{
return $this->languageCount;
}
/**
* Method to get a store id based on model configuration state.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*
* @since 2.5.7
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
return parent::getStoreId($id);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering list order
* @param string $direction direction in the list
*
* @return void
*
* @since 2.5.7
*/
protected function populateState($ordering = 'name', $direction
= 'asc')
{
$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
$this->setState('extension_message',
JFactory::getApplication()->getUserState('com_installer.extension_message'));
parent::populateState($ordering, $direction);
}
/**
* Method to compare two languages in order to sort them.
*
* @param object $lang1 The first language.
* @param object $lang2 The second language.
*
* @return integer
*
* @since 3.7.0
*/
protected function compareLanguages($lang1, $lang2)
{
return strcmp($lang1->name, $lang2->name);
}
}
models/manage.php000064400000021517151161640610007777 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerModel', __DIR__ .
'/extension.php');
/**
* Installer Manage Model
*
* @since 1.5
*/
class InstallerModelManage extends InstallerModel
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'status',
'name',
'client_id',
'client', 'client_translated',
'type', 'type_translated',
'folder', 'folder_translated',
'package_id',
'extension_id',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = 'name', $direction
= 'asc')
{
$app = JFactory::getApplication();
// Load the filter state.
$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
$this->setState('filter.client_id',
$this->getUserStateFromRequest($this->context .
'.filter.client_id', 'filter_client_id', null,
'int'));
$this->setState('filter.status',
$this->getUserStateFromRequest($this->context .
'.filter.status', 'filter_status', '',
'string'));
$this->setState('filter.type',
$this->getUserStateFromRequest($this->context .
'.filter.type', 'filter_type', '',
'string'));
$this->setState('filter.folder',
$this->getUserStateFromRequest($this->context .
'.filter.folder', 'filter_folder', '',
'string'));
$this->setState('message',
$app->getUserState('com_installer.message'));
$this->setState('extension_message',
$app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
parent::populateState($ordering, $direction);
}
/**
* Enable/Disable an extension.
*
* @param array $eid Extension ids to un/publish
* @param int $value Publish value
*
* @return boolean True on success
*
* @since 1.5
*/
public function publish(&$eid = array(), $value = 1)
{
$user = JFactory::getUser();
if (!$user->authorise('core.edit.state',
'com_installer'))
{
JError::raiseWarning(403,
JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
return false;
}
$result = true;
/*
* Ensure eid is an array of extension ids
* TODO: If it isn't an array do we want to set an error and fail?
*/
if (!is_array($eid))
{
$eid = array($eid);
}
// Get a table object for the extension type
$table = JTable::getInstance('Extension');
JTable::addIncludePath(JPATH_ADMINISTRATOR .
'/components/com_templates/tables');
// Enable the extension in the table and store it in the database
foreach ($eid as $i => $id)
{
$table->load($id);
if ($table->type == 'template')
{
$style = JTable::getInstance('Style',
'TemplatesTable');
if ($style->load(array('template' =>
$table->element, 'client_id' => $table->client_id,
'home' => 1)))
{
JError::raiseNotice(403,
JText::_('COM_INSTALLER_ERROR_DISABLE_DEFAULT_TEMPLATE_NOT_PERMITTED'));
unset($eid[$i]);
continue;
}
}
if ($table->protected == 1)
{
$result = false;
JError::raiseWarning(403,
JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
else
{
$table->enabled = $value;
}
$context = $this->option . '.' . $this->name;
JPluginHelper::importPlugin('extension');
JEventDispatcher::getInstance()->trigger('onExtensionChangeState',
array($context, $eid, $value));
if (!$table->store())
{
$this->setError($table->getError());
$result = false;
}
}
// Clear the cached extension data and menu cache
$this->cleanCache('_system', 0);
$this->cleanCache('_system', 1);
$this->cleanCache('com_modules', 0);
$this->cleanCache('com_modules', 1);
$this->cleanCache('mod_menu', 0);
$this->cleanCache('mod_menu', 1);
return $result;
}
/**
* Refreshes the cached manifest information for an extension.
*
* @param int $eid extension identifier (key in #__extensions)
*
* @return boolean result of refresh
*
* @since 1.6
*/
public function refresh($eid)
{
if (!is_array($eid))
{
$eid = array($eid => 0);
}
// Get an installer object for the extension type
$installer = JInstaller::getInstance();
$result = 0;
// Uninstall the chosen extensions
foreach ($eid as $id)
{
$result |= $installer->refreshManifestCache($id);
}
return $result;
}
/**
* Remove (uninstall) an extension
*
* @param array $eid An array of identifiers
*
* @return boolean True on success
*
* @since 1.5
*/
public function remove($eid = array())
{
$user = JFactory::getUser();
if (!$user->authorise('core.delete',
'com_installer'))
{
JError::raiseWarning(403,
JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
return false;
}
/*
* Ensure eid is an array of extension ids in the form id => client_id
* TODO: If it isn't an array do we want to set an error and fail?
*/
if (!is_array($eid))
{
$eid = array($eid => 0);
}
// Get an installer object for the extension type
$installer = JInstaller::getInstance();
$row = JTable::getInstance('extension');
// Uninstall the chosen extensions
$msgs = array();
$result = false;
foreach ($eid as $id)
{
$id = trim($id);
$row->load($id);
$result = false;
$langstring = 'COM_INSTALLER_TYPE_TYPE_' .
strtoupper($row->type);
$rowtype = JText::_($langstring);
if (strpos($rowtype, $langstring) !== false)
{
$rowtype = $row->type;
}
if ($row->type)
{
$result = $installer->uninstall($row->type, $id);
// Build an array of extensions that failed to uninstall
if ($result === false)
{
// There was an error in uninstalling the package
$msgs[] = JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR',
$rowtype);
continue;
}
// Package uninstalled successfully
$msgs[] = JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS',
$rowtype);
$result = true;
continue;
}
// There was an error in uninstalling the package
$msgs[] = JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR',
$rowtype);
}
$msg = implode('<br />', $msgs);
$app = JFactory::getApplication();
$app->enqueueMessage($msg);
$this->setState('action', 'remove');
$this->setState('name',
$installer->get('name'));
$app->setUserState('com_installer.message',
$installer->message);
$app->setUserState('com_installer.extension_message',
$installer->get('extension_message'));
// Clear the cached extension data and menu cache
$this->cleanCache('_system', 0);
$this->cleanCache('_system', 1);
$this->cleanCache('com_modules', 0);
$this->cleanCache('com_modules', 1);
$this->cleanCache('com_plugins', 0);
$this->cleanCache('com_plugins', 1);
$this->cleanCache('mod_menu', 0);
$this->cleanCache('mod_menu', 1);
return $result;
}
/**
* Method to get the database query
*
* @return JDatabaseQuery The database query
*
* @since 1.6
*/
protected function getListQuery()
{
$query = $this->getDbo()->getQuery(true)
->select('*')
->select('2*protected+(1-protected)*enabled AS status')
->from('#__extensions')
->where('state = 0');
// Process select filters.
$status = $this->getState('filter.status');
$type = $this->getState('filter.type');
$clientId = $this->getState('filter.client_id');
$folder = $this->getState('filter.folder');
if ($status != '')
{
if ($status == '2')
{
$query->where('protected = 1');
}
elseif ($status == '3')
{
$query->where('protected = 0');
}
else
{
$query->where('protected = 0')
->where('enabled = ' . (int) $status);
}
}
if ($type)
{
$query->where('type = ' . $this->_db->quote($type));
}
if ($clientId != '')
{
$query->where('client_id = ' . (int) $clientId);
}
if ($folder != '')
{
$query->where('folder = ' . $this->_db->quote($folder
== '*' ? '' : $folder));
}
// Process search filter (extension id).
$search = $this->getState('filter.search');
if (!empty($search) && stripos($search, 'id:') === 0)
{
$query->where('extension_id = ' . (int) substr($search,
3));
}
// Note: The search for name, ordering and pagination are processed by
the parent InstallerModel class (in extension.php).
return $query;
}
}
models/update.php000064400000040360151161640610010026 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.updater.update');
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Installer\InstallerHelper;
/**
* Installer Update Model
*
* @since 1.6
*/
class InstallerModelUpdate extends JModelList
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'name', 'u.name',
'client_id', 'u.client_id',
'client_translated',
'type', 'u.type', 'type_translated',
'folder', 'u.folder',
'folder_translated',
'extension_id', 'u.extension_id',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 1.6
*/
protected function populateState($ordering = 'u.name',
$direction = 'asc')
{
$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
$this->setState('filter.client_id',
$this->getUserStateFromRequest($this->context .
'.filter.client_id', 'filter_client_id', null,
'int'));
$this->setState('filter.type',
$this->getUserStateFromRequest($this->context .
'.filter.type', 'filter_type', '',
'string'));
$this->setState('filter.folder',
$this->getUserStateFromRequest($this->context .
'.filter.folder', 'filter_folder', '',
'string'));
$app = JFactory::getApplication();
$this->setState('message',
$app->getUserState('com_installer.message'));
$this->setState('extension_message',
$app->getUserState('com_installer.extension_message'));
$app->setUserState('com_installer.message', '');
$app->setUserState('com_installer.extension_message',
'');
parent::populateState($ordering, $direction);
}
/**
* Method to get the database query
*
* @return JDatabaseQuery The database query
*
* @since 1.6
*/
protected function getListQuery()
{
$db = $this->getDbo();
// Grab updates ignoring new installs
$query = $db->getQuery(true)
->select('u.*')
->select($db->quoteName('e.manifest_cache'))
->from($db->quoteName('#__updates', 'u'))
->join('LEFT', $db->quoteName('#__extensions',
'e') . ' ON ' .
$db->quoteName('e.extension_id') . ' = ' .
$db->quoteName('u.extension_id'))
->where($db->quoteName('u.extension_id') . ' !=
' . $db->quote(0));
// Process select filters.
$clientId = $this->getState('filter.client_id');
$type = $this->getState('filter.type');
$folder = $this->getState('filter.folder');
$extensionId = $this->getState('filter.extension_id');
if ($type)
{
$query->where($db->quoteName('u.type') . ' = '
. $db->quote($type));
}
if ($clientId != '')
{
$query->where($db->quoteName('u.client_id') . ' =
' . (int) $clientId);
}
if ($folder != '' && in_array($type,
array('plugin', 'library', '')))
{
$query->where($db->quoteName('u.folder') . ' =
' . $db->quote($folder == '*' ? '' : $folder));
}
if ($extensionId)
{
$query->where($db->quoteName('u.extension_id') . '
= ' . $db->quote((int) $extensionId));
}
else
{
$query->where($db->quoteName('u.extension_id') . '
!= ' . $db->quote(0))
->where($db->quoteName('u.extension_id') . ' !=
' . $db->quote(700));
}
// Process search filter.
$search = $this->getState('filter.search');
if (!empty($search))
{
if (stripos($search, 'eid:') !== false)
{
$query->where($db->quoteName('u.extension_id') . '
= ' . (int) substr($search, 4));
}
else
{
if (stripos($search, 'uid:') !== false)
{
$query->where($db->quoteName('u.update_site_id') .
' = ' . (int) substr($search, 4));
}
elseif (stripos($search, 'id:') !== false)
{
$query->where($db->quoteName('u.update_id') . ' =
' . (int) substr($search, 3));
}
else
{
$query->where($db->quoteName('u.name') . ' LIKE
' . $db->quote('%' . str_replace(' ',
'%', $db->escape(trim($search), true)) . '%'));
}
}
}
return $query;
}
/**
* Translate a list of objects
*
* @param array $items The array of objects
*
* @return array The array of translated objects
*
* @since 3.5
*/
protected function translate(&$items)
{
foreach ($items as &$item)
{
$item->client_translated = $item->client_id ?
JText::_('JADMINISTRATOR') : JText::_('JSITE');
$manifest = json_decode($item->manifest_cache);
$item->current_version = isset($manifest->version) ?
$manifest->version : JText::_('JLIB_UNKNOWN');
$item->type_translated = JText::_('COM_INSTALLER_TYPE_'
. strtoupper($item->type));
$item->folder_translated = $item->folder ?:
JText::_('COM_INSTALLER_TYPE_NONAPPLICABLE');
$item->install_type = $item->extension_id ?
JText::_('COM_INSTALLER_MSG_UPDATE_UPDATE') :
JText::_('COM_INSTALLER_NEW_INSTALL');
}
return $items;
}
/**
* Returns an object list
*
* @param string $query The query
* @param int $limitstart Offset
* @param int $limit The number of records
*
* @return array
*
* @since 3.5
*/
protected function _getList($query, $limitstart = 0, $limit = 0)
{
$db = $this->getDbo();
$listOrder = $this->getState('list.ordering',
'u.name');
$listDirn = $this->getState('list.direction',
'asc');
// Process ordering.
if (in_array($listOrder, array('client_translated',
'folder_translated', 'type_translated')))
{
$db->setQuery($query);
$result = $db->loadObjectList();
$this->translate($result);
$result = ArrayHelper::sortObjects($result, $listOrder,
strtolower($listDirn) === 'desc' ? -1 : 1, true, true);
$total = count($result);
if ($total < $limitstart)
{
$limitstart = 0;
$this->setState('list.start', 0);
}
return array_slice($result, $limitstart, $limit ?: null);
}
else
{
$query->order($db->quoteName($listOrder) . ' ' .
$db->escape($listDirn));
$result = parent::_getList($query, $limitstart, $limit);
$this->translate($result);
return $result;
}
}
/**
* Get the count of disabled update sites
*
* @return integer
*
* @since 3.4
*/
public function getDisabledUpdateSites()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('COUNT(*)')
->from($db->quoteName('#__update_sites'))
->where($db->quoteName('enabled') . ' = 0');
$db->setQuery($query);
return $db->loadResult();
}
/**
* Finds updates for an extension.
*
* @param int $eid Extension identifier to look for
* @param int $cacheTimeout Cache timout
* @param int $minimumStability Minimum stability for updates {@see
JUpdater} (0=dev, 1=alpha, 2=beta, 3=rc, 4=stable)
*
* @return boolean Result
*
* @since 1.6
*/
public function findUpdates($eid = 0, $cacheTimeout = 0, $minimumStability
= JUpdater::STABILITY_STABLE)
{
JUpdater::getInstance()->findUpdates($eid, $cacheTimeout,
$minimumStability);
return true;
}
/**
* Removes all of the updates from the table.
*
* @return boolean result of operation
*
* @since 1.6
*/
public function purge()
{
$db = $this->getDbo();
// Note: TRUNCATE is a DDL operation
// This may or may not mean depending on your database
$db->setQuery('TRUNCATE TABLE #__updates');
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
$this->_message =
JText::_('JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES');
return false;
}
// Reset the last update check timestamp
$query = $db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($db->quoteName('last_check_timestamp') . ' =
' . $db->quote(0));
$db->setQuery($query);
$db->execute();
// Clear the administrator cache
$this->cleanCache('_system', 1);
$this->_message = JText::_('JLIB_INSTALLER_PURGED_UPDATES');
return true;
}
/**
* Enables any disabled rows in #__update_sites table
*
* @return boolean result of operation
*
* @since 1.6
*/
public function enableSites()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('enabled') . ' = 0');
$db->setQuery($query);
try
{
$db->execute();
}
catch (JDatabaseExceptionExecuting $e)
{
$this->_message .=
JText::_('COM_INSTALLER_FAILED_TO_ENABLE_UPDATES');
return false;
}
if ($rows = $db->getAffectedRows())
{
$this->_message .=
JText::plural('COM_INSTALLER_ENABLED_UPDATES', $rows);
}
return true;
}
/**
* Update function.
*
* Sets the "result" state with the result of the operation.
*
* @param array $uids Array[int] List of updates to apply
* @param int $minimumStability The minimum allowed stability for
installed updates {@see JUpdater}
*
* @return void
*
* @since 1.6
*/
public function update($uids, $minimumStability =
JUpdater::STABILITY_STABLE)
{
$result = true;
foreach ($uids as $uid)
{
$update = new JUpdate;
$instance = JTable::getInstance('update');
$instance->load($uid);
$update->loadFromXml($instance->detailsurl, $minimumStability);
$update->set('extra_query', $instance->extra_query);
$this->preparePreUpdate($update, $instance);
// Install sets state and enqueues messages
$res = $this->install($update);
if ($res)
{
$instance->delete($uid);
}
$result = $res & $result;
}
// Clear the cached extension data and menu cache
$this->cleanCache('_system', 0);
$this->cleanCache('_system', 1);
$this->cleanCache('com_modules', 0);
$this->cleanCache('com_modules', 1);
$this->cleanCache('com_plugins', 0);
$this->cleanCache('com_plugins', 1);
$this->cleanCache('mod_menu', 0);
$this->cleanCache('mod_menu', 1);
// Set the final state
$this->setState('result', $result);
}
/**
* Handles the actual update installation.
*
* @param JUpdate $update An update definition
*
* @return boolean Result of install
*
* @since 1.6
*/
private function install($update)
{
$app = JFactory::getApplication();
if (!isset($update->get('downloadurl')->_data))
{
JError::raiseWarning('',
JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'));
return false;
}
$url = trim($update->downloadurl->_data);
$sources = $update->get('downloadSources', array());
if ($extra_query = $update->get('extra_query'))
{
$url .= (strpos($url, '?') === false) ? '?' :
'&';
$url .= $extra_query;
}
$mirror = 0;
while (!($p_file = InstallerHelper::downloadPackage($url)) &&
isset($sources[$mirror]))
{
$name = $sources[$mirror];
$url = trim($name->url);
if ($extra_query)
{
$url .= (strpos($url, '?') === false) ? '?' :
'&';
$url .= $extra_query;
}
$mirror++;
}
// Was the package downloaded?
if (!$p_file)
{
JError::raiseWarning('',
JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url));
return false;
}
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
// Unpack the downloaded package file
$package = InstallerHelper::unpack($tmp_dest . '/' . $p_file);
if (empty($package))
{
$app->enqueueMessage(JText::sprintf('COM_INSTALLER_UNPACK_ERROR',
$p_file), 'error');
return false;
}
// Get an installer instance
$installer = JInstaller::getInstance();
$update->set('type', $package['type']);
// Check the package
$check =
InstallerHelper::isChecksumValid($package['packagefile'],
$update);
// The validation was not successful. Just a warning for now.
// TODO: In Joomla 4 this will abort the installation
if ($check === InstallerHelper::HASH_NOT_VALIDATED)
{
$app->enqueueMessage(JText::_('COM_INSTALLER_INSTALL_CHECKSUM_WRONG'),
'error');
}
// Install the package
if (!$installer->update($package['dir']))
{
// There was an error updating the package
$app->enqueueMessage(
JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR',
JText::_('COM_INSTALLER_TYPE_TYPE_' .
strtoupper($package['type']))
), 'error'
);
$result = false;
}
else
{
// Package updated successfully
$app->enqueueMessage(
JText::sprintf('COM_INSTALLER_MSG_UPDATE_SUCCESS',
JText::_('COM_INSTALLER_TYPE_TYPE_' .
strtoupper($package['type']))
)
);
$result = true;
}
// Quick change
$this->type = $package['type'];
// TODO: Reconfigure this code when you have more battery life left
$this->setState('name',
$installer->get('name'));
$this->setState('result', $result);
$app->setUserState('com_installer.message',
$installer->message);
$app->setUserState('com_installer.extension_message',
$installer->get('extension_message'));
// Cleanup the install files
if (!is_file($package['packagefile']))
{
$config = JFactory::getConfig();
$package['packagefile'] =
$config->get('tmp_path') . '/' .
$package['packagefile'];
}
InstallerHelper::cleanupInstall($package['packagefile'],
$package['extractdir']);
return $result;
}
/**
* Method to get the row form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data
(default case), false if not.
*
* @return mixed A JForm object on success, false on failure
*
* @since 2.5.2
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
$form = JForm::getInstance('com_installer.update',
'update', array('load_data' => $loadData));
// Check for an error.
if ($form == false)
{
$this->setError($form->getMessage());
return false;
}
// Check the session for previously entered form data.
$data = $this->loadFormData();
// Bind the form data if present.
if (!empty($data))
{
$form->bind($data);
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*
* @since 2.5.2
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState($this->context,
array());
return $data;
}
/**
* Method to add parameters to the update
*
* @param JUpdate $update An update definition
* @param JTableUpdate $table The update instance from the database
*
* @return void
*
* @since 3.7.0
*/
protected function preparePreUpdate($update, $table)
{
jimport('joomla.filesystem.file');
switch ($table->type)
{
// Components could have a helper which adds additional data
case 'component':
$ename = str_replace('com_', '',
$table->element);
$fname = $ename . '.php';
$cname = ucfirst($ename) . 'Helper';
$path = JPATH_ADMINISTRATOR . '/components/' .
$table->element . '/helpers/' . $fname;
if (JFile::exists($path))
{
require_once $path;
if (class_exists($cname) && is_callable(array($cname,
'prepareUpdate')))
{
call_user_func_array(array($cname, 'prepareUpdate'),
array(&$update, &$table));
}
}
break;
// Modules could have a helper which adds additional data
case 'module':
$cname = str_replace('_', '', $table->element) .
'Helper';
$path = ($table->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) .
'/modules/' . $table->element . '/helper.php';
if (JFile::exists($path))
{
require_once $path;
if (class_exists($cname) && is_callable(array($cname,
'prepareUpdate')))
{
call_user_func_array(array($cname, 'prepareUpdate'),
array(&$update, &$table));
}
}
break;
// If we have a plugin, we can use the plugin trigger
"onInstallerBeforePackageDownload"
// But we should make sure, that our plugin is loaded, so we don't
need a second "installer" plugin
case 'plugin':
$cname = str_replace('plg_', '',
$table->element);
JPluginHelper::importPlugin($table->folder, $cname);
break;
}
}
}
models/updatesites.php000064400000033576151161640610011111 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerModel', __DIR__ .
'/extension.php');
/**
* Installer Update Sites Model
*
* @since 3.4
*/
class InstallerModelUpdatesites extends InstallerModel
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration
settings.
*
* @see JController
* @since 3.4
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'update_site_name',
'name',
'client_id',
'client', 'client_translated',
'status',
'type', 'type_translated',
'folder', 'folder_translated',
'update_site_id',
'enabled',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void
*
* @since 3.4
*/
protected function populateState($ordering = 'name', $direction
= 'asc')
{
// Load the filter state.
$this->setState('filter.search',
$this->getUserStateFromRequest($this->context .
'.filter.search', 'filter_search', '',
'string'));
$this->setState('filter.client_id',
$this->getUserStateFromRequest($this->context .
'.filter.client_id', 'filter_client_id', null,
'int'));
$this->setState('filter.enabled',
$this->getUserStateFromRequest($this->context .
'.filter.enabled', 'filter_enabled', '',
'string'));
$this->setState('filter.type',
$this->getUserStateFromRequest($this->context .
'.filter.type', 'filter_type', '',
'string'));
$this->setState('filter.folder',
$this->getUserStateFromRequest($this->context .
'.filter.folder', 'filter_folder', '',
'string'));
parent::populateState($ordering, $direction);
}
/**
* Enable/Disable an extension.
*
* @param array $eid Extension ids to un/publish
* @param int $value Publish value
*
* @return boolean True on success
*
* @since 3.4
*
* @throws Exception on ACL error
*/
public function publish(&$eid = array(), $value = 1)
{
if (!JFactory::getUser()->authorise('core.edit.state',
'com_installer'))
{
throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'),
403);
}
$result = true;
// Ensure eid is an array of extension ids
if (!is_array($eid))
{
$eid = array($eid);
}
// Get a table object for the extension type
$table = JTable::getInstance('Updatesite');
// Enable the update site in the table and store it in the database
foreach ($eid as $i => $id)
{
$table->load($id);
$table->enabled = $value;
if (!$table->store())
{
$this->setError($table->getError());
$result = false;
}
}
return $result;
}
/**
* Deletes an update site.
*
* @param array $ids Extension ids to delete.
*
* @return void
*
* @since 3.6
*
* @throws Exception on ACL error
*/
public function delete($ids = array())
{
if (!JFactory::getUser()->authorise('core.delete',
'com_installer'))
{
throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'),
403);
}
// Ensure eid is an array of extension ids
if (!is_array($ids))
{
$ids = array($ids);
}
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$count = 0;
// Gets the update site names.
$query = $db->getQuery(true)
->select($db->qn(array('update_site_id',
'name')))
->from($db->qn('#__update_sites'))
->where($db->qn('update_site_id') . ' IN (' .
implode(', ', $ids) . ')');
$db->setQuery($query);
$updateSitesNames = $db->loadObjectList('update_site_id');
// Gets Joomla core update sites Ids.
$joomlaUpdateSitesIds = $this->getJoomlaUpdateSitesIds(0);
// Enable the update site in the table and store it in the database
foreach ($ids as $i => $id)
{
// Don't allow to delete Joomla Core update sites.
if (in_array((int) $id, $joomlaUpdateSitesIds))
{
$app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_DELETE_CANNOT_DELETE',
$updateSitesNames[$id]->name), 'error');
continue;
}
// Delete the update site from all tables.
try
{
$query = $db->getQuery(true)
->delete($db->qn('#__update_sites'))
->where($db->qn('update_site_id') . ' = ' .
(int) $id);
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true)
->delete($db->qn('#__update_sites_extensions'))
->where($db->qn('update_site_id') . ' = ' .
(int) $id);
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true)
->delete($db->qn('#__updates'))
->where($db->qn('update_site_id') . ' = ' .
(int) $id);
$db->setQuery($query);
$db->execute();
$count++;
}
catch (RuntimeException $e)
{
$app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_DELETE_ERROR',
$updateSitesNames[$id]->name, $e->getMessage()), 'error');
}
}
if ($count > 0)
{
$app->enqueueMessage(JText::plural('COM_INSTALLER_MSG_UPDATESITES_N_DELETE_UPDATESITES_DELETED',
$count), 'message');
}
}
/**
* Rebuild update sites tables.
*
* @return void
*
* @since 3.6
*
* @throws Exception on ACL error
*/
public function rebuild()
{
if (!JFactory::getUser()->authorise('core.admin',
'com_installer'))
{
throw new
Exception(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_NOT_PERMITTED'),
403);
}
$db = JFactory::getDbo();
$app = JFactory::getApplication();
// Check if Joomla Extension plugin is enabled.
if (!JPluginHelper::isEnabled('extension', 'joomla'))
{
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' .
$db->quote('plugin'))
->where($db->quoteName('element') . ' = ' .
$db->quote('joomla'))
->where($db->quoteName('folder') . ' = ' .
$db->quote('extension'));
$db->setQuery($query);
$pluginId = (int) $db->loadResult();
$link =
JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id='
. $pluginId);
$app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_REBUILD_EXTENSION_PLUGIN_NOT_ENABLED',
$link), 'error');
return;
}
$clients = array(JPATH_SITE, JPATH_ADMINISTRATOR);
$extensionGroupFolders = array('components',
'modules', 'plugins', 'templates',
'language', 'manifests');
$pathsToSearch = array();
// Identifies which folders to search for manifest files.
foreach ($clients as $clientPath)
{
foreach ($extensionGroupFolders as $extensionGroupFolderName)
{
// Components, modules, plugins, templates, languages and manifest
(files, libraries, etc)
if ($extensionGroupFolderName != 'plugins')
{
foreach (glob($clientPath . '/' . $extensionGroupFolderName
. '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $extensionFolderPath)
{
$pathsToSearch[] = $extensionFolderPath;
}
}
// Plugins (another directory level is needed)
else
{
foreach (glob($clientPath . '/' . $extensionGroupFolderName
. '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $pluginGroupFolderPath)
{
foreach (glob($pluginGroupFolderPath . '/*', GLOB_NOSORT |
GLOB_ONLYDIR) as $extensionFolderPath)
{
$pathsToSearch[] = $extensionFolderPath;
}
}
}
}
}
// Gets Joomla core update sites Ids.
$joomlaUpdateSitesIds = implode(', ',
$this->getJoomlaUpdateSitesIds(0));
// Delete from all tables (except joomla core update sites).
$query = $db->getQuery(true)
->delete($db->quoteName('#__update_sites'))
->where($db->quoteName('update_site_id') . ' NOT IN
(' . $joomlaUpdateSitesIds . ')');
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true)
->delete($db->quoteName('#__update_sites_extensions'))
->where($db->quoteName('update_site_id') . ' NOT IN
(' . $joomlaUpdateSitesIds . ')');
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true)
->delete($db->quoteName('#__updates'))
->where($db->quoteName('update_site_id') . ' NOT IN
(' . $joomlaUpdateSitesIds . ')');
$db->setQuery($query);
$db->execute();
$count = 0;
// Gets Joomla core extension Ids.
$joomlaCoreExtensionIds = implode(', ',
$this->getJoomlaUpdateSitesIds(1));
// Search for updateservers in manifest files inside the folders to
search.
foreach ($pathsToSearch as $extensionFolderPath)
{
$tmpInstaller = new JInstaller;
$tmpInstaller->setPath('source', $extensionFolderPath);
// Main folder manifests (higher priority)
$parentXmlfiles =
JFolder::files($tmpInstaller->getPath('source'),
'.xml$', false, true);
// Search for children manifests (lower priority)
$allXmlFiles =
JFolder::files($tmpInstaller->getPath('source'),
'.xml$', 1, true);
// Create an unique array of files ordered by priority
$xmlfiles = array_unique(array_merge($parentXmlfiles, $allXmlFiles));
if (!empty($xmlfiles))
{
foreach ($xmlfiles as $file)
{
// Is it a valid Joomla installation manifest file?
$manifest = $tmpInstaller->isManifest($file);
if (!is_null($manifest))
{
// Search if the extension exists in the extensions table. Excluding
joomla core extensions (id < 10000) and discovered extensions.
$query = $db->getQuery(true)
->select($db->quoteName('extension_id'))
->from($db->quoteName('#__extensions'))
->where('('
. $db->quoteName('name') . ' = ' .
$db->quote($manifest->name)
. ' OR ' . $db->quoteName('name') . ' =
' . $db->quote($manifest->packagename)
. ')' )
->where($db->quoteName('type') . ' = ' .
$db->quote($manifest['type']))
->where($db->quoteName('extension_id') . ' NOT
IN (' . $joomlaCoreExtensionIds . ')')
->where($db->quoteName('state') . ' !=
-1');
$db->setQuery($query);
$eid = (int) $db->loadResult();
if ($eid && $manifest->updateservers)
{
// Set the manifest object and path
$tmpInstaller->manifest = $manifest;
$tmpInstaller->setPath('manifest', $file);
// Load the extension plugin (if not loaded yet).
JPluginHelper::importPlugin('extension',
'joomla');
// Fire the onExtensionAfterUpdate
JEventDispatcher::getInstance()->trigger('onExtensionAfterUpdate',
array('installer' => $tmpInstaller, 'eid' =>
$eid));
$count++;
}
}
}
}
}
if ($count > 0)
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_SUCCESS'),
'message');
}
else
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_MESSAGE'),
'message');
}
}
/**
* Fetch the Joomla update sites ids.
*
* @param integer $column Column to return. 0 for update site ids, 1
for extension ids.
*
* @return array Array with joomla core update site ids.
*
* @since 3.6.0
*/
protected function getJoomlaUpdateSitesIds($column = 0)
{
$db = JFactory::getDbo();
// Fetch the Joomla core update sites ids and their extension ids. We
search for all except the core joomla extension with update sites.
$query = $db->getQuery(true)
->select($db->quoteName(array('use.update_site_id',
'e.extension_id')))
->from($db->quoteName('#__update_sites_extensions',
'use'))
->join('LEFT',
$db->quoteName('#__update_sites', 'us') . ' ON
' . $db->qn('us.update_site_id') . ' = ' .
$db->qn('use.update_site_id'))
->join('LEFT', $db->quoteName('#__extensions',
'e') . ' ON ' . $db->qn('e.extension_id')
. ' = ' . $db->qn('use.extension_id'))
->where('('
. '(' . $db->qn('e.type') . ' = ' .
$db->quote('file') . ' AND ' .
$db->qn('e.element') . ' = ' .
$db->quote('joomla') . ')'
. ' OR (' . $db->qn('e.type') . ' = '
. $db->quote('package') . ' AND ' .
$db->qn('e.element') . ' = ' .
$db->quote('pkg_en-GB') . ')'
. ' OR (' . $db->qn('e.type') . ' = '
. $db->quote('component') . ' AND ' .
$db->qn('e.element') . ' = ' .
$db->quote('com_joomlaupdate') . ')'
. ')'
);
$db->setQuery($query);
return $db->loadColumn($column);
}
/**
* Method to get the database query
*
* @return JDatabaseQuery The database query
*
* @since 3.4
*/
protected function getListQuery()
{
$query = JFactory::getDbo()->getQuery(true)
->select(
array(
's.update_site_id',
's.name AS update_site_name',
's.type AS update_site_type',
's.location',
's.enabled',
'e.extension_id',
'e.name',
'e.type',
'e.element',
'e.folder',
'e.client_id',
'e.state',
'e.manifest_cache',
)
)
->from('#__update_sites AS s')
->innerJoin('#__update_sites_extensions AS se ON
(se.update_site_id = s.update_site_id)')
->innerJoin('#__extensions AS e ON (e.extension_id =
se.extension_id)')
->where('state = 0');
// Process select filters.
$enabled = $this->getState('filter.enabled');
$type = $this->getState('filter.type');
$clientId = $this->getState('filter.client_id');
$folder = $this->getState('filter.folder');
if ($enabled != '')
{
$query->where('s.enabled = ' . (int) $enabled);
}
if ($type)
{
$query->where('e.type = ' .
$this->_db->quote($type));
}
if ($clientId != '')
{
$query->where('e.client_id = ' . (int) $clientId);
}
if ($folder != '' && in_array($type,
array('plugin', 'library', '')))
{
$query->where('e.folder = ' .
$this->_db->quote($folder == '*' ? '' :
$folder));
}
// Process search filter (update site id).
$search = $this->getState('filter.search');
if (!empty($search) && stripos($search, 'id:') === 0)
{
$query->where('s.update_site_id = ' . (int) substr($search,
3));
}
// Note: The search for name, ordering and pagination are processed by
the parent InstallerModel class (in extension.php).
return $query;
}
}
models/warnings.php000064400000010023151161640610010365 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Installer Warnings Model
*
* @since 1.6
*/
class InstallerModelWarnings extends JModelList
{
/**
* Extension Type
* @var string
*/
public $type = 'warnings';
/**
* Return the byte value of a particular string.
*
* @param string $val String optionally with G, M or K suffix
*
* @return integer size in bytes
*
* @since 1.6
*/
public function return_bytes($val)
{
if (empty($val))
{
return 0;
}
$val = trim($val);
preg_match('#([0-9]+)[\s]*([a-z]+)#i', $val, $matches);
$last = '';
if (isset($matches[2]))
{
$last = $matches[2];
}
if (isset($matches[1]))
{
$val = (int) $matches[1];
}
switch (strtolower($last))
{
case 'g':
case 'gb':
$val *= 1024;
case 'm':
case 'mb':
$val *= 1024;
case 'k':
case 'kb':
$val *= 1024;
}
return (int) $val;
}
/**
* Load the data.
*
* @return array Messages
*
* @since 1.6
*/
public function getItems()
{
static $messages;
if ($messages)
{
return $messages;
}
$messages = array();
$file_uploads = ini_get('file_uploads');
if (!$file_uploads)
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADISDISABLEDDESC'));
}
$upload_dir = ini_get('upload_tmp_dir');
if (!$upload_dir)
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSETDESC'));
}
else
{
if (!is_writeable($upload_dir))
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLE'),
'description' =>
JText::sprintf('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTWRITEABLEDESC',
$upload_dir));
}
}
$config = JFactory::getConfig();
$tmp_path = $config->get('tmp_path');
if (!$tmp_path)
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSETDESC'));
}
else
{
if (!is_writeable($tmp_path))
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLE'),
'description' =>
JText::sprintf('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTWRITEABLEDESC',
$tmp_path));
}
}
$memory_limit =
$this->return_bytes(ini_get('memory_limit'));
if ($memory_limit < (8 * 1024 * 1024) && $memory_limit != -1)
{
// 8MB
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC'));
}
elseif ($memory_limit < (16 * 1024 * 1024) && $memory_limit !=
-1)
{
// 16MB
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYWARN'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_MEDMEMORYDESC'));
}
$post_max_size =
$this->return_bytes(ini_get('post_max_size'));
$upload_max_filesize =
$this->return_bytes(ini_get('upload_max_filesize'));
if ($post_max_size < $upload_max_filesize)
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOST'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_UPLOADBIGGERTHANPOSTDESC'));
}
if ($post_max_size < (8 * 1024 * 1024)) // 8MB
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC'));
}
if ($upload_max_filesize < (8 * 1024 * 1024)) // 8MB
{
$messages[] = array('message' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'),
'description' =>
JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC'));
}
return $messages;
}
}
views/database/tmpl/default.php000064400000006510151161640610012561
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<div id="installer-database" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=database');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->errorCount === 0) : ?>
<?php echo JHtml::_('bootstrap.startTabSet',
'myTab', array('active' => 'other'));
?>
<?php else : ?>
<?php echo JHtml::_('bootstrap.startTabSet',
'myTab', array('active' => 'problems'));
?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'problems',
JText::plural('COM_INSTALLER_MSG_N_DATABASE_ERROR_PANEL',
$this->errorCount)); ?>
<fieldset class="panelform">
<ul>
<?php if (!$this->filterParams) : ?>
<li><?php echo
JText::_('COM_INSTALLER_MSG_DATABASE_FILTER_ERROR');
?></li>
<?php endif; ?>
<?php if ($this->schemaVersion !=
$this->changeSet->getSchema()) : ?>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_SCHEMA_ERROR',
$this->schemaVersion, $this->changeSet->getSchema());
?></li>
<?php endif; ?>
<?php if (version_compare($this->updateVersion, JVERSION) != 0)
: ?>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_UPDATEVERSION_ERROR',
$this->updateVersion, JVERSION); ?></li>
<?php endif; ?>
<?php foreach ($this->errors as $line => $error) : ?>
<?php $key = 'COM_INSTALLER_MSG_DATABASE_' .
$error->queryType;
$msgs = $error->msgElements;
$file = basename($error->file);
$msg0 = isset($msgs[0]) ? $msgs[0] : ' ';
$msg1 = isset($msgs[1]) ? $msgs[1] : ' ';
$msg2 = isset($msgs[2]) ? $msgs[2] : ' ';
$message = JText::sprintf($key, $file, $msg0, $msg1, $msg2); ?>
<li><?php echo $message; ?></li>
<?php endforeach; ?>
</ul>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab',
'other', JText::_('COM_INSTALLER_MSG_DATABASE_INFO'));
?>
<div class="control-group" >
<fieldset class="panelform">
<ul>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_SCHEMA_VERSION',
$this->schemaVersion); ?></li>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_UPDATE_VERSION',
$this->updateVersion); ?></li>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_DRIVER',
JFactory::getDbo()->name); ?></li>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_CHECKED_OK',
count($this->results['ok'])); ?></li>
<li><?php echo
JText::sprintf('COM_INSTALLER_MSG_DATABASE_SKIPPED',
count($this->results['skipped'])); ?></li>
</ul>
</fieldset>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
views/database/tmpl/default.xml000064400000000326151161640610012571
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_DATABASE_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_DATABASE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/database/view.html.php000064400000004232151161640610012075
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Database View
*
* @since 1.6
*/
class InstallerViewDatabase extends InstallerViewDefault
{
/**
* Display the view.
*
* @param string $tpl Template
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
// Set variables
$app = JFactory::getApplication();
// Get data from the model.
$this->state = $this->get('State');
$this->changeSet = $this->get('Items');
$this->errors = $this->changeSet->check();
$this->results = $this->changeSet->getStatus();
$this->schemaVersion = $this->get('SchemaVersion');
$this->updateVersion = $this->get('UpdateVersion');
$this->filterParams = $this->get('DefaultTextFilters');
$this->schemaVersion = $this->schemaVersion ?:
JText::_('JNONE');
$this->updateVersion = $this->updateVersion ?:
JText::_('JNONE');
$this->pagination = $this->get('Pagination');
$this->errorCount = count($this->errors);
if ($this->schemaVersion != $this->changeSet->getSchema())
{
$this->errorCount++;
}
if (!$this->filterParams)
{
$this->errorCount++;
}
if (version_compare($this->updateVersion, JVERSION) != 0)
{
$this->errorCount++;
}
if ($this->errorCount === 0)
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DATABASE_OK'),
'notice');
}
else
{
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DATABASE_ERRORS'),
'warning');
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
/*
* Set toolbar items for the page.
*/
JToolbarHelper::custom('database.fix', 'refresh',
'refresh', 'COM_INSTALLER_TOOLBAR_DATABASE_FIX',
false);
JToolbarHelper::divider();
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_DATABASE');
}
}
views/default/tmpl/default_ftp.php000064400000002224151161640610013310
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<fieldset title="<?php echo
JText::_('COM_INSTALLER_MSG_DESCFTPTITLE'); ?>">
<legend><?php echo
JText::_('COM_INSTALLER_MSG_DESCFTPTITLE'); ?></legend>
<?php echo JText::_('COM_INSTALLER_MSG_DESCFTP'); ?>
<?php if ($this->ftp instanceof Exception) : ?>
<p><?php echo JText::_($this->ftp->getMessage());
?></p>
<?php endif; ?>
<table class="adminform">
<tbody>
<tr>
<td width="120">
<label for="username"><?php echo
JText::_('JGLOBAL_USERNAME'); ?></label>
</td>
<td>
<input type="text" id="username"
name="username" class="input_box" size="70"
value="" />
</td>
</tr>
<tr>
<td width="120">
<label for="password"><?php echo
JText::_('JGLOBAL_PASSWORD'); ?></label>
</td>
<td>
<input type="password" id="password"
name="password" class="input_box" size="70"
value="" />
</td>
</tr>
</tbody>
</table>
</fieldset>
views/default/tmpl/default_message.php000064400000001265151161640610014147
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
$state = $this->get('State');
$message1 = $state->get('message');
$message2 = $state->get('extension_message');
?>
<?php if ($message1) : ?>
<div class="row-fluid">
<div class="span12">
<strong><?php echo $message1; ?></strong>
</div>
</div>
<?php endif; ?>
<?php if ($message2) : ?>
<div class="row-fluid">
<div class="span12">
<?php echo $message2; ?>
</div>
</div>
<?php endif; ?>
views/default/view.php000064400000003510151161640610011010 0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Extension Manager Default View
*
* @since 1.5
*/
class InstallerViewDefault extends JViewLegacy
{
/**
* Constructor.
*
* @param array $config Configuration array
*
* @since 1.5
*/
public function __construct($config = null)
{
$app = JFactory::getApplication();
parent::__construct($config);
$this->_addPath('template', $this->_basePath .
'/views/default/tmpl');
$this->_addPath('template', JPATH_THEMES . '/' .
$app->getTemplate() . '/html/com_installer/default');
}
/**
* Display the view.
*
* @param string $tpl Template
*
* @return void
*
* @since 1.5
*/
public function display($tpl = null)
{
// Get data from the model.
$state = $this->get('State');
// Are there messages to display?
$showMessage = false;
if (is_object($state))
{
$message1 = $state->get('message');
$message2 = $state->get('extension_message');
$showMessage = ($message1 || $message2);
}
$this->showMessage = $showMessage;
$this->state = &$state;
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_installer');
JToolbarHelper::title(JText::_('COM_INSTALLER_HEADER_' .
$this->getName()), 'puzzle install');
if ($canDo->get('core.admin') ||
$canDo->get('core.options'))
{
JToolbarHelper::preferences('com_installer');
JToolbarHelper::divider();
}
// Render side bar.
$this->sidebar = JHtmlSidebar::render();
}
}
views/discover/tmpl/default.php000064400000010772151161640610012640
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.multiselect');
JHtml::_('bootstrap.tooltip');
JHtml::_('formbehavior.chosen', 'select');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<div id="installer-discover" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=discover');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->showMessage) : ?>
<?php echo $this->loadTemplate('message'); ?>
<?php endif; ?>
<?php if ($this->ftp) : ?>
<?php echo $this->loadTemplate('ftp'); ?>
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
<div class="clearfix"></div>
<div class="alert alert-no-items alert-info">
<?php echo
JText::_('COM_INSTALLER_MSG_DISCOVER_DESCRIPTION'); ?>
</div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_NAME', 'name', $listDirn,
$listOrder); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_LOCATION', 'client_translated',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_TYPE', 'type_translated',
$listDirn, $listOrder); ?>
</th>
<th width="10%" class="hidden-phone">
<?php echo JText::_('JVERSION'); ?>
</th>
<th width="10%" class="hidden-phone
hidden-tablet">
<?php echo JText::_('JDATE'); ?>
</th>
<th width="15%" class="hidden-phone
hidden-tablet">
<?php echo JText::_('JAUTHOR'); ?>
</th>
<th class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_FOLDER', 'folder_translated',
$listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ID', 'extension_id', $listDirn,
$listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="9"><?php echo
$this->pagination->getListFooter(); ?></td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i,
$item->extension_id); ?>
</td>
<td>
<label for="cb<?php echo $i;?>">
<span class="bold hasTooltip" title="<?php
echo JHtml::_('tooltipText', $item->name,
$item->description, 0); ?>"><?php echo $item->name;
?></span>
</label>
</td>
<td>
<?php echo $item->client_translated; ?>
</td>
<td>
<?php echo $item->type_translated; ?>
</td>
<td class="hidden-phone">
<?php echo @$item->version != '' ? $item->version
: ' '; ?>
</td>
<td class="hidden-phone hidden-tablet">
<?php echo @$item->creationDate != '' ?
$item->creationDate : ' '; ?>
</td>
<td class="hidden-phone hidden-tablet">
<span class="editlinktip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
JText::_('COM_INSTALLER_AUTHOR_INFORMATION'),
$item->author_info, 0); ?>">
<?php echo @$item->author != '' ? $item->author
: ' '; ?>
</span>
</td>
<td class="hidden-phone">
<?php echo $item->folder_translated; ?>
</td>
<td class="hidden-phone">
<?php echo $item->extension_id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
views/discover/tmpl/default.xml000064400000000326151161640610012643
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_DISCOVER_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_DISCOVER_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/discover/tmpl/default_item.php000064400000003532151161640610013652
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<tr class="<?php echo 'row' . $this->item->index
% 2; ?>" <?php echo $this->item->style; ?>>
<td>
<input type="checkbox" id="cb<?php echo
$this->item->index; ?>" name="eid[]"
value="<?php echo $this->item->extension_id; ?>"
onclick="Joomla.isChecked(this.checked);" <?php echo
$this->item->cbd; ?> />
<!-- <input type="checkbox" id="cb<?php echo
$this->item->index; ?>" name="eid"
value="<?php echo $this->item->extension_id; ?>"
onclick="Joomla.isChecked(this.checked);" <?php echo
$this->item->cbd; ?> />-->
<span class="bold"><?php echo $this->item->name;
?></span>
</td>
<td>
<?php echo $this->item->type ?>
</td>
<td class="center">
<?php if (!$this->item->element) : ?>
<strong>X</strong>
<?php else : ?>
<a
href="index.php?option=com_installer&type=manage&task=<?php
echo $this->item->task; ?>&eid[]=<?php echo
$this->item->extension_id; ?>&limitstart=<?php echo
$this->pagination->limitstart; ?>&<?php echo
JSession::getFormToken(); ?>=1"><?php echo
JHtml::_('image', 'images/' . $this->item->img,
$this->item->alt, array('title' =>
$this->item->action)); ?></a>
<?php endif; ?>
</td>
<td class="center"><?php echo
@$this->item->folder != '' ? $this->item->folder :
'N/A'; ?></td>
<td class="center"><?php echo
@$this->item->client != '' ? $this->item->client :
'N/A'; ?></td>
<td>
<span class="editlinktip hasTooltip" title="<?php
echo JHtml::_('tooltipText',
JText::_('COM_INSTALLER_AUTHOR_INFORMATION'),
$this->item->author_info, 0); ?>">
<?php echo @$this->item->author != '' ?
$this->item->author : ' '; ?>
</span>
</td>
</tr>
views/discover/view.html.php000064400000004416151161640610012153
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Discover View
*
* @since 1.6
*/
class InstallerViewDiscover extends InstallerViewDefault
{
/**
* Display the view.
*
* @param string $tpl Template
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
// Run discover from the model.
if (!$this->checkExtensions())
{
$this->getModel('discover')->discover();
}
// Get data from the model.
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.1
*/
protected function addToolbar()
{
/*
* Set toolbar items for the page.
*/
JToolbarHelper::custom('discover.install', 'upload',
'upload', 'JTOOLBAR_INSTALL', true);
JToolbarHelper::custom('discover.refresh', 'refresh',
'refresh', 'COM_INSTALLER_TOOLBAR_DISCOVER', false);
JToolbarHelper::divider();
JHtmlSidebar::setAction('index.php?option=com_installer&view=discover');
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_DISCOVER');
}
/**
* Check extensions.
*
* Checks uninstalled extensions in extensions table.
*
* @return boolean True if there are discovered extensions on the
database.
*
* @since 3.5
*/
public function checkExtensions()
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->quoteName('#__extensions'))
->where($db->quoteName('state') . ' = -1');
$db->setQuery($query);
$discoveredExtensions = $db->loadObjectList();
return (count($discoveredExtensions) === 0) ? false : true;
}
}
views/install/tmpl/default.php000064400000013413151161640610012463
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
// MooTools is loaded for B/C for extensions generating JavaScript in their
install scripts, this call will be removed at 4.0
JHtml::_('behavior.framework', true);
JHtml::_('bootstrap.tooltip');
JFactory::getDocument()->addScriptDeclaration(
'
Joomla.submitbutton4 = function() {
var form = document.getElementById("adminForm");
// do field validation
if (form.install_url.value == "" || form.install_url.value ==
"http://" || form.install_url.value == "https://") {
alert("' .
JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL', true) .
'");
}
else
{
JoomlaInstaller.showLoading();
form.installtype.value = "url";
form.submit();
}
};
Joomla.submitbuttonInstallWebInstaller = function() {
var form = document.getElementById("adminForm");
form.install_url.value =
"https://appscdn.joomla.org/webapps/jedapps/webinstaller.xml";
Joomla.submitbutton4();
};
// Add spindle-wheel for installations:
jQuery(document).ready(function($) {
var outerDiv = $("#installer-install");
JoomlaInstaller.getLoadingOverlay()
.css("top", outerDiv.position().top - $(window).scrollTop())
.css("left", "0")
.css("width", "100%")
.css("height", "100%")
.css("display", "none")
.css("margin-top", "-10px");
});
var JoomlaInstaller = {
getLoadingOverlay: function () {
return jQuery("#loading");
},
showLoading: function () {
this.getLoadingOverlay().css("display", "block");
},
hideLoading: function () {
this.getLoadingOverlay().css("display", "none");
}
};
'
);
JFactory::getDocument()->addStyleDeclaration(
'
#loading {
background: rgba(255, 255, 255, .8) url(\'' .
JHtml::_('image', 'jui/ajax-loader.gif', '',
null, true, true) . '\') 50% 15% no-repeat;
position: fixed;
opacity: 0.8;
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity = 80);
filter: alpha(opacity = 80);
overflow: hidden;
}
'
);
?>
<script type="text/javascript">
// Set the first tab to active if there is no other active tab
jQuery(document).ready(function($) {
var hasTab = function(href){
return $('a[data-toggle="tab"]a[href*="' + href
+ '"]').length;
};
if (!hasTab(localStorage.getItem('tab-href')))
{
var tabAnchor = $("#myTabTabs li:first a");
window.localStorage.setItem('tab-href',
tabAnchor.attr('href'));
tabAnchor.click();
}
});
</script>
<div id="installer-install" class="clearfix">
<form enctype="multipart/form-data" action="<?php
echo
JRoute::_('index.php?option=com_installer&view=install');
?>"
method="post" name="adminForm"
id="adminForm" class="form-horizontal">
<?php if (!empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<!-- Render messages set by extension install scripts here -->
<?php if ($this->showMessage) : ?>
<?php echo $this->loadTemplate('message'); ?>
<?php elseif ($this->showJedAndWebInstaller) : ?>
<div class="alert alert-info j-jed-message"
style="margin-bottom: 40px; line-height: 2em;
color:#333333;">
<?php echo JHtml::_(
'link',
JRoute::_('index.php?option=com_config&view=component&component=com_installer&path=&return='
. urlencode(base64_encode(JUri::getInstance()))),
'<span class="element-invisible">' .
str_replace('"', '"',
JText::_('COM_INSTALLER_SHOW_JED_INFORMATION_TOOLTIP')) .
'</span>',
'class="alert-options hasTooltip icon-options"
data-dismiss="alert" title="' .
str_replace('"', '"',
JText::_('COM_INSTALLER_SHOW_JED_INFORMATION_TOOLTIP')) .
'"'
);
?>
<p><?php echo
JText::_('COM_INSTALLER_INSTALL_FROM_WEB_INFO'); ?>
<?php echo
JText::_('COM_INSTALLER_INSTALL_FROM_WEB_TOS'); ?></p>
<input class="btn" type="button"
value="<?php echo
JText::_('COM_INSTALLER_INSTALL_FROM_WEB_ADD_TAB'); ?>"
onclick="Joomla.submitbuttonInstallWebInstaller()"/>
</div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.startTabSet',
'myTab'); ?>
<?php // Show installation tabs at the start ?>
<?php $firstTab =
JEventDispatcher::getInstance()->trigger('onInstallerViewBeforeFirstTab',
array()); ?>
<?php // Show installation tabs ?>
<?php $tabs =
JEventDispatcher::getInstance()->trigger('onInstallerAddInstallationTab',
array()); ?>
<?php foreach ($tabs as $tab) : ?>
<?php echo JHtml::_('bootstrap.addTab',
'myTab', $tab['name'], $tab['label']); ?>
<fieldset class="uploadform">
<?php echo $tab['content']; ?>
</fieldset>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endforeach; ?>
<?php // Show installation tabs at the end ?>
<?php $lastTab =
JEventDispatcher::getInstance()->trigger('onInstallerViewAfterLastTab',
array()); ?>
<?php $tabs = array_merge($firstTab, $tabs, $lastTab); ?>
<?php if (!$tabs) : ?>
<?php
JFactory::getApplication()->enqueueMessage(JText::_('COM_INSTALLER_NO_INSTALLATION_PLUGINS_FOUND'),
'warning'); ?>
<?php endif; ?>
<?php if ($this->ftp) : ?>
<?php echo JHtml::_('bootstrap.addTab',
'myTab', 'ftp',
JText::_('COM_INSTALLER_MSG_DESCFTPTITLE')); ?>
<?php echo $this->loadTemplate('ftp'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php endif; ?>
<input type="hidden" name="installtype"
value=""/>
<input type="hidden" name="task"
value="install.install"/>
<?php echo JHtml::_('form.token'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</div>
</form>
</div>
<div id="loading"></div>
views/install/tmpl/default.xml000064400000000324151161640610012471
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_INSTALL_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_INSTALL_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/install/view.html.php000064400000002452151161640610012001
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Install View
*
* @since 1.5
*/
class InstallerViewInstall extends InstallerViewDefault
{
/**
* Display the view
*
* @param string $tpl Template
*
* @return void
*
* @since 1.5
*/
public function display($tpl = null)
{
$paths = new stdClass;
$paths->first = '';
$state = $this->get('state');
$this->paths = &$paths;
$this->state = &$state;
$this->showJedAndWebInstaller =
JComponentHelper::getParams('com_installer')->get('show_jed_info',
1);
JPluginHelper::importPlugin('installer');
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onInstallerBeforeDisplay',
array(&$this->showJedAndWebInstaller, $this));
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_INSTALL');
}
}
views/languages/tmpl/default.php000064400000010450151161640610012761
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<div id="installer-languages" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=languages');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this, 'options' =>
array('filterButton' => false))); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="5%"></th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_LANGUAGE', 'name', $listDirn,
$listOrder); ?>
</th>
<th width="1%" class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_LANGUAGE_TAG', 'element',
$listDirn, $listOrder); ?>
</th>
<th width="5%" class="center">
<?php echo JText::_('JVERSION'); ?>
</th>
<th width="40%" class="nowrap
hidden-phone">
<?php echo
JText::_('COM_INSTALLER_HEADING_DETAILS_URL'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$version = new JVersion;
$currentShortVersion = preg_replace('#^([0-9\.]+)(|.*)$#',
'$1', $version->getShortVersion());
$i = 0;
foreach ($this->items as $language) :
preg_match('#^pkg_([a-z]{2,3}-[A-Z]{2})$#',
$language->element, $element);
$language->code = $element[1];
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php $buttonText =
(isset($this->installedLang[0][$language->code]) ||
isset($this->installedLang[1][$language->code])) ?
'REINSTALL' : 'INSTALL'; ?>
<?php $onclick =
'document.getElementById(\'install_url\').value =
\'' . $language->detailsurl . '\';
Joomla.submitbutton(\'install.install\');'; ?>
<input type="button" class="btn btn-small"
value="<?php echo JText::_('COM_INSTALLER_' . $buttonText
. '_BUTTON'); ?>" onclick="<?php echo $onclick;
?>" />
</td>
<td>
<?php echo $language->name; ?>
</td>
<td>
<?php echo $language->code; ?>
</td>
<td class="center">
<?php $minorVersion = $version::MAJOR_VERSION . '.' .
$version::MINOR_VERSION; ?>
<?php // Display a Note if language pack version is not equal to
Joomla version ?>
<?php if (strpos($language->version, $minorVersion) !== 0 ||
strpos($language->version, $currentShortVersion) !== 0) : ?>
<span class="label label-warning hasTooltip"
title="<?php echo
JText::_('JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM');
?>"><?php echo $language->version; ?></span>
<?php else : ?>
<span class="label label-success"><?php echo
$language->version; ?></span>
<?php endif; ?>
</td>
<td class="small hidden-phone">
<a href="<?php echo $language->detailsurl; ?>"
target="_blank"><?php echo $language->detailsurl;
?></a>
</td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="return"
value="<?php echo
base64_encode('index.php?option=com_installer&view=languages')
?>" />
<input type="hidden" id="install_url"
name="install_url" />
<input type="hidden" name="installtype"
value="url" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
views/languages/tmpl/default.xml000064400000000330151161640610012766
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout
title="COM_INSTALLER_LANGUAGES_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_LANGUAGES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/languages/view.html.php000064400000003401151161640610012274
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Language Install View
*
* @since 2.5.7
*/
class InstallerViewLanguages extends InstallerViewDefault
{
/**
* @var object item list
*/
protected $items;
/**
* @var object pagination information
*/
protected $pagination;
/**
* @var object model state
*/
protected $state;
/**
* Display the view.
*
* @param null $tpl template to display
*
* @return mixed|void
*/
public function display($tpl = null)
{
// Get data from the model.
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$this->installedLang = JLanguageHelper::getInstalledLanguages();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_installer');
JToolBarHelper::title(JText::_('COM_INSTALLER_HEADER_' .
$this->getName()), 'puzzle install');
if ($canDo->get('core.admin'))
{
parent::addToolbar();
// TODO: this help screen will need to be created.
JToolBarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_LANGUAGES');
}
}
}
views/manage/tmpl/default.php000064400000012136151161640610012246
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<div id="installer-manage" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=manage');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->showMessage) : ?>
<?php echo $this->loadTemplate('message'); ?>
<?php endif; ?>
<?php if ($this->ftp) : ?>
<?php echo $this->loadTemplate('ftp'); ?>
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo
JText::_('COM_INSTALLER_MSG_MANAGE_NOEXTENSION'); ?>
</div>
<?php else : ?>
<table class="table table-striped"
id="manageList">
<thead>
<tr>
<th width="1%" class="nowrap">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('searchtools.sort',
'JSTATUS', 'status', $listDirn, $listOrder); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_NAME', 'name', $listDirn,
$listOrder); ?>
</th>
<th>
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_LOCATION', 'client_translated',
$listDirn, $listOrder); ?>
</th>
<th>
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_TYPE', 'type_translated',
$listDirn, $listOrder); ?>
</th>
<th width="10%" class="hidden-phone">
<?php echo JText::_('JVERSION'); ?>
</th>
<th width="10%" class="hidden-phone
hidden-tablet">
<?php echo JText::_('JDATE'); ?>
</th>
<th width="15%" class="hidden-phone
hidden-tablet">
<?php echo JText::_('JAUTHOR'); ?>
</th>
<th class="hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_FOLDER', 'folder_translated',
$listDirn, $listOrder); ?>
</th>
<th class="hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_PACKAGE_ID', 'package_id',
$listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_ID', 'extension_id', $listDirn,
$listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="11">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="row<?php echo $i % 2; if ($item->status == 2)
echo ' protected'; ?>">
<td>
<?php echo JHtml::_('grid.id', $i,
$item->extension_id); ?>
</td>
<td class="center">
<?php if (!$item->element) : ?>
<strong>X</strong>
<?php else : ?>
<?php echo JHtml::_('InstallerHtml.Manage.state',
$item->status, $i, $item->status < 2, 'cb'); ?>
<?php endif; ?>
</td>
<td>
<label for="cb<?php echo $i; ?>">
<span class="bold hasTooltip" title="<?php
echo JHtml::_('tooltipText', $item->name,
$item->description, 0); ?>">
<?php echo $item->name; ?>
</span>
</label>
</td>
<td>
<?php echo $item->client_translated; ?>
</td>
<td>
<?php echo $item->type_translated; ?>
</td>
<td class="hidden-phone">
<?php echo @$item->version != '' ? $item->version
: ' '; ?>
</td>
<td class="hidden-phone hidden-tablet">
<?php echo @$item->creationDate != '' ?
$item->creationDate : ' '; ?>
</td>
<td class="hidden-phone hidden-tablet">
<span class="editlinktip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
JText::_('COM_INSTALLER_AUTHOR_INFORMATION'),
$item->author_info, 0); ?>">
<?php echo @$item->author != '' ? $item->author
: ' '; ?>
</span>
</td>
<td class="hidden-phone">
<?php echo $item->folder_translated; ?>
</td>
<td class="hidden-phone">
<?php echo $item->package_id ?: ' '; ?>
</td>
<td class="hidden-phone">
<?php echo $item->extension_id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
<!-- End Content -->
</div>
</form>
</div>
views/manage/tmpl/default.xml000064400000000322151161640610012251
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_MANAGE_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_MANAGE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/manage/view.html.php000064400000004175151161640610011567
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Manage View
*
* @since 1.6
*/
class InstallerViewManage extends InstallerViewDefault
{
protected $items;
protected $pagination;
protected $form;
protected $state;
/**
* Display the view.
*
* @param string $tpl Template
*
* @return mixed|void
*
* @since 1.6
*/
public function display($tpl = null)
{
// Get data from the model.
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Display the view.
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_installer');
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('manage.publish',
'JTOOLBAR_ENABLE', true);
JToolbarHelper::unpublish('manage.unpublish',
'JTOOLBAR_DISABLE', true);
JToolbarHelper::divider();
}
JToolbarHelper::custom('manage.refresh', 'refresh',
'refresh', 'JTOOLBAR_REFRESH_CACHE', true);
JToolbarHelper::divider();
if ($canDo->get('core.delete'))
{
JToolbarHelper::deleteList('COM_INSTALLER_CONFIRM_UNINSTALL',
'manage.remove', 'JTOOLBAR_UNINSTALL');
JToolbarHelper::divider();
}
JHtmlSidebar::setAction('index.php?option=com_installer&view=manage');
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_MANAGE');
}
}
views/update/tmpl/default.php000064400000012021151161640620012272
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<div id="installer-update" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=update');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if ($this->showMessage) : ?>
<?php echo $this->loadTemplate('message'); ?>
<?php endif; ?>
<?php if ($this->ftp) : ?>
<?php echo $this->loadTemplate('ftp'); ?>
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items alert-info">
<?php echo
JText::_('COM_INSTALLER_MSG_UPDATE_NOUPDATES'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="1%" class="nowrap">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_NAME', 'u.name', $listDirn,
$listOrder); ?>
</th>
<th class="nowrap center">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_LOCATION', 'client_translated',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap center">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_TYPE', 'type_translated',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap hidden-phone center">
<?php echo JText::_('COM_INSTALLER_CURRENT_VERSION');
?>
</th>
<th class="nowrap center">
<?php echo JText::_('COM_INSTALLER_NEW_VERSION');
?>
</th>
<th class="nowrap hidden-phone center">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_FOLDER', 'folder_translated',
$listDirn, $listOrder); ?>
</th>
<th class="nowrap hidden-phone center">
<?php echo
JText::_('COM_INSTALLER_HEADING_INSTALLTYPE'); ?>
</th>
<th width="40%" class="nowrap hidden-phone
hidden-tablet">
<?php echo
JText::_('COM_INSTALLER_HEADING_DETAILSURL'); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="9">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php
$client = $item->client_id ?
JText::_('JADMINISTRATOR') : JText::_('JSITE');
$manifest = json_decode($item->manifest_cache);
$current_version = isset($manifest->version) ?
$manifest->version : JText::_('JLIB_UNKNOWN');
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php echo JHtml::_('grid.id', $i,
$item->update_id); ?>
</td>
<td>
<label for="cb<?php echo $i; ?>">
<span class="editlinktip hasTooltip"
title="<?php echo JHtml::_('tooltipText',
JText::_('JGLOBAL_DESCRIPTION'), $item->description ?:
JText::_('COM_INSTALLER_MSG_UPDATE_NODESC'), 0); ?>">
<?php echo $this->escape($item->name); ?>
</span>
</label>
</td>
<td class="center">
<?php echo $item->client_translated; ?>
</td>
<td class="center">
<?php echo $item->type_translated; ?>
</td>
<td class="hidden-phone center">
<span class="label label-warning"><?php echo
$item->current_version; ?></span>
</td>
<td class="center">
<span class="label label-success"><?php echo
$item->version; ?></span>
</td>
<td class="hidden-phone center">
<?php echo $item->folder_translated; ?>
</td>
<td class="hidden-phone center">
<?php echo $item->install_type; ?>
</td>
<td class="hidden-phone hidden-tablet">
<span class="break-word">
<?php echo $item->detailsurl; ?>
<?php if (isset($item->infourl)) : ?>
<br />
<a href="<?php echo $item->infourl; ?>"
target="_blank" rel="noopener noreferrer"><?php
echo $this->escape($item->infourl); ?></a>
<?php endif; ?>
</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
views/update/tmpl/default.xml000064400000000322151161640620012304
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_UPDATE_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_UPDATE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/update/view.html.php000064400000003764151161640620011625
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Update View
*
* @since 1.6
*/
class InstallerViewUpdate extends InstallerViewDefault
{
/**
* List of update items.
*
* @var array
*/
protected $items;
/**
* Model state object.
*
* @var object
*/
protected $state;
/**
* List pagination.
*
* @var JPagination
*/
protected $pagination;
/**
* Display the view.
*
* @param string $tpl Template
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
// Get data from the model.
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
$paths = new stdClass;
$paths->first = '';
$this->paths = &$paths;
if (count($this->items) > 0)
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE'),
'warning');
}
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
JToolbarHelper::custom('update.update', 'upload',
'upload', 'COM_INSTALLER_TOOLBAR_UPDATE', true);
JToolbarHelper::custom('update.find', 'refresh',
'refresh', 'COM_INSTALLER_TOOLBAR_FIND_UPDATES',
false);
JToolbarHelper::custom('update.purge', 'purge',
'purge', 'COM_INSTALLER_TOOLBAR_PURGE', false);
JToolbarHelper::divider();
JHtmlSidebar::setAction('index.php?option=com_installer&view=manage');
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_UPDATE');
}
}
views/updatesites/tmpl/default.php000064400000010602151161640620013345
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$listOrder =
$this->escape($this->state->get('list.ordering'));
$listDirn =
$this->escape($this->state->get('list.direction'));
?>
<div id="installer-manage" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=updatesites');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php echo
JLayoutHelper::render('joomla.searchtools.default',
array('view' => $this)); ?>
<div class="clearfix"></div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="1%" class="center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('searchtools.sort',
'JSTATUS', 'enabled', $listDirn, $listOrder); ?>
</th>
<th class="nowrap">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_UPDATESITE_NAME',
'update_site_name', $listDirn, $listOrder); ?>
</th>
<th class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_NAME', 'name', $listDirn,
$listOrder); ?>
</th>
<th class="hidden-phone hidden-tablet">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_LOCATION', 'client_translated',
$listDirn, $listOrder); ?>
</th>
<th class="hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_TYPE', 'type_translated',
$listDirn, $listOrder); ?>
</th>
<th class="hidden-phone hidden-tablet">
<?php echo JHtml::_('searchtools.sort',
'COM_INSTALLER_HEADING_FOLDER', 'folder_translated',
$listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort',
'JGRID_HEADING_ID', 'update_site_id', $listDirn,
$listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="8">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="row<?php echo $i % 2; if ($item->enabled ==
2) echo ' protected'; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i,
$item->update_site_id); ?>
</td>
<td class="center">
<?php if (!$item->element) : ?>
<strong>X</strong>
<?php else : ?>
<?php echo JHtml::_('InstallerHtml.Updatesites.state',
$item->enabled, $i, $item->enabled < 2, 'cb'); ?>
<?php endif; ?>
</td>
<td>
<label for="cb<?php echo $i; ?>">
<?php echo JText::_($item->update_site_name); ?>
<br />
<span class="small break-word">
<a href="<?php echo $item->location; ?>"
target="_blank" rel="noopener noreferrer"><?php
echo $this->escape($item->location); ?></a>
</span>
</label>
</td>
<td class="hidden-phone">
<span class="bold hasTooltip" title="<?php echo
JHtml::_('tooltipText', $item->name, $item->description,
0); ?>">
<?php echo $item->name; ?>
</span>
</td>
<td class="hidden-phone hidden-tablet">
<?php echo $item->client_translated; ?>
</td>
<td class="hidden-phone">
<?php echo $item->type_translated; ?>
</td>
<td class="hidden-phone hidden-tablet">
<?php echo $item->folder_translated; ?>
</td>
<td class="hidden-phone">
<?php echo $item->update_site_id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task"
value="" />
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
views/updatesites/tmpl/default.xml000064400000000334151161640620013357
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout
title="COM_INSTALLER_UPDATESITES_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_UPDATESITES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/updatesites/view.html.php000064400000004466151161640620012675
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Update Sites View
*
* @package Joomla.Administrator
* @subpackage com_installer
* @since 3.4
*/
class InstallerViewUpdatesites extends InstallerViewDefault
{
protected $items;
protected $pagination;
protected $form;
protected $state;
/**
* Display the view
*
* @param string $tpl Template
*
* @return mixed|void
*
* @since 3.4
*
* @throws Exception on errors
*/
public function display($tpl = null)
{
// Get data from the model
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Display the view
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 3.4
*/
protected function addToolbar()
{
$canDo = JHelperContent::getActions('com_installer');
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::publish('updatesites.publish',
'JTOOLBAR_ENABLE', true);
JToolbarHelper::unpublish('updatesites.unpublish',
'JTOOLBAR_DISABLE', true);
JToolbarHelper::divider();
}
if ($canDo->get('core.delete'))
{
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE',
'updatesites.delete', 'JTOOLBAR_DELETE');
JToolbarHelper::divider();
}
if ($canDo->get('core.admin') ||
$canDo->get('core.options'))
{
JToolbarHelper::custom('updatesites.rebuild',
'refresh.png', 'refresh_f2.png',
'JTOOLBAR_REBUILD', false);
}
JHtmlSidebar::setAction('index.php?option=com_installer&view=updatesites');
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_UPDATESITES');
}
}
views/warnings/tmpl/default.php000064400000003110151161640620012637
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<div id="installer-warnings" class="clearfix">
<form action="<?php echo
JRoute::_('index.php?option=com_installer&view=warnings');
?>" method="post" name="adminForm"
id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php if (count($this->messages)) : ?>
<?php echo JHtml::_('bootstrap.startAccordion',
'warnings', array('active' =>
'warning0')); ?>
<?php $i = 0; ?>
<?php foreach ($this->messages as $message) : ?>
<?php echo JHtml::_('bootstrap.addSlide',
'warnings', $message['message'], 'warning' .
($i++)); ?>
<?php echo $message['description']; ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.addSlide',
'warnings',
JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFO'),
'furtherinfo'); ?>
<?php echo
JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFODESC'); ?>
<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
<?php endif; ?>
<div>
<input type="hidden" name="boxchecked"
value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
</div>
views/warnings/tmpl/default.xml000064400000000326151161640620012656
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_INSTALLER_WARNINGS_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_INSTALLER_WARNINGS_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/warnings/view.html.php000064400000002271151161640620012163
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage com_installer
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('InstallerViewDefault', dirname(__DIR__) .
'/default/view.php');
/**
* Extension Manager Warning View
*
* @since 1.6
*/
class InstallerViewWarnings extends InstallerViewDefault
{
/**
* Display the view
*
* @param string $tpl Template
*
* @return void
*
* @since 1.6
*/
public function display($tpl = null)
{
$items = $this->get('Items');
$this->messages = &$items;
parent::display($tpl);
if (count($items) > 0)
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNINGS_NOTICE'),
'warning');
}
else
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNINGS_NONE'),
'notice');
}
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
parent::addToolbar();
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_WARNINGS');
}
}