Source for file setup.php
Documentation is available at setup.php
* @package Joomla.Installation
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Setup model for the Joomla Core Installer.
* @package Joomla.Installation
* Get the current setup options from the session.
* @return array An array of options from the session
$options =
$session->get('setup.options', array());
* Store the current setup options in the session.
* @param array $options The installation options
* @return array An array of options from the session
// Get the current setup options from the session.
$old =
$session->get('setup.options', array());
// Ensure that we have language
if (!isset
($options['language']) ||
empty($options['language']))
// Merge the new setup options into the current ones and store in the session.
$session->set('setup.options', $options);
* Method to get the form.
* @param string $view The view being processed
* @return mixed JForm object on success, false on failure.
public function getForm($view =
null)
/* @var InstallationApplicationWeb $app */
$view =
$app->input->getWord('view', 'site');
$app->enqueueMessage($e->getMessage(), 'error');
// Check the session for previously entered form data.
// Bind the form data if present.
* Method to check the form data
* @param string $page The view being checked
* @return array Validated form data
// Get the application object.
/* @var InstallationApplicationWeb $app */
// Get the posted values from the request and validate them.
$data =
$app->input->post->get('jform', array(), 'array');
$return =
$this->validate($data, $page);
// Attempt to save the data before validation
$data =
$form->filter($data);
unset
($data['admin_password2']);
// Check for validation errors.
// Redirect back to the previous page.
$app->sendJsonResponse($r);
unset
($return['admin_password2']);
// Store the options in the session.
* Generate a panel of language choices for the user to select their language
* @return boolean True if successful
/* @var InstallationApplicationWeb $app */
// Detect the native language.
// Get a forced language if it exists.
$forced =
$app->getLocalise();
if (!empty($forced['language']))
$native =
$forced['language'];
// Get the list of available languages.
if (!$list ||
$list instanceof
Exception)
* Checks the availability of the parse_ini_file and parse_ini_string functions.
* @return boolean True if the method exists
$disabled_functions =
ini_get('disable_functions');
if (!empty($disabled_functions))
// Attempt to detect them in the disable_functions black list
$disabled_functions =
explode(',', trim($disabled_functions));
$number_of_disabled_functions =
count($disabled_functions);
for ($i =
0; $i <
$number_of_disabled_functions; $i++
)
$disabled_functions[$i] =
trim($disabled_functions[$i]);
$result =
!in_array('parse_ini_string', $disabled_functions);
// Attempt to detect their existence; even pure PHP implementation of them will trigger a positive response, though.
* @return array Array of PHP config options
// Check the PHP Version.
$option->label =
JText::_('INSTL_PHP_VERSION') .
' >= 5.3.1';
// Check for magic quotes gpc.
$option->label =
JText::_('INSTL_MAGIC_QUOTES_GPC');
$option->state =
(ini_get('magic_quotes_gpc') ==
false);
// Check for register globals.
$option->label =
JText::_('INSTL_REGISTER_GLOBALS');
$option->state =
(ini_get('register_globals') ==
false);
// Check for zlib support.
$option->label =
JText::_('INSTL_ZLIB_COMPRESSION_SUPPORT');
// Check for XML support.
$option->label =
JText::_('INSTL_XML_SUPPORT');
// Check for database support.
// We are satisfied if there is at least one database driver available.
$option->label =
JText::_('INSTL_DATABASE_SUPPORT');
$option->label .=
'<br />(' .
implode(', ', $available) .
')';
$option->state =
count($available);
// Check for mbstring options.
// Check for default MB language.
$option->label =
JText::_('INSTL_MB_LANGUAGE_IS_DEFAULT');
$option->notice =
($option->state) ?
null :
JText::_('INSTL_NOTICEMBLANGNOTDEFAULT');
// Check for MB function overload.
$option->label =
JText::_('INSTL_MB_STRING_OVERLOAD_OFF');
$option->state =
(ini_get('mbstring.func_overload') ==
0);
$option->notice =
($option->state) ?
null :
JText::_('INSTL_NOTICEMBSTRINGOVERLOAD');
// Check for a missing native parse_ini_file implementation
$option->label =
JText::_('INSTL_PARSE_INI_FILE_AVAILABLE');
// Check for missing native json_encode / json_decode support
$option->label =
JText::_('INSTL_JSON_SUPPORT_AVAILABLE');
// Check for configuration file writable.
$option->label =
JText::sprintf('INSTL_WRITABLE', 'configuration.php');
$option->state =
$writable;
$option->notice =
($option->state) ?
null :
JText::_('INSTL_NOTICEYOUCANSTILLINSTALL');
* Checks if all of the mandatory PHP options are met
* @return boolean True on success
foreach ($options as $option)
$result =
($result &&
$option->state);
$setting->label =
JText::_('INSTL_SAFE_MODE');
$setting->state = (bool)
ini_get('safe_mode');
$setting->recommended =
false;
// Check for display errors.
$setting->label =
JText::_('INSTL_DISPLAY_ERRORS');
$setting->state = (bool)
ini_get('display_errors');
$setting->recommended =
false;
// Check for file uploads.
$setting->label =
JText::_('INSTL_FILE_UPLOADS');
$setting->state = (bool)
ini_get('file_uploads');
$setting->recommended =
true;
// Check for magic quotes runtimes.
$setting->label =
JText::_('INSTL_MAGIC_QUOTES_RUNTIME');
$setting->state = (bool)
ini_get('magic_quotes_runtime');
$setting->recommended =
false;
// Check for output buffering.
$setting->label =
JText::_('INSTL_OUTPUT_BUFFERING');
$setting->state = (bool)
ini_get('output_buffering');
$setting->recommended =
false;
// Check for session auto-start.
$setting->label =
JText::_('INSTL_SESSION_AUTO_START');
$setting->state = (bool)
ini_get('session.auto_start');
$setting->recommended =
false;
// Check for native ZIP support
$setting->label =
JText::_('INSTL_ZIP_SUPPORT_AVAILABLE');
$setting->recommended =
true;
* Method to validate the form data.
* @param array $data The form data.
* @param string $view The view.
* @return mixed Array of filtered data if valid, false otherwise.
public function validate($data, $view =
null)
/* @var InstallationApplicationWeb $app */
// Filter and validate the form data.
$data =
$form->filter($data);
$return =
$form->validate($data);
if ($return instanceof
Exception)
$app->enqueueMessage($return->getMessage(), 'warning');
// Check the validation results.
// Get the validation messages from the form.
foreach ($form->getErrors() as $message)
if ($message instanceof
Exception)
$app->enqueueMessage($message->getMessage(), 'warning');
$app->enqueueMessage($message, 'warning');
Documentation generated on Tue, 19 Nov 2013 15:12:58 +0100 by phpDocumentor 1.4.3