<commit_before><?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
 */

defined('_JEXEC') or die;

jimport('joomla.application.component.helper');

/**
 * Base controller class for the Joomla Core Installer.
 *
 * @package		Joomla.Installation
 * @since		1.6
 */
class JInstallationController extends JControllerLegacy
{
	/**
	 * Method to display a view.
	 *
	 * @param	boolean	$cachable	If true, the view output will be cached
	 * @param	array	$urlparams	An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return	JController	This object to support chaining.
	 * @since	1.5
	 */
	public function display($cachable = false, $urlparams = false)
	{
		// Get the current URI to redirect to.
		$uri		= JURI::getInstance();
		$redirect	= base64_encode($uri);

		// Get the document object.
		$document	= JFactory::getDocument();

		/*
		// Set the default view name and format from the Request.
		if (file_exists(JPATH_CONFIGURATION.'/configuration.php') && (filesize(JPATH_CONFIGURATION.'/configuration.php') > 10) && file_exists(JPATH_INSTALLATION.'/index.php')) {
			$default_view	= 'remove';
		} else {
			$default_view	= 'language';
		}
		*/
		if (!file_exists(JPATH_CONFIGURATION.'/configuration.php')) 
		{
			$default_view = 'noconfig';
		}
		else 
		{
			require_once(JPATH_CONFIGURATION.'/configuration.php');

			if (!class_exists('JConfig'))
			{
				$default_view = 'invalidconfig';
			}
			else
			{
				$CONFIG = new JConfig();

				if (count(get_object_vars($CONFIG)) > 1)
				{
					$default_view = 'hasconfig';
				}
				else
				{
					$default_view = 'language';
				}
			}
		}

		$model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));

		$options = $model->getOptions();

		$vName = JRequest::getWord('view', $default_view);

		if (empty($options['installkey']) || ($options['installkey'] != $CONFIG->installkey))
		{
			if (!in_array($vName,array('installkey','language','hasconfig','noconfig','invalidconfig')))
			{
				$vName = "installkey";
				JRequest::setVar('view', 'installkey');
			}
		}

		$vFormat	= $document->getType();
		$lName		= JRequest::getWord('layout', 'default');

		if (strcmp($vName, $default_view) == 0) {
			JRequest::setVar('view', $default_view);
		}

		if ($view = $this->getView($vName, $vFormat)) {

			switch ($vName) {
				default:
					$model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
					break;
			}<commit_msg>[J25] more just do simple error handling for missing/invalid configuration file<commit_after><?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
 */

defined('_JEXEC') or die;

jimport('joomla.application.component.helper');

/**
 * Base controller class for the Joomla Core Installer.
 *
 * @package		Joomla.Installation
 * @since		1.6
 */
class JInstallationController extends JControllerLegacy
{
	/**
	 * Method to display a view.
	 *
	 * @param	boolean	$cachable	If true, the view output will be cached
	 * @param	array	$urlparams	An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return	JController	This object to support chaining.
	 * @since	1.5
	 */
	public function display($cachable = false, $urlparams = false)
	{
		// Get the current URI to redirect to.
		$uri		= JURI::getInstance();
		$redirect	= base64_encode($uri);

		// Get the document object.
		$document	= JFactory::getDocument();

		/*
		// Set the default view name and format from the Request.
		if (file_exists(JPATH_CONFIGURATION.'/configuration.php') && (filesize(JPATH_CONFIGURATION.'/configuration.php') > 10) && file_exists(JPATH_INSTALLATION.'/index.php')) {
			$default_view	= 'remove';
		} else  {
			$default_view	= 'language';
		}
		*/
		$default_view   = 'language';

		$model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));

		$options = $model->getOptions();

		$vName = JRequest::getWord('view', $default_view);
		
		$CONFIG = new JConfig();

		if (empty($options['installkey']) || ($options['installkey'] != $CONFIG->installkey))
		{
			if ($vName != 'language')
			{
				$vName = "installkey";
				JRequest::setVar('view', 'installkey');
			}
		}

		$vFormat	= $document->getType();
		$lName		= JRequest::getWord('layout', 'default');

		if (strcmp($vName, $default_view) == 0) {
			JRequest::setVar('view', $default_view);
		}

		if ($view = $this->getView($vName, $vFormat)) {

			switch ($vName) {
				default:
					$model = $this->getModel('Setup', 'JInstallationModel', array('dbo' => null));
					break;
			}
{'fraction_non_alphanumeric': 0.15804538949090166, 'fraction_numerical': 0.00797382948272337, 'mean_word_length': 3.857994041708044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4482925', 'n_tokens_mistral': 1839, 'n_tokens_neox': 1601, 'n_words': 392}