| [ Index ] |
PHP Cross Reference of Joomla 1.5.25 |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @version $Id: controller.php 14401 2010-01-26 14:10:00Z louis $ 5 * @package Joomla 6 * @subpackage Installation 7 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 8 * @license GNU/GPL, see LICENSE.php 9 * Joomla! is free software. This version may have been modified pursuant 10 * to the GNU General Public License, and as distributed it includes or 11 * is derivative of works licensed under the GNU General Public License or 12 * other free or open source software licenses. 13 * See COPYRIGHT.php for copyright notices and details. 14 */ 15 16 // no direct access 17 defined('_JEXEC') or die('Restricted access'); 18 19 /** 20 * @package Joomla 21 * @subpackage Installation 22 */ 23 24 jimport('joomla.application.component.controller'); 25 require_once( dirname(__FILE__).DS.'models'.DS.'model.php'); 26 require_once( dirname(__FILE__).DS.'views'.DS.'install'.DS.'view.php'); 27 28 class JInstallationController extends JController 29 { 30 var $_model = null; 31 32 var $_view = null; 33 34 /** 35 * Constructor 36 */ 37 function __construct( $config = array() ) 38 { 39 $config['name'] = 'JInstallation'; 40 parent::__construct( $config ); 41 } 42 43 /** 44 * 45 * 46 * @return Boolean True if successful 47 * @access public 48 * @since 1.5 49 */ 50 function dbconfig() 51 { 52 $model =& $this->getModel(); 53 $view =& $this->getView(); 54 55 if ( ! $model->dbConfig() ) 56 { 57 $view->error(); 58 return false; 59 } 60 61 $view->dbConfig(); 62 63 return true; 64 } 65 66 /** 67 * Overload the parent controller method to add a check for configuration variables 68 * when a task has been provided 69 * 70 * @param String $task Task to perform 71 * @return Boolean True if successful 72 * @access public 73 * @since 1.5 74 */ 75 function execute($task) 76 { 77 global $mainframe; 78 79 // Sanity check 80 if ( $task && ( $task != 'lang' ) && ( $task != 'removedir' ) ) 81 { 82 83 /** 84 * To get past this point, a cookietest must be carried in the user's state. 85 * If the state is not set, then cookies are probably disabled. 86 **/ 87 88 $goodEnoughForMe = $mainframe->getUserState('application.cookietest'); 89 90 if ( ! $goodEnoughForMe ) 91 { 92 $model =& $this->getModel(); 93 $model->setError(JText::_('WARNCOOKIESNOTENABLED')); 94 $view =& $this->getView(); 95 $view->error(); 96 return false; 97 } 98 99 } 100 else 101 { 102 // Zilch the application registry - start from scratch 103 $session =& JFactory::getSession(); 104 $registry =& $session->get('registry'); 105 $registry->makeNameSpace('application'); 106 107 // Set the cookie test seed 108 $mainframe->setUserState('application.cookietest', 1); 109 } 110 111 parent::execute($task); 112 } 113 114 /** 115 * Initialize data for the installation 116 * 117 * @return Boolean True if successful 118 * @access public 119 * @since 1.5 120 */ 121 function initialize() 122 { 123 return true; 124 } 125 126 /** 127 * Present form for FTP information 128 * 129 * @return Boolean True if successful 130 * @access public 131 * @since 1.5 132 */ 133 function ftpconfig() 134 { 135 $model =& $this->getModel(); 136 $view =& $this->getView(); 137 138 if ( ! $model->ftpConfig() ) 139 { 140 $view->error(); 141 return false; 142 } 143 144 $view->ftpConfig(); 145 146 return true; 147 } 148 149 /** 150 * Get the model for the installer component 151 * 152 * @return JInstallerModel 153 * @access protected 154 * @since 1.5 155 */ 156 function & getModel() 157 { 158 159 if ( ! $this->_model ) 160 { 161 $this->_model = new JInstallationModel(); 162 } 163 164 return $this->_model; 165 } 166 167 /** 168 * Get the view for the installer component 169 * 170 * @return JInstallerView 171 * @access protected 172 * @since 1.5 173 */ 174 function & getView() 175 { 176 177 if ( ! $this->_view ) 178 { 179 $this->_view = new JInstallationView(); 180 $model =& $this->getModel(); 181 $model->test = "blah"; 182 $this->_view->setModel($model, true); 183 } 184 185 return $this->_view; 186 } 187 188 /** 189 * Present license information 190 * 191 * @return Boolean True if successful 192 * @access public 193 * @since 1.5 194 */ 195 function license() 196 { 197 $model =& $this->getModel(); 198 $view =& $this->getView(); 199 200 if ( ! $model->license() ) 201 { 202 $view->error(); 203 return false; 204 } 205 206 $view->license(); 207 208 return true; 209 } 210 211 /** 212 * Present a choice of languages 213 * 214 * Step One! 215 * 216 * @return Boolean True if successful 217 * @access public 218 * @since 1.5 219 */ 220 function lang() 221 { 222 $model =& $this->getModel(); 223 $view =& $this->getView(); 224 225 if ( ! $model->chooseLanguage() ) 226 { 227 $view->error(); 228 return false; 229 } 230 231 $view->chooseLanguage(); 232 233 return true; 234 } 235 236 /** 237 * 238 * 239 * @return Boolean True if successful 240 * @access public 241 * @since 1.5 242 */ 243 function makedb() 244 { 245 $model =& $this->getModel(); 246 $view =& $this->getView(); 247 248 if ( ! $model->makeDB()) 249 { 250 $view->error(); 251 return false; 252 } 253 254 if ( ! $model->ftpConfig( 1 ) ) 255 { 256 $view->error(); 257 return false; 258 } 259 260 $view->ftpConfig(); 261 262 return true; 263 } 264 265 /** 266 * Present the main configuration options 267 * 268 * @return Boolean True if successful 269 * @access public 270 * @since 1.5 271 */ 272 function mainconfig() 273 { 274 //$this->dumpLoad(); 275 $model =& $this->getModel(); 276 $view =& $this->getView(); 277 278 if ( ! $model->mainConfig() ) 279 { 280 $view->error(); 281 return false; 282 } 283 284 $view->mainConfig(); 285 286 return true; 287 } 288 289 /** 290 * Present a preinstall check 291 * 292 * Step Two! 293 * 294 * @return Boolean True if successful 295 * @access public 296 * @since 1.5 297 */ 298 function preinstall() 299 { 300 $model =& $this->getModel(); 301 $view =& $this->getView(); 302 303 if ( ! $model->preInstall() ) 304 { 305 $view->error(); 306 return true; 307 } 308 309 $view->preInstall(); 310 311 return true; 312 } 313 314 /** 315 * Remove directory messages 316 * 317 * @return Boolean True if successful 318 * @access public 319 * @since 1.5 320 */ 321 function removedir() 322 { 323 $model =& $this->getModel(); 324 $view =& $this->getView(); 325 326 if ( ! $model->removedir() ) 327 { 328 $view->error(); 329 return true; 330 } 331 332 $view->removedir(); 333 334 return true; 335 } 336 337 /** 338 * 339 * 340 * @return Boolean True if successful 341 * @access public 342 * @since 1.5 343 */ 344 function saveconfig() 345 { 346 $model =& $this->getModel(); 347 $view =& $this->getView(); 348 349 if ( ! $model->saveConfig() ) 350 { 351 $view->error(); 352 return false; 353 } 354 355 if ( ! $model->finish() ) 356 { 357 $view->error(); 358 return false; 359 } 360 361 $view->finish(); 362 363 return true; 364 } 365 366 function dumpLoad() { 367 $model =& $this->getModel(); 368 $model->dumpLoad(); 369 370 } 371 372 function migration() { 373 $model =& $this->getModel(); 374 $model->setData('back', 'mainconfig'); 375 $view =& $this->getView(); 376 if(!$model->checkUpload()) { 377 $view->error(); 378 return false; 379 } 380 381 $view->migrateScreen(); 382 return true; 383 } 384 385 function postmigrate() { 386 $model =& $this->getModel(); 387 $view =& $this->getView(); 388 if($model->postMigrate()) { 389 // errors! 390 } 391 } 392 393 }
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 |