You've already forked joomla_test
first commit
This commit is contained in:
9
administrator/components/com_installer/access.xml
Normal file
9
administrator/components/com_installer/access.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?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.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>
|
34
administrator/components/com_installer/config.xml
Normal file
34
administrator/components/com_installer/config.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset
|
||||
name="preferences"
|
||||
label="COM_INSTALLER_PREFERENCES_LABEL"
|
||||
description="COM_INSTALLER_PREFERENCES_DESCRIPTION"
|
||||
>
|
||||
<field
|
||||
name="cachetimeout"
|
||||
type="integer"
|
||||
label="COM_INSTALLER_CACHETIMEOUT_LABEL"
|
||||
description="COM_INSTALLER_CACHETIMEOUT_DESC"
|
||||
first="0"
|
||||
last="24"
|
||||
step="1"
|
||||
default="6"
|
||||
/>
|
||||
</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>
|
66
administrator/components/com_installer/controller.php
Normal file
66
administrator/components/com_installer/controller.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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)
|
||||
{
|
||||
require_once 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');
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 2.5
|
||||
*/
|
||||
class InstallerControllerDatabase extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Tries to fix missing database updates
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.5
|
||||
*/
|
||||
public function fix()
|
||||
{
|
||||
$model = $this->getModel('database');
|
||||
$model->fix();
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=database', false));
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 1.6
|
||||
*/
|
||||
class InstallerControllerDiscover extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Refreshes the cache of discovered extensions.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function refresh()
|
||||
{
|
||||
$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()
|
||||
{
|
||||
$model = $this->getModel('discover');
|
||||
$model->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()
|
||||
{
|
||||
$model = $this->getModel('discover');
|
||||
$model->purge();
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=discover', false), $model->_message);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*/
|
||||
class InstallerControllerInstall extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Install an extension.
|
||||
*
|
||||
* @return void
|
||||
* @since 1.5
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('install');
|
||||
if ($model->install())
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_installer.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);
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License, see LICENSE.php
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Languages Installer Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 2.5.7
|
||||
*/
|
||||
class InstallerControllerLanguages extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Finds new Languages.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public function find()
|
||||
{
|
||||
// Purge the updates list
|
||||
$model = $this->getModel('update');
|
||||
$model->purge();
|
||||
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get the caching duration
|
||||
$component = JComponentHelper::getComponent('com_installer');
|
||||
$params = $component->params;
|
||||
$cache_timeout = $params->get('cachetimeout', 6, 'int');
|
||||
$cache_timeout = 3600 * $cache_timeout;
|
||||
|
||||
// Find updates
|
||||
$model = $this->getModel('languages');
|
||||
$model->findLanguages($cache_timeout);
|
||||
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=languages', false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge the updates list.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Purge updates
|
||||
$model = $this->getModel('update');
|
||||
$model->purge();
|
||||
$model->enableSites();
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=languages', false), $model->_message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install languages.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
$model = $this->getModel('languages');
|
||||
|
||||
// Get array of selected languages
|
||||
$lids = $this->input->get('cid', array(), 'array');
|
||||
JArrayHelper::toInteger($lids, array());
|
||||
|
||||
if (!$lids)
|
||||
{
|
||||
// No languages have been selected
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_NOEXTENSIONSELECTED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Install selected languages
|
||||
$model->install($lids);
|
||||
}
|
||||
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=languages', false));
|
||||
}
|
||||
}
|
126
administrator/components/com_installer/controllers/manage.php
Normal file
126
administrator/components/com_installer/controllers/manage.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Installer Manage Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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.
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$ids = $this->input->get('cid', array(), 'array');
|
||||
$values = array('publish' => 1, 'unpublish' => 0);
|
||||
$task = $this->getTask();
|
||||
$value = JArrayHelper::getValue($values, $task, 0, 'int');
|
||||
|
||||
if (empty($ids))
|
||||
{
|
||||
JError::raiseWarning(500, JText::_('COM_INSTALLER_ERROR_NO_EXTENSIONS_SELECTED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the 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
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$eid = $this->input->get('cid', array(), 'array');
|
||||
$model = $this->getModel('manage');
|
||||
|
||||
JArrayHelper::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
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$uid = $this->input->get('cid', array(), 'array');
|
||||
$model = $this->getModel('manage');
|
||||
|
||||
JArrayHelper::toInteger($uid, array());
|
||||
$model->refresh($uid);
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=manage', false));
|
||||
}
|
||||
}
|
155
administrator/components/com_installer/controllers/update.php
Normal file
155
administrator/components/com_installer/controllers/update.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Installer Update Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 1.6
|
||||
*/
|
||||
class InstallerControllerUpdate extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Update a set of extensions.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$model = $this->getModel('update');
|
||||
$uid = $this->input->get('cid', array(), 'array');
|
||||
|
||||
JArrayHelper::toInteger($uid, array());
|
||||
if ($model->update($uid))
|
||||
{
|
||||
$cache = JFactory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$redirect_url = $app->getUserState('com_installer.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()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// Get the caching duration
|
||||
$component = JComponentHelper::getComponent('com_installer');
|
||||
$params = $component->params;
|
||||
$cache_timeout = $params->get('cachetimeout', 6, 'int');
|
||||
$cache_timeout = 3600 * $cache_timeout;
|
||||
|
||||
// Find updates
|
||||
$model = $this->getModel('update');
|
||||
$model->findUpdates(0, $cache_timeout);
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_installer&view=update', false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges updates.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
// Purge updates
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
$model = $this->getModel('update');
|
||||
$model->purge();
|
||||
$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()
|
||||
{
|
||||
/*
|
||||
* Note: we don't do a token check as we're fetching information
|
||||
* asynchronously. This means that between requests the token might
|
||||
* change, making it impossible for AJAX to work.
|
||||
*/
|
||||
|
||||
$eid = $this->input->getInt('eid', 0);
|
||||
$skip = $this->input->get('skip', array(), 'array');
|
||||
|
||||
$cache_timeout = $this->input->getInt('cache_timeout', 0);
|
||||
if ($cache_timeout == 0)
|
||||
{
|
||||
$component = JComponentHelper::getComponent('com_installer');
|
||||
$params = $component->params;
|
||||
$cache_timeout = $params->get('cachetimeout', 6, 'int');
|
||||
$cache_timeout = 3600 * $cache_timeout;
|
||||
}
|
||||
|
||||
$model = $this->getModel('update');
|
||||
$model->findUpdates($eid, $cache_timeout);
|
||||
|
||||
$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);
|
||||
|
||||
JFactory::getApplication()->close();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
142
administrator/components/com_installer/helpers/installer.php
Normal file
142
administrator/components/com_installer/helpers/installer.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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.
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, '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
|
||||
*/
|
||||
public static function getActions()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$result = new JObject;
|
||||
|
||||
$assetName = 'com_installer';
|
||||
|
||||
$actions = JAccess::getActions($assetName);
|
||||
|
||||
foreach ($actions as $action)
|
||||
{
|
||||
$result->set($action->name, $user->authorise($action->name, $assetName));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
1
administrator/components/com_installer/index.html
Normal file
1
administrator/components/com_installer/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
19
administrator/components/com_installer/installer.php
Normal file
19
administrator/components/com_installer/installer.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_installer'))
|
||||
{
|
||||
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Installer');
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
$controller->redirect();
|
29
administrator/components/com_installer/installer.xml
Normal file
29
administrator/components/com_installer/installer.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?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 - 2013 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>index.html</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>
|
||||
|
247
administrator/components/com_installer/models/database.php
Normal file
247
administrator/components/com_installer/models/database.php
Normal file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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');
|
||||
JLoader::register('JoomlaInstallerScript', JPATH_ADMINISTRATOR . '/components/com_admin/script.php');
|
||||
|
||||
/**
|
||||
* Installer Manage Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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 = null, $direction = null)
|
||||
{
|
||||
$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('name', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the changeset object
|
||||
*
|
||||
* @return JSchemaChangeset
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$folder = JPATH_ADMINISTRATOR . '/components/com_admin/sql/updates/';
|
||||
|
||||
try
|
||||
{
|
||||
$changeSet = JSchemaChangeset::getInstance(JFactory::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 12.2
|
||||
*/
|
||||
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 = JFactory::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();
|
||||
$db = JFactory::getDbo();
|
||||
$result = false;
|
||||
|
||||
// Check value. If ok, don't do update
|
||||
$version = $this->getSchemaVersion();
|
||||
if ($version == $schema)
|
||||
{
|
||||
$result = $version;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete old row
|
||||
$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'))
|
||||
->set($db->quoteName('extension_id') . '= 700')
|
||||
->set($db->quoteName('version_id') . '= ' . $db->quote($schema));
|
||||
$db->setQuery($query);
|
||||
if ($db->execute())
|
||||
{
|
||||
$result = $schema;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 JRegistry($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 JRegistry($table->manifest_cache);
|
||||
$updateVersion = $cache->get('version');
|
||||
$cmsVersion = new JVersion;
|
||||
if ($updateVersion == $cmsVersion->getShortVersion())
|
||||
{
|
||||
return $updateVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache->set('version', $cmsVersion->getShortVersion());
|
||||
$table->manifest_cache = $cache->toString();
|
||||
if ($table->store())
|
||||
{
|
||||
return $cmsVersion->getShortVersion();
|
||||
}
|
||||
else
|
||||
{
|
||||
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 JRegistry;
|
||||
$newParams->set('filters', $contentParams->get('filters'));
|
||||
$table->params = (string) $newParams;
|
||||
$table->store();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
180
administrator/components/com_installer/models/discover.php
Normal file
180
administrator/components/com_installer/models/discover.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once __DIR__ . '/extension.php';
|
||||
|
||||
/**
|
||||
* Installer Manage Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 1.6
|
||||
*/
|
||||
class InstallerModelDiscover 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 = null, $direction = null)
|
||||
{
|
||||
$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('name', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the database query.
|
||||
*
|
||||
* @return JDatabaseQuery the database query
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('*')
|
||||
->from('#__extensions')
|
||||
->where('state=-1');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Discover extensions.
|
||||
*
|
||||
* Finds uninstalled extensions
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function discover()
|
||||
{
|
||||
// Purge the list of discovered extensions
|
||||
$this->purge();
|
||||
|
||||
$installer = JInstaller::getInstance();
|
||||
$results = $installer->discover();
|
||||
|
||||
// Get all templates, including discovered ones
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select('extension_id, element, folder, client_id, type')
|
||||
->from('#__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;
|
||||
}
|
||||
unset($installedtmp);
|
||||
|
||||
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->store();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs a discovered extension.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function discover_install()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$installer = JInstaller::getInstance();
|
||||
$eid = JRequest::getVar('cid', 0);
|
||||
if (is_array($eid) || $eid)
|
||||
{
|
||||
if (!is_array($eid))
|
||||
{
|
||||
$eid = array($eid);
|
||||
}
|
||||
JArrayHelper::toInteger($eid);
|
||||
$app = JFactory::getApplication();
|
||||
$failed = false;
|
||||
foreach ($eid as $id)
|
||||
{
|
||||
$result = $installer->discover_install($id);
|
||||
if (!$result)
|
||||
{
|
||||
$failed = true;
|
||||
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_DISCOVER_INSTALLFAILED') . ': ' . $id);
|
||||
}
|
||||
}
|
||||
$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 bool True on success
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->delete('#__extensions')
|
||||
->where('state = -1');
|
||||
$db->setQuery($query);
|
||||
if ($db->execute())
|
||||
{
|
||||
$this->_message = JText::_('COM_INSTALLER_MSG_DISCOVER_PURGEDDISCOVEREDEXTENSIONS');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_message = JText::_('COM_INSTALLER_MSG_DISCOVER_FAILEDTOPURGEEXTENSIONS');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
191
administrator/components/com_installer/models/extension.php
Normal file
191
administrator/components/com_installer/models/extension.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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 Abstract Extension Model
|
||||
*
|
||||
* @abstract
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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',
|
||||
'enabled',
|
||||
'type',
|
||||
'folder',
|
||||
'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)
|
||||
{
|
||||
$ordering = $this->getState('list.ordering');
|
||||
$search = $this->getState('filter.search');
|
||||
|
||||
// Replace slashes so preg_match will work
|
||||
$search = str_replace('/', ' ', $search);
|
||||
$db = $this->getDbo();
|
||||
|
||||
if ($ordering == 'name' || (!empty($search) && stripos($search, 'id:') !== 0))
|
||||
{
|
||||
$db->setQuery($query);
|
||||
$result = $db->loadObjectList();
|
||||
$this->translate($result);
|
||||
if (!empty($search))
|
||||
{
|
||||
foreach ($result as $i => $item)
|
||||
{
|
||||
if (!preg_match("/$search/i", $item->name))
|
||||
{
|
||||
unset($result[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
JArrayHelper::sortObjects($result, $this->getState('list.ordering'), $this->getState('list.direction') == 'desc' ? -1 : 1, true, true);
|
||||
$total = count($result);
|
||||
$this->cache[$this->getStoreId('getTotal')] = $total;
|
||||
if ($total < $limitstart)
|
||||
{
|
||||
$limitstart = 0;
|
||||
$this->setState('list.start', 0);
|
||||
}
|
||||
return array_slice($result, $limitstart, $limit ? $limit : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->order($db->quoteName($ordering) . ' ' . $this->getState('list.direction'));
|
||||
$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
|
||||
*/
|
||||
private function translate(&$items)
|
||||
{
|
||||
$lang = JFactory::getLanguage();
|
||||
foreach ($items as &$item)
|
||||
{
|
||||
if (strlen($item->manifest_cache))
|
||||
{
|
||||
$data = json_decode($item->manifest_cache);
|
||||
if ($data)
|
||||
{
|
||||
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');
|
||||
$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, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'file':
|
||||
$extension = 'files_' . $item->element;
|
||||
$lang->load("$extension.sys", JPATH_SITE, null, false, false)
|
||||
|| $lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'library':
|
||||
$extension = 'lib_' . $item->element;
|
||||
$lang->load("$extension.sys", JPATH_SITE, null, false, false)
|
||||
|| $lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'module':
|
||||
$extension = $item->element;
|
||||
$source = $path . '/modules/' . $extension;
|
||||
$lang->load("$extension.sys", $path, null, false, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", $path, $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'package':
|
||||
$extension = $item->element;
|
||||
$lang->load("$extension.sys", JPATH_SITE, null, false, false)
|
||||
|| $lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'plugin':
|
||||
$extension = 'plg_' . $item->folder . '_' . $item->element;
|
||||
$source = JPATH_PLUGINS . '/' . $item->folder . '/' . $item->element;
|
||||
$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
break;
|
||||
case 'template':
|
||||
$extension = 'tpl_' . $item->element;
|
||||
$source = $path . '/templates/' . $item->element;
|
||||
$lang->load("$extension.sys", $path, null, false, false)
|
||||
|| $lang->load("$extension.sys", $source, null, false, false)
|
||||
|| $lang->load("$extension.sys", $path, $lang->getDefault(), false, false)
|
||||
|| $lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
|
||||
break;
|
||||
}
|
||||
if (!in_array($item->type, array('language', 'template', 'library')))
|
||||
{
|
||||
$item->name = JText::_($item->name);
|
||||
}
|
||||
settype($item->description, 'string');
|
||||
if (!in_array($item->type, array('language')))
|
||||
{
|
||||
$item->description = JText::_($item->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
administrator/components/com_installer/models/index.html
Normal file
1
administrator/components/com_installer/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
276
administrator/components/com_installer/models/install.php
Normal file
276
administrator/components/com_installer/models/install.php
Normal file
@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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', '');
|
||||
|
||||
// Recall the 'Install from Directory' path.
|
||||
$path = $app->getUserStateFromRequest($this->_context . '.install_directory', 'install_directory', $app->getCfg('tmp_path'));
|
||||
$this->setState('install.directory', $path);
|
||||
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();
|
||||
|
||||
switch ($app->input->getWord('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;
|
||||
}
|
||||
|
||||
// Was the package unpacked?
|
||||
if (!$package)
|
||||
{
|
||||
$app->setUserState('com_installer.message', JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get an installer instance
|
||||
$installer = JInstaller::getInstance();
|
||||
|
||||
// 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;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package installed sucessfully
|
||||
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
|
||||
$result = true;
|
||||
}
|
||||
|
||||
// Set some model state values
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage($msg);
|
||||
$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']);
|
||||
|
||||
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
|
||||
$userfile = JRequest::getVar('install_package', null, 'files', 'array');
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Check if there was a 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);
|
||||
|
||||
// Unpack the downloaded package file
|
||||
$package = JInstallerHelper::unpack($tmp_dest);
|
||||
|
||||
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'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
return $package;
|
||||
}
|
||||
}
|
278
administrator/components/com_installer/models/languages.php
Normal file
278
administrator/components/com_installer/models/languages.php
Normal file
@ -0,0 +1,278 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @copyright Copyright (C) 2005 - 2013 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');
|
||||
|
||||
/**
|
||||
* Languages Installer Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 2.5.7
|
||||
*/
|
||||
class InstallerModelLanguages extends JModelList
|
||||
{
|
||||
/**
|
||||
* Constructor override, defines a white list 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(
|
||||
'update_id', 'update_id',
|
||||
'name', 'name',
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the available languages database query.
|
||||
*
|
||||
* @return JDatabaseQuery The database query
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
protected function _getListQuery()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the updates table
|
||||
$query->select('update_id, name, version, detailsurl, type')
|
||||
|
||||
->from('#__updates');
|
||||
|
||||
// This Where clause will avoid to list languages already installed.
|
||||
$query->where('extension_id = 0');
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(name LIKE ' . $search . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$listOrder = $this->state->get('list.ordering');
|
||||
$orderDirn = $this->state->get('list.direction');
|
||||
$query->order($db->escape($listOrder) . ' ' . $db->escape($orderDirn));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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')
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
$value = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $value);
|
||||
|
||||
$this->setState('extension_message', $app->getUserState('com_installer.extension_message'));
|
||||
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to find available languages in the Accredited Languages Update Site.
|
||||
*
|
||||
* @param int $cache_timeout time before refreshing the cached updates
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public function findLanguages($cache_timeout = 0)
|
||||
{
|
||||
$updater = JUpdater::getInstance();
|
||||
|
||||
/*
|
||||
* The following function uses extension_id 600, that is the english language extension id.
|
||||
* In #__update_sites_extensions you should have 600 linked to the Accredited Translations Repo
|
||||
*/
|
||||
$updater->findUpdates(array(600), $cache_timeout);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install languages in the system.
|
||||
*
|
||||
* @param array $lids array of language ids selected in the list
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
public function install($lids)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$installer = JInstaller::getInstance();
|
||||
|
||||
// Loop through every selected language
|
||||
foreach ($lids as $id)
|
||||
{
|
||||
// Loads the update database object that represents the language
|
||||
$language = JTable::getInstance('update');
|
||||
$language->load($id);
|
||||
|
||||
// Get the url to the XML manifest file of the selected language
|
||||
$remote_manifest = $this->_getLanguageManifest($id);
|
||||
if (!$remote_manifest)
|
||||
{
|
||||
// Could not find the url, the information in the update server may be corrupt
|
||||
$message = JText::sprintf('COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_MANIFEST', $language->name);
|
||||
$message .= ' ' . JText::_('COM_INSTALLER_MSG_LANGUAGES_TRY_LATER');
|
||||
$app->enqueueMessage($message);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Based on the language XML manifest get the url of the package to download
|
||||
$package_url = $this->_getPackageUrl($remote_manifest);
|
||||
if (!$package_url)
|
||||
{
|
||||
// Could not find the url , maybe the url is wrong in the update server, or there is not internet access
|
||||
$message = JText::sprintf('COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_PACKAGE', $language->name);
|
||||
$message .= ' ' . JText::_('COM_INSTALLER_MSG_LANGUAGES_TRY_LATER');
|
||||
$app->enqueueMessage($message);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Download the package to the tmp folder
|
||||
$package = $this->_downloadPackage($package_url);
|
||||
|
||||
// Install the package
|
||||
if (!$installer->install($package['dir']))
|
||||
{
|
||||
// There was an error installing the package
|
||||
$message = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', $language->name);
|
||||
$message .= ' ' . JText::_('COM_INSTALLER_MSG_LANGUAGES_TRY_LATER');
|
||||
$app->enqueueMessage($message);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Package installed successfully
|
||||
$app->enqueueMessage(JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', $language->name));
|
||||
|
||||
// Cleanup the install files in tmp folder
|
||||
if (!is_file($package['packagefile']))
|
||||
{
|
||||
$config = JFactory::getConfig();
|
||||
$package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
|
||||
}
|
||||
JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
|
||||
|
||||
// Delete the installed language from the list
|
||||
$language->delete($id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the manifest file of a selected language from a the language list in a update server.
|
||||
*
|
||||
* @param int $uid the id of the language in the #__updates table
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
protected function _getLanguageManifest($uid)
|
||||
{
|
||||
$instance = JTable::getInstance('update');
|
||||
$instance->load($uid);
|
||||
|
||||
return $instance->detailsurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the url of the package to download.
|
||||
*
|
||||
* @param string $remote_manifest url to the manifest XML file of the remote package
|
||||
*
|
||||
* @return string|bool
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
protected function _getPackageUrl( $remote_manifest )
|
||||
{
|
||||
$update = new JUpdate;
|
||||
$update->loadFromXML($remote_manifest);
|
||||
$package_url = trim($update->get('downloadurl', false)->_data);
|
||||
|
||||
return $package_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a language package from a URL and unpack it in the tmp folder.
|
||||
*
|
||||
* @param string $url hola
|
||||
*
|
||||
* @return array|bool Package details or false on failure
|
||||
*
|
||||
* @since 2.5.7
|
||||
*/
|
||||
protected function _downloadPackage($url)
|
||||
{
|
||||
// Download the package from the given URL
|
||||
$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);
|
||||
|
||||
return $package;
|
||||
}
|
||||
}
|
329
administrator/components/com_installer/models/manage.php
Normal file
329
administrator/components/com_installer/models/manage.php
Normal file
@ -0,0 +1,329 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
require_once __DIR__ . '/extension.php';
|
||||
|
||||
/**
|
||||
* Installer Manage Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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('name', 'client_id', 'status', 'type', 'folder', '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 = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '');
|
||||
$this->setState('filter.client_id', $clientId);
|
||||
|
||||
$status = $this->getUserStateFromRequest($this->context . '.filter.status', 'filter_status', '');
|
||||
$this->setState('filter.status', $status);
|
||||
|
||||
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '');
|
||||
$this->setState('filter.type', $categoryId);
|
||||
|
||||
$group = $this->getUserStateFromRequest($this->context . '.filter.group', 'filter_group', '');
|
||||
$this->setState('filter.group', $group);
|
||||
|
||||
$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('name', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'))
|
||||
{
|
||||
$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;
|
||||
}
|
||||
if (!$table->store())
|
||||
{
|
||||
$this->setError($table->getError());
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = false;
|
||||
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
|
||||
}
|
||||
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'))
|
||||
{
|
||||
|
||||
$failed = array();
|
||||
|
||||
/*
|
||||
* 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
|
||||
foreach ($eid as $id)
|
||||
{
|
||||
$id = trim($id);
|
||||
$row->load($id);
|
||||
if ($row->type && $row->type != 'language')
|
||||
{
|
||||
$result = $installer->uninstall($row->type, $id);
|
||||
|
||||
// Build an array of extensions that failed to uninstall
|
||||
if ($result === false)
|
||||
{
|
||||
$failed[] = $id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$failed[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
$langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type);
|
||||
$rowtype = JText::_($langstring);
|
||||
if (strpos($rowtype, $langstring) !== false)
|
||||
{
|
||||
$rowtype = $row->type;
|
||||
}
|
||||
|
||||
if (count($failed))
|
||||
{
|
||||
if ($row->type == 'language')
|
||||
{
|
||||
|
||||
// One should always uninstall a language package, not a single language
|
||||
$msg = JText::_('COM_INSTALLER_UNINSTALL_LANGUAGE');
|
||||
$result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// There was an error in uninstalling the package
|
||||
$msg = JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype);
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Package uninstalled sucessfully
|
||||
$msg = JText::sprintf('COM_INSTALLER_UNINSTALL_SUCCESS', $rowtype);
|
||||
$result = true;
|
||||
}
|
||||
$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'));
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the database query
|
||||
*
|
||||
* @return JDatabaseQuery The database query
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$status = $this->getState('filter.status');
|
||||
$type = $this->getState('filter.type');
|
||||
$client = $this->getState('filter.client_id');
|
||||
$group = $this->getState('filter.group');
|
||||
$query = JFactory::getDbo()->getQuery(true)
|
||||
->select('*')
|
||||
->select('2*protected+(1-protected)*enabled as status')
|
||||
->from('#__extensions')
|
||||
->where('state=0');
|
||||
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 ($client != '')
|
||||
{
|
||||
$query->where('client_id=' . (int) $client);
|
||||
}
|
||||
if ($group != '' && in_array($type, array('plugin', 'library', '')))
|
||||
{
|
||||
$query->where('folder=' . $this->_db->quote($group == '*' ? '' : $group));
|
||||
}
|
||||
|
||||
// Filter by search in id
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search) && stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('extension_id = ' . (int) substr($search, 3));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
383
administrator/components/com_installer/models/update.php
Normal file
383
administrator/components/com_installer/models/update.php
Normal file
@ -0,0 +1,383 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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');
|
||||
|
||||
/**
|
||||
* Installer Update Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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',
|
||||
'client_id',
|
||||
'type',
|
||||
'folder',
|
||||
'extension_id',
|
||||
'update_id',
|
||||
'update_site_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 = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$value = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $value);
|
||||
|
||||
$clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '');
|
||||
$this->setState('filter.client_id', $clientId);
|
||||
|
||||
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '');
|
||||
$this->setState('filter.type', $categoryId);
|
||||
|
||||
$group = $this->getUserStateFromRequest($this->context . '.filter.group', 'filter_group', '');
|
||||
$this->setState('filter.group', $group);
|
||||
|
||||
$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('name', 'asc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the database query
|
||||
*
|
||||
* @return JDatabaseQuery The database query
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$type = $this->getState('filter.type');
|
||||
$client = $this->getState('filter.client_id');
|
||||
$group = $this->getState('filter.group');
|
||||
|
||||
// Grab updates ignoring new installs
|
||||
$query->select('*')
|
||||
->from('#__updates')
|
||||
->where('extension_id != 0')
|
||||
->order($this->getState('list.ordering') . ' ' . $this->getState('list.direction'));
|
||||
|
||||
if ($type)
|
||||
{
|
||||
$query->where('type=' . $db->quote($type));
|
||||
}
|
||||
if ($client != '')
|
||||
{
|
||||
$query->where('client_id = ' . intval($client));
|
||||
}
|
||||
if ($group != '' && in_array($type, array('plugin', 'library', '')))
|
||||
{
|
||||
$query->where('folder=' . $db->quote($group == '*' ? '' : $group));
|
||||
}
|
||||
|
||||
// Filter by extension_id
|
||||
if ($eid = $this->getState('filter.extension_id'))
|
||||
{
|
||||
$query->where($db->quoteName('extension_id') . ' = ' . $db->quote((int) $eid));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where($db->quoteName('extension_id') . ' != ' . $db->quote(0))
|
||||
->where($db->quoteName('extension_id') . ' != ' . $db->quote(700));
|
||||
}
|
||||
|
||||
// Filter by search
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
$query->where('name LIKE ' . $db->quote('%' . $search . '%'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds updates for an extension.
|
||||
*
|
||||
* @param int $eid Extension identifier to look for
|
||||
* @param int $cache_timeout Cache timout
|
||||
*
|
||||
* @return boolean Result
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function findUpdates($eid = 0, $cache_timeout = 0)
|
||||
{
|
||||
// Purge the updates list
|
||||
$this->purge();
|
||||
|
||||
$updater = JUpdater::getInstance();
|
||||
$updater->findUpdates($eid, $cache_timeout);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all of the updates from the table.
|
||||
*
|
||||
* @return boolean result of operation
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function purge()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Note: TRUNCATE is a DDL operation
|
||||
// This may or may not mean depending on your database
|
||||
$db->setQuery('TRUNCATE TABLE #__updates');
|
||||
if ($db->execute())
|
||||
{
|
||||
// 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();
|
||||
$this->_message = JText::_('COM_INSTALLER_PURGED_UPDATES');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_message = JText::_('COM_INSTALLER_FAILED_TO_PURGE_UPDATES');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables any disabled rows in #__update_sites table
|
||||
*
|
||||
* @return boolean result of operation
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function enableSites()
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->update('#__update_sites')
|
||||
->set('enabled = 1')
|
||||
->where('enabled = 0');
|
||||
$db->setQuery($query);
|
||||
if ($db->execute())
|
||||
{
|
||||
if ($rows = $db->getAffectedRows())
|
||||
{
|
||||
$this->_message .= JText::plural('COM_INSTALLER_ENABLED_UPDATES', $rows);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_message .= JText::_('COM_INSTALLER_FAILED_TO_ENABLE_UPDATES');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update function.
|
||||
*
|
||||
* Sets the "result" state with the result of the operation.
|
||||
*
|
||||
* @param array $uids Array[int] List of updates to apply
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function update($uids)
|
||||
{
|
||||
$result = true;
|
||||
foreach ($uids as $uid)
|
||||
{
|
||||
$update = new JUpdate;
|
||||
$instance = JTable::getInstance('update');
|
||||
$instance->load($uid);
|
||||
$update->loadFromXML($instance->detailsurl);
|
||||
|
||||
// Install sets state and enqueues messages
|
||||
$res = $this->install($update);
|
||||
|
||||
if ($res)
|
||||
{
|
||||
$instance->delete($uid);
|
||||
}
|
||||
|
||||
$result = $res & $result;
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
$url = $update->downloadurl->_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
JError::raiseWarning('', JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$p_file = JInstallerHelper::downloadPackage($url);
|
||||
|
||||
// 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 = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
|
||||
|
||||
// Get an installer instance
|
||||
$installer = JInstaller::getInstance();
|
||||
$update->set('type', $package['type']);
|
||||
|
||||
// Install the package
|
||||
if (!$installer->update($package['dir']))
|
||||
{
|
||||
// There was an error updating the package
|
||||
$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
|
||||
$result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Package updated successfully
|
||||
$msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
|
||||
$result = true;
|
||||
}
|
||||
|
||||
// Quick change
|
||||
$this->type = $package['type'];
|
||||
|
||||
// Set some model state values
|
||||
$app->enqueueMessage($msg);
|
||||
|
||||
// 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'];
|
||||
}
|
||||
|
||||
JInstallerHelper::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 . '.data', array());
|
||||
return $data;
|
||||
}
|
||||
}
|
144
administrator/components/com_installer/models/warnings.php
Normal file
144
administrator/components/com_installer/models/warnings.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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 Templates Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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)
|
||||
{
|
||||
$val = trim($val);
|
||||
$last = strtolower($val{strlen($val) - 1});
|
||||
switch ($last)
|
||||
{
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
|
||||
return $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))
|
||||
{
|
||||
// 8MB
|
||||
$messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYWARN'),
|
||||
'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_LOWMEMORYDESC'));
|
||||
}
|
||||
elseif ($memory_limit < (16 * 1024 * 1024))
|
||||
{
|
||||
// 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 < (4 * 1024 * 1024)) // 4MB
|
||||
{
|
||||
$messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZE'),
|
||||
'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLPOSTSIZEDESC'));
|
||||
}
|
||||
|
||||
if ($upload_max_filesize < (4 * 1024 * 1024)) // 4MB
|
||||
{
|
||||
$messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'),
|
||||
'description' => JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZEDESC'));
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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">
|
||||
<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) : ?>
|
||||
<div class="alert alert-info">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_DATABASE_OK'); ?>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'other')); ?>
|
||||
<?php else : ?>
|
||||
<div class="alert alert-error">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_DATABASE_ERRORS'); ?>
|
||||
</div>
|
||||
<?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'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!(strncmp($this->schemaVersion, JVERSION, 5) === 0)) : ?>
|
||||
<li><?php echo JText::sprintf('COM_INSTALLER_MSG_DATABASE_SCHEMA_ERROR', $this->schemaVersion, JVERSION); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (($this->updateVersion != JVERSION)) : ?>
|
||||
<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', true)); ?>
|
||||
<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'); ?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Manage View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 1.6
|
||||
*/
|
||||
class InstallerViewDatabase extends InstallerViewDefault
|
||||
{
|
||||
/**
|
||||
* 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->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) ? $this->schemaVersion : JText::_('JNONE');
|
||||
$this->updateVersion = ($this->updateVersion) ? $this->updateVersion : JText::_('JNONE');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->errorCount = count($this->errors);
|
||||
|
||||
if (!(strncmp($this->schemaVersion, JVERSION, 5) === 0))
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
if (!$this->filterParams)
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
if (($this->updateVersion != JVERSION))
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
|
||||
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, false);
|
||||
JToolbarHelper::divider();
|
||||
parent::addToolbar();
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_DATABASE');
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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>
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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');
|
||||
?>
|
||||
<table class="adminform">
|
||||
<tbody>
|
||||
<?php if ($message1) : ?>
|
||||
<tr>
|
||||
<th><?php echo $message1 ?></th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php if ($message2) : ?>
|
||||
<tr>
|
||||
<td><?php echo $message2; ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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 = InstallerHelper::getActions();
|
||||
JToolbarHelper::title(JText::_('COM_INSTALLER_HEADER_' . $this->getName()), 'install.png');
|
||||
|
||||
if ($canDo->get('core.admin'))
|
||||
{
|
||||
JToolbarHelper::preferences('com_installer');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
|
||||
// Document
|
||||
$document = JFactory::getDocument();
|
||||
$document->setTitle(JText::_('COM_INSTALLER_TITLE_' . $this->getName()));
|
||||
|
||||
// Render side bar
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
<div id="installer-discover">
|
||||
<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; ?>
|
||||
|
||||
<!-- Begin Content -->
|
||||
<?php if (count($this->items)) : ?>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20"><?php echo JHtml::_('grid.checkall'); ?></th>
|
||||
<th class="nowrap"><?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_NAME', 'name', $listDirn, $listOrder); ?></th>
|
||||
<th class="center"><?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_TYPE', 'type', $listDirn, $listOrder); ?></th>
|
||||
<th width="10%" class="center"><?php echo JText::_('JVERSION'); ?></th>
|
||||
<th width="10%" class="center"><?php echo JText::_('JDATE'); ?></th>
|
||||
<th><?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_FOLDER', 'folder', $listDirn, $listOrder); ?></th>
|
||||
<th><?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_CLIENT', 'client_id', $listDirn, $listOrder); ?></th>
|
||||
<th width="15%" class="center"><?php echo JText::_('JAUTHOR'); ?></th>
|
||||
<th width="10"><?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_ID', 'extension_id', $listDirn, $listOrder); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot><tr><td colspan="10"><?php echo $this->pagination->getListFooter(); ?></td></tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) : ?>
|
||||
<tr class="row<?php echo $i % 2;?>">
|
||||
<td><?php echo JHtml::_('grid.id', $i, $item->extension_id); ?></td>
|
||||
<td><span class="bold hasTooltip" title="<?php echo JHtml::tooltipText($item->name, $item->description, 0); ?>"><?php echo $item->name; ?></span></td>
|
||||
<td class="center"><?php echo JText::_('COM_INSTALLER_TYPE_' . $item->type); ?></td>
|
||||
<td class="center"><?php echo @$item->version != '' ? $item->version : ' '; ?></td>
|
||||
<td class="center"><?php echo @$item->creationDate != '' ? $item->creationDate : ' '; ?></td>
|
||||
<td class="center"><?php echo @$item->folder != '' ? $item->folder : JText::_('COM_INSTALLER_TYPE_NONAPPLICABLE'); ?></td>
|
||||
<td class="center"><?php echo $item->client; ?></td>
|
||||
<td class="center">
|
||||
<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><?php echo $item->extension_id ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_DISCOVER_DESCRIPTION'); ?>
|
||||
<?php else : ?>
|
||||
<p>
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_DISCOVER_DESCRIPTION'); ?>
|
||||
</p>
|
||||
<div class="alert">
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_DISCOVER_NOEXTENSION'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Manage View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @since 1.6
|
||||
*/
|
||||
class InstallerViewDiscover extends InstallerViewDefault
|
||||
{
|
||||
/**
|
||||
* 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');
|
||||
|
||||
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('discover.install', 'upload', 'upload', 'JTOOLBAR_INSTALL', true, false);
|
||||
JToolbarHelper::custom('discover.refresh', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_DISCOVER', false, false);
|
||||
JToolbarHelper::divider();
|
||||
parent::addToolbar();
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_DISCOVER');
|
||||
}
|
||||
}
|
1
administrator/components/com_installer/views/index.html
Normal file
1
administrator/components/com_installer/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(pressbutton)
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
|
||||
// do field validation
|
||||
if (form.install_package.value == ""){
|
||||
alert("<?php echo JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE', true); ?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
form.installtype.value = 'upload';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
Joomla.submitbutton3 = function(pressbutton)
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
|
||||
// do field validation
|
||||
if (form.install_directory.value == ""){
|
||||
alert("<?php echo JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_DIRECTORY', true); ?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
form.installtype.value = 'folder';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
Joomla.submitbutton4 = function(pressbutton)
|
||||
{
|
||||
var form = document.getElementById('adminForm');
|
||||
|
||||
// do field validation
|
||||
if (form.install_url.value == "" || form.install_url.value == "http://"){
|
||||
alert("<?php echo JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL', true); ?>");
|
||||
}
|
||||
else
|
||||
{
|
||||
form.installtype.value = 'url';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="installer-install">
|
||||
<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 endif; ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'upload')); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'upload', JText::_('COM_INSTALLER_UPLOAD_PACKAGE_FILE', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo JText::_('COM_INSTALLER_UPLOAD_PACKAGE_FILE'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="install_package" class="control-label"><?php echo JText::_('COM_INSTALLER_PACKAGE_FILE'); ?></label>
|
||||
<div class="controls">
|
||||
<input class="input_box" id="install_package" name="install_package" type="file" size="57" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input class="btn btn-primary" type="button" value="<?php echo JText::_('COM_INSTALLER_UPLOAD_AND_INSTALL'); ?>" onclick="Joomla.submitbutton()" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'directory', JText::_('COM_INSTALLER_INSTALL_FROM_DIRECTORY', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo JText::_('COM_INSTALLER_INSTALL_FROM_DIRECTORY'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="install_directory" class="control-label"><?php echo JText::_('COM_INSTALLER_INSTALL_DIRECTORY'); ?></label>
|
||||
<div class="controls">
|
||||
<input type="text" id="install_directory" name="install_directory" class="span5 input_box" size="70" value="<?php echo $this->state->get('install.directory'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_INSTALLER_INSTALL_BUTTON'); ?>" onclick="Joomla.submitbutton3()" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'url', JText::_('COM_INSTALLER_INSTALL_FROM_URL', true)); ?>
|
||||
<fieldset class="uploadform">
|
||||
<legend><?php echo JText::_('COM_INSTALLER_INSTALL_FROM_URL'); ?></legend>
|
||||
<div class="control-group">
|
||||
<label for="install_url" class="control-label"><?php echo JText::_('COM_INSTALLER_INSTALL_URL'); ?></label>
|
||||
<div class="controls">
|
||||
<input type="text" id="install_url" name="install_url" class="span5 input_box" size="70" value="http://" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<input type="button" class="btn btn-primary" value="<?php echo JText::_('COM_INSTALLER_INSTALL_BUTTON'); ?>" onclick="Joomla.submitbutton4()" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php if ($this->ftp) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'ftp', JText::_('COM_INSTALLER_MSG_DESCFTPTITLE', true)); ?>
|
||||
<?php echo $this->loadTemplate('ftp'); ?>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="type" value="" />
|
||||
<input type="hidden" name="installtype" value="upload" />
|
||||
<input type="hidden" name="task" value="install.install" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Install View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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'));
|
||||
|
||||
$version = new JVersion;
|
||||
|
||||
?>
|
||||
|
||||
<div id="installer-languages">
|
||||
<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 if (count($this->items) || $this->escape($this->state->get('filter.search'))) : ?>
|
||||
<?php echo $this->loadTemplate('filter'); ?>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th class="nowrap">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_NAME', 'name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="center">
|
||||
<?php echo JText::_('JVERSION'); ?>
|
||||
</th>
|
||||
<th class="center nowrap hidden-phone">
|
||||
<?php echo JText::_('COM_INSTALLER_HEADING_TYPE'); ?>
|
||||
</th>
|
||||
<th width="35%" class="nowrap hidden-phone">
|
||||
<?php echo JText::_('COM_INSTALLER_HEADING_DETAILS_URL'); ?>
|
||||
</th>
|
||||
<th width="30" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_ID', 'update_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $language) :
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td class="hidden-phone">
|
||||
<?php echo JHtml::_('grid.id', $i, $language->update_id, false, 'cid'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $language->name; ?>
|
||||
|
||||
<?php // Display a Note if language pack version is not equal to Joomla version ?>
|
||||
<?php if (substr($language->version, 0, 3) != $version->RELEASE
|
||||
|| substr($language->version, 0, 5) != $version->RELEASE . "." . $version->DEV_LEVEL) : ?>
|
||||
<div class="small"><?php echo JText::_('JGLOBAL_LANGUAGE_VERSION_NOT_PLATFORM'); ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="center small">
|
||||
<?php echo $language->version; ?>
|
||||
</td>
|
||||
<td class="center small hidden-phone">
|
||||
<?php echo JText::_('COM_INSTALLER_TYPE_' . strtoupper($language->type)); ?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $language->detailsurl; ?>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
<?php echo $language->update_id; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<div class="alert"><?php echo JText::_('COM_INSTALLER_MSG_LANGUAGES_NOLANGUAGES'); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_INSTALLER_LANGUAGES_FILTER_SEARCH_DESC'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left hidden-phone">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Language installer view
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
$canDo = InstallerHelper::getActions();
|
||||
JToolBarHelper::title(JText::_('COM_INSTALLER_HEADER_' . $this->getName()), 'install.png');
|
||||
|
||||
if ($canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::custom('languages.install', 'upload', 'upload', 'COM_INSTALLER_TOOLBAR_INSTALL', true, false);
|
||||
JToolBarHelper::custom('languages.find', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_FIND_LANGUAGES', false, false);
|
||||
JToolBarHelper::divider();
|
||||
parent::addToolbar();
|
||||
|
||||
// TODO: this help screen will need to be created
|
||||
JToolBarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_LANGUAGES');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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">
|
||||
<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; ?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_INSTALLER_FILTER_LABEL'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
||||
|
||||
<?php if (count($this->items)) : ?>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th class="nowrap">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_NAME', 'name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_LOCATION', 'client_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="center">
|
||||
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'status', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_TYPE', 'type', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="center">
|
||||
<?php echo JText::_('JVERSION'); ?>
|
||||
</th>
|
||||
<th width="10%">
|
||||
<?php echo JText::_('JDATE'); ?>
|
||||
</th>
|
||||
<th width="15%">
|
||||
<?php echo JText::_('JAUTHOR'); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_FOLDER', 'folder', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10">
|
||||
<?php echo JHtml::_('grid.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>
|
||||
<span class="bold hasTooltip" title="<?php echo JHtml::tooltipText($item->name, $item->description, 0); ?>">
|
||||
<?php echo $item->name; ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo $item->client; ?>
|
||||
</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 class="center">
|
||||
<?php echo JText::_('COM_INSTALLER_TYPE_' . $item->type); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo @$item->version != '' ? $item->version : ' '; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo @$item->creationDate != '' ? $item->creationDate : ' '; ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<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="center">
|
||||
<?php echo @$item->folder != '' ? $item->folder : JText::_('COM_INSTALLER_TYPE_NONAPPLICABLE'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?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" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
<!-- End Content -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Manage View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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');
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
JError::raiseError(500, implode("\n", $errors));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if there are no matching items
|
||||
if (!count($this->items))
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(
|
||||
JText::_('COM_INSTALLER_MSG_MANAGE_NOEXTENSION'),
|
||||
'warning'
|
||||
);
|
||||
}
|
||||
|
||||
// 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 = InstallerHelper::getActions();
|
||||
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('', 'manage.remove', 'JTOOLBAR_UNINSTALL');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_MANAGE');
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_installer&view=manage');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_CLIENT_SELECT'),
|
||||
'filter_client_id',
|
||||
JHtml::_('select.options', array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), 'value', 'text', $this->state->get('filter.client_id'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_STATE_SELECT'),
|
||||
'filter_status',
|
||||
JHtml::_('select.options', array('0' => 'JDISABLED', '1' => 'JENABLED', '2' => 'JPROTECTED', '3' => 'JUNPROTECTED'), 'value', 'text', $this->state->get('filter.status'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_TYPE_SELECT'),
|
||||
'filter_type',
|
||||
JHtml::_('select.options', InstallerHelper::getExtensionTypes(), 'value', 'text', $this->state->get('filter.type'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_FOLDER_SELECT'),
|
||||
'filter_group',
|
||||
JHtml::_('select.options', array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))), 'value', 'text', $this->state->get('filter.group'), true)
|
||||
);
|
||||
|
||||
parent::addToolbar();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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">
|
||||
<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) : ?>
|
||||
<div class="alert alert-info">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<?php echo $this->loadTemplate('message'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->ftp) : ?>
|
||||
<?php echo $this->loadTemplate('ftp'); ?>
|
||||
<?php endif; ?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_INSTALLER_FILTER_LABEL'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"> </div>
|
||||
|
||||
<!-- Begin Content -->
|
||||
<?php if (count($this->items)) : ?>
|
||||
<table class="table table-striped" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th class="nowrap">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_NAME', 'name', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap">
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_INSTALLTYPE', 'extension_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_TYPE', 'type', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="center">
|
||||
<?php echo JText::_('JVERSION'); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_FOLDER', 'folder', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_INSTALLER_HEADING_CLIENT', 'client_id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="25%">
|
||||
<?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) :
|
||||
$client = $item->client_id ? JText::_('JADMINISTRATOR') : JText::_('JSITE');
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>">
|
||||
<td>
|
||||
<?php echo JHtml::_('grid.id', $i, $item->update_id); ?>
|
||||
</td>
|
||||
<td>
|
||||
<span class="editlinktip hasTooltip" title="<?php echo JHtml::tooltipText(JText::_('JGLOBAL_DESCRIPTION'), $item->description ? $item->description : JText::_('COM_INSTALLER_MSG_UPDATE_NODESC'), 0); ?>">
|
||||
<?php echo $this->escape($item->name); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo $item->extension_id ? JText::_('COM_INSTALLER_MSG_UPDATE_UPDATE') : JText::_('COM_INSTALLER_NEW_INSTALL') ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo JText::_('COM_INSTALLER_TYPE_' . $item->type) ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo $item->version ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo @$item->folder != '' ? $item->folder : JText::_('COM_INSTALLER_TYPE_NONAPPLICABLE'); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo $client; ?>
|
||||
</td>
|
||||
<td><?php echo $item->detailsurl ?>
|
||||
<?php if (isset($item->infourl)) : ?>
|
||||
<br />
|
||||
<a href="<?php echo $item->infourl; ?>" target="_blank">
|
||||
<?php echo $this->escape($item->infourl); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<div class="alert alert-info">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<?php echo JText::_('COM_INSTALLER_MSG_UPDATE_NOUPDATES'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Update View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get data from the model
|
||||
$this->state = $this->get('State');
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$paths = new stdClass;
|
||||
$paths->first = '';
|
||||
|
||||
$this->paths = &$paths;
|
||||
if (count($this->items) > 0)
|
||||
{
|
||||
$app->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE'), 'notice');
|
||||
}
|
||||
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, false);
|
||||
JToolbarHelper::custom('update.find', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_FIND_UPDATES', false, false);
|
||||
JToolbarHelper::divider();
|
||||
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_UPDATE');
|
||||
JHtmlSidebar::setAction('index.php?option=com_installer&view=manage');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_CLIENT_SELECT'),
|
||||
'filter_client_id',
|
||||
JHtml::_('select.options', array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), 'value', 'text', $this->state->get('filter.client_id'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_TYPE_SELECT'),
|
||||
'filter_type',
|
||||
JHtml::_('select.options', InstallerHelper::getExtensionTypes(), 'value', 'text', $this->state->get('filter.type'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('COM_INSTALLER_VALUE_FOLDER_SELECT'),
|
||||
'filter_group',
|
||||
JHtml::_(
|
||||
'select.options',
|
||||
array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))),
|
||||
'value',
|
||||
'text',
|
||||
$this->state->get('filter.group'),
|
||||
true
|
||||
)
|
||||
);
|
||||
parent::addToolbar();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 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">
|
||||
<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))
|
||||
{
|
||||
echo '<div class="alert alert-info"><a class="close" data-dismiss="alert" href="#">×</a>'. JText::_('COM_INSTALLER_MSG_WARNINGS_NONE').'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo JHtml::_('sliders.start', 'warning-sliders', array('useCookie' => 1));
|
||||
|
||||
foreach($this->messages as $message)
|
||||
{
|
||||
echo JHtml::_('sliders.panel', $message['message'], str_replace(' ', '', $message['message']));
|
||||
echo '<div style="padding: 5px;" >'.$message['description'].'</div>';
|
||||
}
|
||||
echo JHtml::_('sliders.panel', JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFO'), 'furtherinfo-pane');
|
||||
echo '<div style="padding: 5px;" >'. JText::_('COM_INSTALLER_MSG_WARNINGFURTHERINFODESC') .'</div>';
|
||||
echo JHtml::_('sliders.end');
|
||||
}
|
||||
?>
|
||||
<div class="clr"> </div>
|
||||
<div>
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
include_once __DIR__ . '/../default/view.php';
|
||||
|
||||
/**
|
||||
* Extension Manager Templates View
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_installer
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
{
|
||||
parent::addToolbar();
|
||||
JToolbarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_WARNINGS');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user