You've already forked joomla_test
first commit
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user