- md5
- 655fdf62c38fb309952881f6bfbdb595
- sha1
- 20e1177d7933bfe04694ca749d3b99637dc3abca
- sha256
- 9e70d16d0d3d77598bd0b34a988ae7b794bb0f57cb184d11e00d86e460961ae8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
<?php
/**
* @version $Id: controller.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @subpackage Installer
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant to the
* GNU General Public License, and as distributed it includes or is derivative
* of works licensed under the GNU General Public License or other free or open
* source software licenses. See COPYRIGHT.php for copyright notices and
* details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport('joomla.application.component.controller');
jimport('joomla.client.helper');
/**
* Installer Controller
*
* @package Joomla
* @subpackage Installer
* @since 1.5
*/
class InstallerController extends JController
{
/**
* Display the extension installer form
*
* @access public
* @return void
* @since 1.5
*/
function installform()
{
global $mainframe;
$model = &$this->getModel( 'Install' );
$model->setState( 'install.directory', $mainframe->getCfg( 'config.tmp_path' ));
$view = &$this->getView( 'Install');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
$view->setModel( $model, true );
$view->display();
}
/**
* Install an extension
*
* @access public
* @return void
* @since 1.5
*/
function doInstall()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
$model = &$this->getModel( 'Install' );
$view = &$this->getView( 'Install' );
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
if ($model->install()) {
$cache = &JFactory::getCache('mod_menu');
$cache->clean();
}
$view->setModel( $model, true );
$view->display();
}
/**
* Manage an extension type (List extensions of a given type)
*
* @access public
* @return void
* @since 1.5
*/
function manage()
{
$type = JRequest::getWord('type', 'components');
$model = &$this->getModel( $type );
$view = &$this->getView( $type );
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
$view->setModel( $model, true );
$view->display();
}
/**
* Enable an extension (If supported)
*
* @access public
* @return void
* @since 1.5
*/
function enable()
{
// Check for request forgeries
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
$type = JRequest::getWord('type', 'components');
$model = &$this->getModel( $type );
$view = &$this->getView( $type );
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
if (method_exists($model, 'enable')) {
$eid = JRequest::getVar('eid', array(), '', 'array');
JArrayHelper::toInteger($eid, array());
$model->enable($eid);
}
$view->setModel( $model, true );
$view->display();
}
/**
* Disable an extension (If supported)
*
* @access public
* @return void
* @since 1.5
*/
function disable()
{
// Check for request forgeries
JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' );
$type = JRequest::getWord('type', 'components');
$model = &$this->getModel( $type );
$view = &$this->getView( $type );
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
if (method_exists($model, 'disable')) {
$eid = JRequest::getVar('eid', array(), '', 'array');
JArrayHelper::toInteger($eid, array());
$model->disable($eid);
}
$view->setModel( $model, true );
$view->display();
}
/**
* Remove an extension (Uninstall)
*
* @access public
* @return void
* @since 1.5
*/
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );
$type = JRequest::getWord('type', 'components');
$model = &$this->getModel( $type );
$view = &$this->getView( $type );
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$view->assignRef('ftp', $ftp);
$eid = JRequest::getVar('eid', array(), '', 'array');
// Update to handle components radio box
// Checks there is only one extensions, we're uninstalling components
// and then checks that the zero numbered item is set (shouldn't be a zero
// if the eid is set to the proper format)
if((count($eid) == 1) && ($type == 'components') && (isset($eid[0]))) $eid = array($eid[0] => 0);
JArrayHelper::toInteger($eid, array());
$result = $model->remove($eid);
$view->setModel( $model, true );
$view->display();
}
}
The same content is in 12 releases, Joomla 1.5.4 to 1.5.15. See them all, or every version of this file.