- md5
- 4b073dd0d5b8f8862b880ed28057c134
- sha1
- 4304f5d94f0503bdb63d126f0bc5000e2069955f
- sha256
- f69812efa001a34131a1da434653b387e1e7b15cec2f29118a6bd39e1639938e
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
<?php
/**
* @version $Id: controller.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package Joomla
* @subpackage Installation
* @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.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* @package Joomla
* @subpackage Installation
*/
jimport('joomla.application.component.controller');
require_once( dirname(__FILE__).DS.'models'.DS.'model.php');
require_once( dirname(__FILE__).DS.'views'.DS.'install'.DS.'view.php');
class JInstallationController extends JController
{
var $_model = null;
var $_view = null;
/**
* Constructor
*/
function __construct( $config = array() )
{
$config['name'] = 'JInstallation';
parent::__construct( $config );
}
/**
*
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function dbconfig()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->dbConfig() )
{
$view->error();
return false;
}
$view->dbConfig();
return true;
}
/**
* Overload the parent controller method to add a check for configuration variables
* when a task has been provided
*
* @param String $task Task to perform
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function execute($task)
{
global $mainframe;
// Sanity check
if ( $task && ( $task != 'lang' ) && ( $task != 'removedir' ) )
{
/**
* To get past this point, a cookietest must be carried in the user's state.
* If the state is not set, then cookies are probably disabled.
**/
$goodEnoughForMe = $mainframe->getUserState('application.cookietest');
if ( ! $goodEnoughForMe )
{
$model =& $this->getModel();
$model->setError(JText::_('WARNCOOKIESNOTENABLED'));
$view =& $this->getView();
$view->error();
return false;
}
}
else
{
// Zilch the application registry - start from scratch
$session =& JFactory::getSession();
$registry =& $session->get('registry');
$registry->makeNameSpace('application');
// Set the cookie test seed
$mainframe->setUserState('application.cookietest', 1);
}
parent::execute($task);
}
/**
* Initialize data for the installation
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function initialize()
{
return true;
}
/**
* Present form for FTP information
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function ftpconfig()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->ftpConfig() )
{
$view->error();
return false;
}
$view->ftpConfig();
return true;
}
/**
* Get the model for the installer component
*
* @return JInstallerModel
* @access protected
* @since 1.5
*/
function & getModel()
{
if ( ! $this->_model )
{
$this->_model = new JInstallationModel();
}
return $this->_model;
}
/**
* Get the view for the installer component
*
* @return JInstallerView
* @access protected
* @since 1.5
*/
function & getView()
{
if ( ! $this->_view )
{
$this->_view = new JInstallationView();
$model =& $this->getModel();
$model->test = "blah";
$this->_view->setModel($model, true);
}
return $this->_view;
}
/**
* Present license information
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function license()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->license() )
{
$view->error();
return false;
}
$view->license();
return true;
}
/**
* Present a choice of languages
*
* Step One!
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function lang()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->chooseLanguage() )
{
$view->error();
return false;
}
$view->chooseLanguage();
return true;
}
/**
*
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function makedb()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->makeDB())
{
$view->error();
return false;
}
if ( ! $model->ftpConfig( 1 ) )
{
$view->error();
return false;
}
$view->ftpConfig();
return true;
}
/**
* Present the main configuration options
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function mainconfig()
{
//$this->dumpLoad();
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->mainConfig() )
{
$view->error();
return false;
}
$view->mainConfig();
return true;
}
/**
* Present a preinstall check
*
* Step Two!
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function preinstall()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->preInstall() )
{
$view->error();
return true;
}
$view->preInstall();
return true;
}
/**
* Remove directory messages
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function removedir()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->removedir() )
{
$view->error();
return true;
}
$view->removedir();
return true;
}
/**
*
*
* @return Boolean True if successful
* @access public
* @since 1.5
*/
function saveconfig()
{
$model =& $this->getModel();
$view =& $this->getView();
if ( ! $model->saveConfig() )
{
$view->error();
return false;
}
if ( ! $model->finish() )
{
$view->error();
return false;
}
$view->finish();
return true;
}
function dumpLoad() {
$model =& $this->getModel();
$model->dumpLoad();
}
function migration() {
$model =& $this->getModel();
$model->setData('back', 'mainconfig');
$view =& $this->getView();
if(!$model->checkUpload()) {
$view->error();
return false;
}
$view->migrateScreen();
return true;
}
function postmigrate() {
$model =& $this->getModel();
$view =& $this->getView();
if($model->postMigrate()) {
// errors!
}
}
}
The same content is in 4 releases, Joomla 1.5.0 to 1.5.3. See them all, or every version of this file.