- md5
- 7cdd04e028cb75f89c675e454bab7601
- sha1
- c761a3f3c451eebdf33cfc05ec8213aad4b00c79
- sha256
- 1c244df66f7bad65357dffff50ae55f25dcc4af64c5d5733390a2798ed8aef3c
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
<?php
/**
* @version $Id: controller.php 10094 2008-03-02 04:35:10Z instance $
* @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()
{
$model = &$this->getModel( 'Install' );
$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 2 releases, Joomla 1.5.2 to 1.5.3. See them all, or every version of this file.