| [ Index ] |
PHP Cross Reference of Joomla 1.5.25 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: controller.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Installer 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * details. 13 */ 14 15 // Check to ensure this file is included in Joomla! 16 defined('_JEXEC') or die( 'Restricted access' ); 17 18 jimport('joomla.application.component.controller'); 19 jimport('joomla.client.helper'); 20 21 /** 22 * Installer Controller 23 * 24 * @package Joomla 25 * @subpackage Installer 26 * @since 1.5 27 */ 28 class InstallerController extends JController 29 { 30 /** 31 * Display the extension installer form 32 * 33 * @access public 34 * @return void 35 * @since 1.5 36 */ 37 function installform() 38 { 39 global $mainframe; 40 41 $model = &$this->getModel( 'Install' ); 42 $model->setState( 'install.directory', $mainframe->getCfg( 'config.tmp_path' )); 43 44 $view = &$this->getView( 'Install'); 45 46 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 47 $view->assignRef('ftp', $ftp); 48 49 $view->setModel( $model, true ); 50 $view->display(); 51 } 52 53 /** 54 * Install an extension 55 * 56 * @access public 57 * @return void 58 * @since 1.5 59 */ 60 function doInstall() 61 { 62 // Check for request forgeries 63 JRequest::checkToken() or jexit( 'Invalid Token' ); 64 65 $model = &$this->getModel( 'Install' ); 66 $view = &$this->getView( 'Install' ); 67 68 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 69 $view->assignRef('ftp', $ftp); 70 71 if ($model->install()) { 72 $cache = &JFactory::getCache('mod_menu'); 73 $cache->clean(); 74 } 75 76 $view->setModel( $model, true ); 77 $view->display(); 78 } 79 80 /** 81 * Manage an extension type (List extensions of a given type) 82 * 83 * @access public 84 * @return void 85 * @since 1.5 86 */ 87 function manage() 88 { 89 $type = JRequest::getWord('type', 'components'); 90 $model = &$this->getModel( $type ); 91 $view = &$this->getView( $type ); 92 93 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 94 $view->assignRef('ftp', $ftp); 95 96 $view->setModel( $model, true ); 97 $view->display(); 98 } 99 100 /** 101 * Enable an extension (If supported) 102 * 103 * @access public 104 * @return void 105 * @since 1.5 106 */ 107 function enable() 108 { 109 // Check for request forgeries 110 JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' ); 111 112 $type = JRequest::getWord('type', 'components'); 113 $model = &$this->getModel( $type ); 114 $view = &$this->getView( $type ); 115 116 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 117 $view->assignRef('ftp', $ftp); 118 119 if (method_exists($model, 'enable')) { 120 $eid = JRequest::getVar('eid', array(), '', 'array'); 121 JArrayHelper::toInteger($eid, array()); 122 $model->enable($eid); 123 } 124 125 $view->setModel( $model, true ); 126 $view->display(); 127 } 128 129 /** 130 * Disable an extension (If supported) 131 * 132 * @access public 133 * @return void 134 * @since 1.5 135 */ 136 function disable() 137 { 138 // Check for request forgeries 139 JRequest::checkToken( 'request' ) or jexit( 'Invalid Token' ); 140 141 $type = JRequest::getWord('type', 'components'); 142 $model = &$this->getModel( $type ); 143 $view = &$this->getView( $type ); 144 145 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 146 $view->assignRef('ftp', $ftp); 147 148 if (method_exists($model, 'disable')) { 149 $eid = JRequest::getVar('eid', array(), '', 'array'); 150 JArrayHelper::toInteger($eid, array()); 151 $model->disable($eid); 152 } 153 154 $view->setModel( $model, true ); 155 $view->display(); 156 } 157 158 /** 159 * Remove an extension (Uninstall) 160 * 161 * @access public 162 * @return void 163 * @since 1.5 164 */ 165 function remove() 166 { 167 // Check for request forgeries 168 JRequest::checkToken() or jexit( 'Invalid Token' ); 169 170 $type = JRequest::getWord('type', 'components'); 171 $model = &$this->getModel( $type ); 172 $view = &$this->getView( $type ); 173 174 $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); 175 $view->assignRef('ftp', $ftp); 176 177 $eid = JRequest::getVar('eid', array(), '', 'array'); 178 179 // Update to handle components radio box 180 // Checks there is only one extensions, we're uninstalling components 181 // and then checks that the zero numbered item is set (shouldn't be a zero 182 // if the eid is set to the proper format) 183 if((count($eid) == 1) && ($type == 'components') && (isset($eid[0]))) $eid = array($eid[0] => 0); 184 185 JArrayHelper::toInteger($eid, array()); 186 $result = $model->remove($eid); 187 188 $view->setModel( $model, true ); 189 $view->display(); 190 } 191 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Nov 14 16:47:20 2011 | Cross-referenced by PHPXref 0.7.1 |