Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/com_config.tar

access.xml000064400000000337151165335150006537 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<access component="com_config">
	<section name="component">
		<action name="core.admin" title="JACTION_ADMIN"
description="JACTION_ADMIN_COMPONENT_DESC" />
	</section>
</access>
config.php000064400000001262151165335150006530 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Load classes
JLoader::registerPrefix('Config', JPATH_COMPONENT);

// Application
$app = JFactory::getApplication();

// Tell the browser not to cache this page.
$app->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00
GMT', true);

$controllerHelper = new ConfigControllerHelper;
$controller = $controllerHelper->parseController($app);

$controller->prefix = 'Config';

// Perform the Request task
$controller->execute();
config.xml000064400000001762151165335150006546 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1"
method="upgrade">
	<name>com_config</name>
	<author>Joomla! Project</author>
	<creationDate>April 2006</creationDate>
	<copyright>(C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
	<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
	<authorEmail>admin@joomla.org</authorEmail>
	<authorUrl>www.joomla.org</authorUrl>
	<version>3.0.0</version>
	<description>COM_CONFIG_XML_DESCRIPTION</description>
	<administration>
		<files folder="admin">
			<filename>config.php</filename>
			<filename>controller.php</filename>
			<folder>controllers</folder>
			<folder>models</folder>
			<folder>controller</folder>
			<folder>model</folder>
			<folder>view</folder>
		</files>
		<languages folder="admin">
			<language
tag="en-GB">language/en-GB.com_config.ini</language>
			<language
tag="en-GB">language/en-GB.com_config.sys.ini</language>
		</languages>
	</administration>
</extension>
controller/application/cancel.php000064400000001640151165335150013176
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Cancel Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerApplicationCancel extends ConfigControllerCanceladmin
{
	/**
	 * Method to cancel global configuration.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin',
'com_config'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
			$this->app->redirect('index.php');
		}

		$this->context = 'com_config.config.global';

		$this->redirect = 'index.php?option=com_cpanel';

		parent::execute();
	}
}
controller/application/display.php000064400000001063151165335150013415
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Base Display Controller
 *
 * @since  3.2
 * @note   Needed for front end view
 */
class ConfigControllerApplicationDisplay extends ConfigControllerDisplay
{
	/**
	 * Prefix for the view and model classes
	 *
	 * @var    string
	 * @since  3.2
	 */
	public $prefix = 'Config';
}
controller/application/removeroot.php000064400000003223151165335150014151
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;

/**
 * Remove Root Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerApplicationRemoveroot extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Method to remove root in global configuration.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken('get'))
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
			$this->app->redirect('index.php');
		}

		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
			$this->app->redirect('index.php');
		}

		// Initialise model.
		$model = new ConfigModelApplication;

		// Attempt to save the configuration and remove root.
		try
		{
			$model->removeroot();
		}
		catch (RuntimeException $e)
		{
			// Save failed, go back to the screen and display a notice.
			$this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED',
$e->getMessage()), 'error');
			$this->app->redirect(JRoute::_('index.php', false));
		}

		// Set the redirect based on the task.
		$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
		$this->app->redirect(JRoute::_('index.php', false));
	}
}
controller/application/save.php000064400000006530151165335150012712
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;

/**
 * Save Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerApplicationSave extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Method to save global configuration.
	 *
	 * @return  mixed  Calls $app->redirect() for all cases except JSON
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'),
'error');
			$this->app->redirect('index.php');
		}

		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->app->redirect('index.php');
		}

		// Clear the data from the session.
		$this->app->setUserState('com_config.config.global.data',
null);

		// Set FTP credentials, if given.
		JClientHelper::setCredentialsFromRequest('ftp');

		$model = new ConfigModelApplication;
		$data  = $this->input->post->get('jform', array(),
'array');

		// Complete data array if needed
		$oldData = $model->getData();

		$data = array_replace($oldData, $data);

		// Get request type
		$saveFormat = JFactory::getDocument()->getType();

		// Handle service requests
		if ($saveFormat == 'json')
		{
			$form = $model->getForm();
			$return = $model->validate($form, $data);

			if ($return === false)
			{
				$this->app->setHeader('Status', 422, true);

				return false;
			}

			return $model->save($return);
		}

		// Must load after serving service-requests
		$form = $model->getForm();

		// Validate the posted data.
		$return = $model->validate($form, $data);

		// Check for validation errors.
		if ($return === false)
		{
			/*
			 * The validate method enqueued all messages for us, so we just need to
redirect back.
			 */

			// Save the posted data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Redirect back to the edit screen.
			$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application',
false));
		}

		// Attempt to save the configuration.
		$data   = $return;
		$return = $model->save($data);

		// Check the return value.
		if ($return === false)
		{
			/*
			 * The save method enqueued all messages for us, so we just need to
redirect back.
			 */

			// Save the validated data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Save failed, go back to the screen and display a notice.
			$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.application',
false));
		}

		// Set the success message.
		$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'),
'message');

		// Set the redirect based on the task.
		switch ($this->options[3])
		{
			case 'apply':
				$this->app->redirect(JRoute::_('index.php?option=com_config',
false));
				break;

			case 'save':
			default:
				$this->app->redirect(JRoute::_('index.php', false));
				break;
		}
	}
}
controller/application/sendtestmail.php000064400000002425151165335150014447
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;

/**
 * Send Test Mail Controller from global configuration
 *
 * @since  3.5
 */
class ConfigControllerApplicationSendtestmail extends JControllerBase
{
	/**
	 * Method to send the test mail.
	 *
	 * @return  string
	 *
	 * @since   3.5
	 */
	public function execute()
	{
		// Send json mime type.
		$this->app->mimeType = 'application/json';
		$this->app->setHeader('Content-Type',
$this->app->mimeType . '; charset=' .
$this->app->charSet);
		$this->app->sendHeaders();

		// Check if user token is valid.
		if (!JSession::checkToken('get'))
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'),
'error');
			echo new JResponseJson;
			$this->app->close();
		}

		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			echo new JResponseJson;
			$this->app->close();
		}

		$model = new ConfigModelApplication;
		echo new JResponseJson($model->sendTestMail());
		$this->app->close();
	}
}
controller/application/store.php000064400000002221151165335150013101
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */
defined('_JEXEC') or die;

/**
 * Controller for global configuration, Store Permissions in Database
 *
 * @since  3.5
 */
class ConfigControllerApplicationStore extends JControllerBase
{
	/**
	 * Method to GET permission value and give it to the model for storing in
the database.
	 *
	 * @return  boolean  true on success, false when failed
	 *
	 * @since   3.5
	 */
	public function execute()
	{
		// Send json mime type.
		$this->app->mimeType = 'application/json';
		$this->app->setHeader('Content-Type',
$this->app->mimeType . '; charset=' .
$this->app->charSet);
		$this->app->sendHeaders();

		// Check if user token is valid.
		if (!JSession::checkToken('get'))
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'),
'error');
			echo new JResponseJson;
			$this->app->close();
		}

		$model = new ConfigModelApplication;
		echo new JResponseJson($model->storePermissions());
		$this->app->close();
	}
}
controller/component/cancel.php000064400000001371151165335150012676
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Cancel Controller for global configuration components
 *
 * @since  3.2
 */
class ConfigControllerComponentCancel extends ConfigControllerCanceladmin
{
	/**
	 * Method to cancel global configuration component.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		$this->context = 'com_config.config.global';

		$this->component = $this->input->get('component');

		$this->redirect = 'index.php?option=' . $this->component;

		parent::execute();
	}
}
controller/component/display.php000064400000001061151165335150013112
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Base Display Controller
 *
 * @since  3.2
 * @note   Needed for front end view
 */
class ConfigControllerComponentDisplay extends ConfigControllerDisplay
{
	/**
	 * Prefix for the view and model classes
	 *
	 * @var    string
	 * @since  3.2
	 */
	public $prefix = 'Config';
}
controller/component/save.php000064400000007725151165335150012420
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Save Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerComponentSave extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Method to save global configuration.
	 *
	 * @return  mixed  Calls $app->redirect()
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'),
'error');
			$this->app->redirect('index.php');
		}

		// Set FTP credentials, if given.
		JClientHelper::setCredentialsFromRequest('ftp');

		$model  = new ConfigModelComponent;
		$form   = $model->getForm();
		$data   = $this->input->get('jform', array(),
'array');
		$id     = $this->input->getInt('id');
		$option = $this->input->get('component');
		$user   = JFactory::getUser();

		// Make sure com_joomlaupdate and com_privacy can only be accessed by
SuperUser
		if (in_array(strtolower($option), array('com_joomlaupdate',
'com_privacy'))
			&& !JFactory::getUser()->authorise('core.admin'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');

			return;
		}

		// Check if the user is authorised to do this.
		if (!$user->authorise('core.admin', $option) &&
!$user->authorise('core.options', $option))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->app->redirect('index.php');
		}

		// Remove the permissions rules data if user isn't allowed to edit
them.
		if (!$user->authorise('core.admin', $option) &&
isset($data['params']) &&
isset($data['params']['rules']))
		{
			unset($data['params']['rules']);
		}

		$returnUri = $this->input->post->get('return', null,
'base64');

		$redirect = '';

		if (!empty($returnUri))
		{
			$redirect = '&return=' . urlencode($returnUri);
		}

		// Validate the posted data.
		$return = $model->validate($form, $data);

		// Check for validation errors.
		if ($return === false)
		{
			/*
			 * The validate method enqueued all messages for us, so we just need to
redirect back.
			 */

			// Save the data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Redirect back to the edit screen.
			$this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component='
. $option . $redirect, false));
		}

		// Attempt to save the configuration.
		$data = array(
			'params' => $return,
			'id'     => $id,
			'option' => $option
		);

		try
		{
			$model->save($data);
		}
		catch (RuntimeException $e)
		{
			// Save the data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Save failed, go back to the screen and display a notice.
			$this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED',
$e->getMessage()), 'error');
			$this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component='
. $option . $redirect, false));
		}

		// Set the redirect based on the task.
		switch ($this->options[3])
		{
			case 'apply':
				$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'),
'message');
				$this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component='
. $option . $redirect, false));

				break;

			case 'save':
				$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'),
'message');
			default:
				$redirect = 'index.php?option=' . $option;

				if (!empty($returnUri))
				{
					$redirect = base64_decode($returnUri);
				}

				// Don't redirect to an external URL.
				if (!JUri::isInternal($redirect))
				{
					$redirect = JUri::base();
				}

				$this->app->redirect(JRoute::_($redirect, false));

				break;
		}

		return true;
	}
}
controller.php000064400000002375151165335150007454 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Config Component Controller
 *
 * @since  1.5
 */
class ConfigController extends JControllerLegacy
{
	/**
	 * @var    string  The default view.
	 * @since  1.6
	 */
	protected $default_view = 'application';

	/**
	 * Method to display the 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  ConfigController  This object to support chaining.
	 *
	 * @since   1.5
	 */
	public function display($cachable = false, $urlparams = array())
	{
		// Set the default view name and format from the Request.
		$vName = $this->input->get('view',
'application');

		if (ucfirst($vName) == 'Application')
		{
			$controller = new ConfigControllerApplicationDisplay;
		}
		elseif (ucfirst($vName) == 'Component')
		{
			$controller = new ConfigControllerComponentDisplay;
		}

		return $controller->execute();
	}
}
controllers/application.php000064400000004626151165335150012143
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Controller for global configuration
 *
 * @since       1.5
 * @deprecated  4.0
 */
class ConfigControllerApplication extends JControllerLegacy
{
	/**
	 * Class Constructor
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @since   1.5
	 * @deprecated  4.0
	 */
	public function __construct($config = array())
	{
		parent::__construct($config);

		// Map the apply task to the save method.
		$this->registerTask('apply', 'save');
	}

	/**
	 * Method to save the configuration.
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since   1.5
	 * @deprecated  4.0  Use ConfigControllerApplicationSave instead.
	 */
	public function save()
	{
		try
		{
			JLog::add(
				sprintf('%s() is deprecated. Use ConfigControllerApplicationSave
instead.', __METHOD__),
				JLog::WARNING,
				'deprecated'
			);
		}
		catch (RuntimeException $exception)
		{
			// Informational log only
		}

		$controller = new ConfigControllerApplicationSave;

		return $controller->execute();
	}

	/**
	 * Cancel operation.
	 *
	 * @return  boolean  True if successful; false otherwise.
	 *
	 * @deprecated  4.0  Use ConfigControllerApplicationCancel instead.
	 */
	public function cancel()
	{
		try
		{
			JLog::add(
				sprintf('%s() is deprecated. Use ConfigControllerApplicationCancel
instead.', __METHOD__),
				JLog::WARNING,
				'deprecated'
			);
		}
		catch (RuntimeException $exception)
		{
			// Informational log only
		}

		$controller = new ConfigControllerApplicationCancel;

		return $controller->execute();
	}

	/**
	 * Method to remove the root property from the configuration.
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since   1.5
	 * @deprecated  4.0  Use ConfigControllerApplicationRemoveroot instead.
	 */
	public function removeroot()
	{
		try
		{
			JLog::add(
				sprintf('%s() is deprecated. Use
ConfigControllerApplicationRemoveroot instead.', __METHOD__),
				JLog::WARNING,
				'deprecated'
			);
		}
		catch (RuntimeException $exception)
		{
			// Informational log only
		}

		$controller = new ConfigControllerApplicationRemoveroot;

		return $controller->execute();
	}
}
controllers/component.php000064400000003411151165335150011631
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Note: this view is intended only to be opened in a popup
 *
 * @since       1.5
 * @deprecated  4.0
 */
class ConfigControllerComponent extends JControllerLegacy
{
	/**
	 * Class Constructor
	 *
	 * @param   array  $config  An optional associative array of configuration
settings.
	 *
	 * @since   1.5
	 * @deprecated  4.0
	 */
	public function __construct($config = array())
	{
		parent::__construct($config);

		// Map the apply task to the save method.
		$this->registerTask('apply', 'save');
	}

	/**
	 * Cancel operation
	 *
	 * @return  void
	 *
	 * @since   3.0
	 * @deprecated  4.0  Use ConfigControllerComponentCancel instead.
	 */
	public function cancel()
	{
		try
		{
			JLog::add(
				sprintf('%s() is deprecated. Use ConfigControllerComponentCancel
instead.', __METHOD__),
				JLog::WARNING,
				'deprecated'
			);
		}
		catch (RuntimeException $exception)
		{
			// Informational log only
		}

		$controller = new ConfigControllerComponentCancel;

		$controller->execute();
	}

	/**
	 * Save the configuration.
	 *
	 * @return  boolean  True if successful; false otherwise.
	 *
	 * @deprecated  4.0  Use ConfigControllerComponentSave instead.
	 */
	public function save()
	{
		try
		{
			JLog::add(
				sprintf('%s() is deprecated. Use ConfigControllerComponentSave
instead.', __METHOD__),
				JLog::WARNING,
				'deprecated'
			);
		}
		catch (RuntimeException $exception)
		{
			// Informational log only
		}

		$controller = new ConfigControllerComponentSave;

		return $controller->execute();
	}
}
helper/config.php000064400000005654151165335150010020 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Components helper for com_config
 *
 * @since  3.0
 */
class ConfigHelperConfig extends JHelperContent
{
	/**
	 * Get an array of all enabled components.
	 *
	 * @return  array
	 *
	 * @since   3.0
	 */
	public static function getAllComponents()
	{
		$db = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('element')
			->from('#__extensions')
			->where('type = ' . $db->quote('component'))
			->where('enabled = 1');
		$db->setQuery($query);
		$result = $db->loadColumn();

		return $result;
	}

	/**
	 * Returns true if the component has configuration options.
	 *
	 * @param   string  $component  Component name
	 *
	 * @return  boolean
	 *
	 * @since   3.0
	 */
	public static function hasComponentConfig($component)
	{
		return is_file(JPATH_ADMINISTRATOR . '/components/' .
$component . '/config.xml');
	}

	/**
	 * Returns an array of all components with configuration options.
	 * Optionally return only those components for which the current user has
'core.manage' rights.
	 *
	 * @param   boolean  $authCheck  True to restrict to components where
current user has 'core.manage' rights.
	 *
	 * @return  array
	 *
	 * @since   3.0
	 */
	public static function getComponentsWithConfig($authCheck = true)
	{
		$result = array();
		$components = self::getAllComponents();
		$user = JFactory::getUser();

		// Remove com_config from the array as that may have weird side effects
		$components = array_diff($components, array('com_config'));

		foreach ($components as $component)
		{
			if (self::hasComponentConfig($component) && (!$authCheck ||
$user->authorise('core.manage', $component)))
			{
				self::loadLanguageForComponent($component);
				$result[$component] =
JApplicationHelper::stringURLSafe(JText::_($component)) . '_' .
$component;
			}
		}

		asort($result);

		return array_keys($result);
	}

	/**
	 * Load the sys language for the given component.
	 *
	 * @param   array  $components  Array of component names.
	 *
	 * @return  void
	 *
	 * @since   3.0
	 */
	public static function loadLanguageForComponents($components)
	{
		foreach ($components as $component)
		{
			self::loadLanguageForComponent($component);
		}
	}

	/**
	 * Load the sys language for the given component.
	 *
	 * @param   string  $component  component name.
	 *
	 * @return  void
	 *
	 * @since   3.5
	 */
	public static function loadLanguageForComponent($component)
	{
		if (empty($component))
		{
			return;
		}

		$lang = JFactory::getLanguage();

		// Load the core file then
		// Load extension-local file.
		$lang->load($component . '.sys', JPATH_BASE, null, false,
true)
		|| $lang->load($component . '.sys', JPATH_ADMINISTRATOR .
'/components/' . $component, null, false, true);
	}
}
model/application.php000064400000070613151165335160010675 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

/**
 * Model for the global configuration
 *
 * @since  3.2
 */
class ConfigModelApplication extends ConfigModelForm
{
	/**
	 * Array of protected password fields from the configuration.php
	 *
	 * @var    array
	 * @since  3.9.23
	 */
	private $protectedConfigurationFields = array('password',
'secret', 'ftp_pass', 'smtppass',
'redis_server_auth', 'session_redis_server_auth');

	/**
	 * Method to get a form object.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  mixed  A JForm object on success, false on failure
	 *
	 * @since	1.6
	 */
	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_config.application',
'application', array('control' => 'jform',
'load_data' => $loadData));

		if (empty($form))
		{
			return false;
		}

		return $form;
	}

	/**
	 * Method to get the configuration data.
	 *
	 * This method will load the global configuration data straight from
	 * JConfig. If configuration data has been saved in the session, that
	 * data will be merged into the original data, overwriting it.
	 *
	 * @return	array  An array containing all global config data.
	 *
	 * @since	1.6
	 */
	public function getData()
	{
		// Get the config data.
		$config = new JConfig;
		$data   = ArrayHelper::fromObject($config);

		// Get the correct driver at runtime
		$data['dbtype'] = JFactory::getDbo()->getName();

		// Prime the asset_id for the rules.
		$data['asset_id'] = 1;

		// Get the text filter data
		$params          = JComponentHelper::getParams('com_config');
		$data['filters'] =
ArrayHelper::fromObject($params->get('filters'));

		// If no filter data found, get from com_content (update of 1.6/1.7 site)
		if (empty($data['filters']))
		{
			$contentParams = JComponentHelper::getParams('com_content');
			$data['filters'] =
ArrayHelper::fromObject($contentParams->get('filters'));
		}

		// Check for data in the session.
		$temp =
JFactory::getApplication()->getUserState('com_config.config.global.data');

		// Merge in the session data.
		if (!empty($temp))
		{
			$data = array_merge($data, $temp);
		}

		return $data;
	}

	/**
	 * Method to save the configuration data.
	 *
	 * @param   array  $data  An array containing all global config data.
	 *
	 * @return	boolean  True on success, false on failure.
	 *
	 * @since	1.6
	 */
	public function save($data)
	{
		$app = JFactory::getApplication();
		$dispatcher = JEventDispatcher::getInstance();
		$config = JFactory::getConfig();

		// Try to load the values from the configuration file
		foreach ($this->protectedConfigurationFields as $fieldKey)
		{
			if (!isset($data[$fieldKey]))
			{
				$data[$fieldKey] = $config->get($fieldKey);
			}
		}

		// Check that we aren't setting wrong database configuration
		$options = array(
			'driver'   => $data['dbtype'],
			'host'     => $data['host'],
			'user'     => $data['user'],
			'password' => $data['password'],
			'database' => $data['db'],
			'prefix'   => $data['dbprefix']
		);

		try
		{
			JDatabaseDriver::getInstance($options)->getVersion();
		}
		catch (Exception $e)
		{
			$app->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_DATABASE_CONNECT'),
'error');

			return false;
		}

		// Check if we can set the Force SSL option
		if ((int) $data['force_ssl'] !== 0 && (int)
$data['force_ssl'] !== (int)
JFactory::getConfig()->get('force_ssl', '0'))
		{
			try
			{
				// Make an HTTPS request to check if the site is available in HTTPS.
				$host    = JUri::getInstance()->getHost();
				$options = new \Joomla\Registry\Registry;
				$options->set('userAgent', 'Mozilla/5.0 (Windows NT
6.1; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0');

				// Do not check for valid server certificate here, leave this to the
user, moreover disable using a proxy if any is configured.
				$options->set('transport.curl',
					array(
						CURLOPT_SSL_VERIFYPEER => false,
						CURLOPT_SSL_VERIFYHOST => false,
						CURLOPT_PROXY => null,
						CURLOPT_PROXYUSERPWD => null,
					)
				);
				$response =
JHttpFactory::getHttp($options)->get('https://' . $host .
JUri::root(true) . '/', array('Host' => $host), 10);

				// If available in HTTPS check also the status code.
				if (!in_array($response->code, array(200, 503, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 401), true))
				{
					throw new
RuntimeException(JText::_('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE_HTTP_CODE'));
				}
			}
			catch (RuntimeException $e)
			{
				$data['force_ssl'] = 0;

				// Also update the user state
				$app->setUserState('com_config.config.global.data.force_ssl',
0);

				// Inform the user
				$app->enqueueMessage(JText::sprintf('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE',
$e->getMessage()), 'warning');
			}
		}

		// Save the rules
		if (isset($data['rules']))
		{
			$rules = new JAccessRules($data['rules']);

			// Check that we aren't removing our Super User permission
			// Need to get groups from database, since they might have changed
			$myGroups      =
JAccess::getGroupsByUser(JFactory::getUser()->get('id'));
			$myRules       = $rules->getData();
			$hasSuperAdmin = $myRules['core.admin']->allow($myGroups);

			if (!$hasSuperAdmin)
			{
				$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN'),
'error');

				return false;
			}

			$asset = JTable::getInstance('asset');

			if ($asset->loadByName('root.1'))
			{
				$asset->rules = (string) $rules;

				if (!$asset->check() || !$asset->store())
				{
					$app->enqueueMessage($asset->getError(), 'error');

					return;
				}
			}
			else
			{
				$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND'),
'error');

				return false;
			}

			unset($data['rules']);
		}

		// Save the text filters
		if (isset($data['filters']))
		{
			$registry = new Registry(array('filters' =>
$data['filters']));

			$extension = JTable::getInstance('extension');

			// Get extension_id
			$extensionId = $extension->find(array('name' =>
'com_config'));

			if ($extension->load((int) $extensionId))
			{
				$extension->params = (string) $registry;

				if (!$extension->check() || !$extension->store())
				{
					$app->enqueueMessage($extension->getError(), 'error');

					return;
				}
			}
			else
			{
				$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIG_EXTENSION_NOT_FOUND'),
'error');

				return false;
			}

			unset($data['filters']);
		}

		// Get the previous configuration.
		$prev = new JConfig;
		$prev = ArrayHelper::fromObject($prev);

		// Merge the new data in. We do this to preserve values that were not in
the form.
		$data = array_merge($prev, $data);

		/*
		 * Perform miscellaneous options based on configuration settings/changes.
		 */

		// Escape the offline message if present.
		if (isset($data['offline_message']))
		{
			$data['offline_message'] =
JFilterOutput::ampReplace($data['offline_message']);
		}

		// Purge the database session table if we are changing to the database
handler.
		if ($prev['session_handler'] != 'database' &&
$data['session_handler'] == 'database')
		{
			$table = JTable::getInstance('session');
			$table->purge(-1);
		}

		// Set the shared session configuration
		if (isset($data['shared_session']))
		{
			$currentShared = isset($prev['shared_session']) ?
$prev['shared_session'] : '0';

			// Has the user enabled shared sessions?
			if ($data['shared_session'] == 1 && $currentShared ==
0)
			{
				// Generate a random shared session name
				$data['session_name'] = JUserHelper::genRandomPassword(16);
			}

			// Has the user disabled shared sessions?
			if ($data['shared_session'] == 0 && $currentShared ==
1)
			{
				// Remove the session name value
				unset($data['session_name']);
			}
		}

		if (empty($data['cache_handler']))
		{
			$data['caching'] = 0;
		}

		/*
		 * Look for a custom cache_path
		 * First check if a path is given in the submitted data, then check if a
path exists in the previous data, otherwise use the default
		 */
		if (!empty($data['cache_path']))
		{
			$path = $data['cache_path'];
		}
		elseif (!empty($prev['cache_path']))
		{
			$path = $prev['cache_path'];
		}
		else
		{
			$path = JPATH_SITE . '/cache';
		}

		// Give a warning if the cache-folder can not be opened
		if ($data['caching'] > 0 &&
$data['cache_handler'] == 'file' &&
@opendir($path) == false)
		{
			$error = true;

			// If a custom path is in use, try using the system default instead of
disabling cache
			if ($path !== JPATH_SITE . '/cache' &&
@opendir(JPATH_SITE . '/cache') != false)
			{
				try
				{
					JLog::add(
						JText::sprintf('COM_CONFIG_ERROR_CUSTOM_CACHE_PATH_NOTWRITABLE_USING_DEFAULT',
$path, JPATH_SITE . '/cache'),
						JLog::WARNING,
						'jerror'
					);
				}
				catch (RuntimeException $logException)
				{
					$app->enqueueMessage(
						JText::sprintf('COM_CONFIG_ERROR_CUSTOM_CACHE_PATH_NOTWRITABLE_USING_DEFAULT',
$path, JPATH_SITE . '/cache'),
						'warning'
					);
				}

				$path  = JPATH_SITE . '/cache';
				$error = false;

				$data['cache_path'] = '';
			}

			if ($error)
			{
				try
				{
					JLog::add(JText::sprintf('COM_CONFIG_ERROR_CACHE_PATH_NOTWRITABLE',
$path), JLog::WARNING, 'jerror');
				}
				catch (RuntimeException $exception)
				{
					$app->enqueueMessage(JText::sprintf('COM_CONFIG_ERROR_CACHE_PATH_NOTWRITABLE',
$path), 'warning');
				}

				$data['caching'] = 0;
			}
		}

		// Did the user remove their custom cache path?  Don't save the
variable to the config
		if (empty($data['cache_path']))
		{
			unset($data['cache_path']);
		}

		// Clean the cache if disabled but previously enabled or changing cache
handlers; these operations use the `$prev` data already in memory
		if ((!$data['caching'] && $prev['caching'])
|| $data['cache_handler'] !== $prev['cache_handler'])
		{
			try
			{
				JFactory::getCache()->clean();
			}
			catch (JCacheExceptionConnecting $exception)
			{
				try
				{
					JLog::add(JText::_('COM_CONFIG_ERROR_CACHE_CONNECTION_FAILED'),
JLog::WARNING, 'jerror');
				}
				catch (RuntimeException $logException)
				{
					$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CACHE_CONNECTION_FAILED'),
'warning');
				}
			}
			catch (JCacheExceptionUnsupported $exception)
			{
				try
				{
					JLog::add(JText::_('COM_CONFIG_ERROR_CACHE_DRIVER_UNSUPPORTED'),
JLog::WARNING, 'jerror');
				}
				catch (RuntimeException $logException)
				{
					$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CACHE_DRIVER_UNSUPPORTED'),
'warning');
				}
			}
		}

		// Create the new configuration object.
		$config = new Registry($data);

		// Overwrite the old FTP credentials with the new ones.
		$temp = JFactory::getConfig();
		$temp->set('ftp_enable', $data['ftp_enable']);
		$temp->set('ftp_host', $data['ftp_host']);
		$temp->set('ftp_port', $data['ftp_port']);
		$temp->set('ftp_user', $data['ftp_user']);
		$temp->set('ftp_pass', $data['ftp_pass']);
		$temp->set('ftp_root', $data['ftp_root']);

		// Clear cache of com_config component.
		$this->cleanCache('_system', 0);
		$this->cleanCache('_system', 1);

		$result = $dispatcher->trigger('onApplicationBeforeSave',
array($config));

		// Store the data.
		if (in_array(false, $result, true))
		{
			throw new
RuntimeException(JText::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING'));
		}

		// Write the configuration file.
		$result = $this->writeConfigFile($config);

		// Trigger the after save event.
		$dispatcher->trigger('onApplicationAfterSave',
array($config));

		return $result;
	}

	/**
	 * Method to unset the root_user value from configuration data.
	 *
	 * This method will load the global configuration data straight from
	 * JConfig and remove the root_user value for security, then save the
configuration.
	 *
	 * @return	boolean  True on success, false on failure.
	 *
	 * @since	1.6
	 */
	public function removeroot()
	{
		$dispatcher = JEventDispatcher::getInstance();

		// Get the previous configuration.
		$prev = new JConfig;
		$prev = ArrayHelper::fromObject($prev);

		// Create the new configuration object, and unset the root_user property
		unset($prev['root_user']);
		$config = new Registry($prev);

		$result = $dispatcher->trigger('onApplicationBeforeSave',
array($config));

		// Store the data.
		if (in_array(false, $result, true))
		{
			throw new
RuntimeException(JText::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING'));
		}

		// Write the configuration file.
		$result = $this->writeConfigFile($config);

		// Trigger the after save event.
		$dispatcher->trigger('onApplicationAfterSave',
array($config));

		return $result;
	}

	/**
	 * Method to write the configuration to a file.
	 *
	 * @param   Registry  $config  A Registry object containing all global
config data.
	 *
	 * @return	boolean  True on success, false on failure.
	 *
	 * @since	2.5.4
	 * @throws  RuntimeException
	 */
	private function writeConfigFile(Registry $config)
	{
		jimport('joomla.filesystem.path');
		jimport('joomla.filesystem.file');

		// Set the configuration file path.
		$file = JPATH_CONFIGURATION . '/configuration.php';

		// Get the new FTP credentials.
		$ftp = JClientHelper::getCredentials('ftp', true);

		$app = JFactory::getApplication();

		// Attempt to make the file writeable if using FTP.
		if (!$ftp['enabled'] && JPath::isOwner($file)
&& !JPath::setPermissions($file, '0644'))
		{
			$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'),
'notice');
		}

		// Attempt to write the configuration file as a PHP class named JConfig.
		$configuration = $config->toString('PHP',
array('class' => 'JConfig', 'closingtag'
=> false));

		if (!JFile::write($file, $configuration))
		{
			throw new
RuntimeException(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'));
		}

		// Invalidates the cached configuration file
		if (function_exists('opcache_invalidate'))
		{
			opcache_invalidate($file);
		}

		// Attempt to make the file unwriteable if NOT using FTP.
		if (!$ftp['enabled'] && JPath::isOwner($file)
&& !JPath::setPermissions($file, '0444'))
		{
			$app->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'),
'notice');
		}

		return true;
	}

	/**
	 * Method to store the permission values in the asset table.
	 *
	 * This method will get an array with permission key value pairs and
transform it
	 * into json and update the asset table in the database.
	 *
	 * @param   string  $permission  Need an array with Permissions
(component, rule, value and title)
	 *
	 * @return  array  A list of result data.
	 *
	 * @since   3.5
	 */
	public function storePermissions($permission = null)
	{
		$app  = JFactory::getApplication();
		$user = JFactory::getUser();

		if (is_null($permission))
		{
			// Get data from input.
			$permission = array(
				'component' => $app->input->get('comp'),
				'action'    => $app->input->get('action'),
				'rule'      => $app->input->get('rule'),
				'value'     => $app->input->get('value'),
				'title'     => $app->input->get('title',
'', 'RAW')
			);
		}

		// We are creating a new item so we don't have an item id so
don't allow.
		if (substr($permission['component'], -6) ===
'.false')
		{
			$app->enqueueMessage(JText::_('JLIB_RULES_SAVE_BEFORE_CHANGE_PERMISSIONS'),
'error');

			return false;
		}

		// Check if the user is authorized to do this.
		if (!$user->authorise('core.admin',
$permission['component']))
		{
			$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');

			return false;
		}

		$permission['component'] =
empty($permission['component']) ? 'root.1' :
$permission['component'];

		// Current view is global config?
		$isGlobalConfig = $permission['component'] ===
'root.1';

		// Check if changed group has Super User permissions.
		$isSuperUserGroupBefore =
JAccess::checkGroup($permission['rule'], 'core.admin');

		// Check if current user belongs to changed group.
		$currentUserBelongsToGroup = in_array((int)
$permission['rule'], $user->groups) ? true : false;

		// Get current user groups tree.
		$currentUserGroupsTree = JAccess::getGroupsByUser($user->id, true);

		// Check if current user belongs to changed group.
		$currentUserSuperUser = $user->authorise('core.admin');

		// If user is not Super User cannot change the permissions of a group it
belongs to.
		if (!$currentUserSuperUser && $currentUserBelongsToGroup)
		{
			$app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_OWN_GROUPS'),
'error');

			return false;
		}

		// If user is not Super User cannot change the permissions of a group it
belongs to.
		if (!$currentUserSuperUser && in_array((int)
$permission['rule'], $currentUserGroupsTree))
		{
			$app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_OWN_PARENT_GROUPS'),
'error');

			return false;
		}

		// If user is not Super User cannot change the permissions of a Super
User Group.
		if (!$currentUserSuperUser && $isSuperUserGroupBefore &&
!$currentUserBelongsToGroup)
		{
			$app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_SUPER_USER'),
'error');

			return false;
		}

		// If user is not Super User cannot change the Super User permissions in
any group it belongs to.
		if ($isSuperUserGroupBefore && $currentUserBelongsToGroup
&& $permission['action'] === 'core.admin')
		{
			$app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_DEMOTE_SELF'),
'error');

			return false;
		}

		try
		{
			$asset  = JTable::getInstance('asset');
			$result = $asset->loadByName($permission['component']);

			if ($result === false)
			{
				$data = array($permission['action'] =>
array($permission['rule'] => $permission['value']));

				$rules        = new JAccessRules($data);
				$asset->rules = (string) $rules;
				$asset->name  = (string) $permission['component'];
				$asset->title = (string) $permission['title'];

				// Get the parent asset id so we have a correct tree.
				$parentAsset = JTable::getInstance('Asset');

				if (strpos($asset->name, '.') !== false)
				{
					$assetParts = explode('.', $asset->name);
					$parentAsset->loadByName($assetParts[0]);
					$parentAssetId = $parentAsset->id;
				}
				else
				{
					$parentAssetId = $parentAsset->getRootId();
				}

				/**
				 * @to do: incorrect ACL stored
				 * When changing a permission of an item that doesn't have a row
in the asset table the row a new row is created.
				 * This works fine for item <-> component <-> global config
scenario and component <-> global config scenario.
				 * But doesn't work properly for item <-> section(s)
<-> component <-> global config scenario,
				 * because a wrong parent asset id (the component) is stored.
				 * Happens when there is no row in the asset table (ex: deleted or not
created on update).
				 */

				$asset->setLocation($parentAssetId, 'last-child');
			}
			else
			{
				// Decode the rule settings.
				$temp = json_decode($asset->rules, true);

				// Check if a new value is to be set.
				if (isset($permission['value']))
				{
					// Check if we already have an action entry.
					if (!isset($temp[$permission['action']]))
					{
						$temp[$permission['action']] = array();
					}

					// Check if we already have a rule entry.
					if
(!isset($temp[$permission['action']][$permission['rule']]))
					{
						$temp[$permission['action']][$permission['rule']]
= array();
					}

					// Set the new permission.
					$temp[$permission['action']][$permission['rule']]
= (int) $permission['value'];

					// Check if we have an inherited setting.
					if ($permission['value'] === '')
					{
						unset($temp[$permission['action']][$permission['rule']]);
					}

					// Check if we have any rules.
					if (!$temp[$permission['action']])
					{
						unset($temp[$permission['action']]);
					}
				}
				else
				{
					// There is no value so remove the action as it's not needed.
					unset($temp[$permission['action']]);
				}

				$asset->rules = json_encode($temp, JSON_FORCE_OBJECT);
			}

			if (!$asset->check() || !$asset->store())
			{
				$app->enqueueMessage(JText::_('JLIB_UNKNOWN'),
'error');

				return false;
			}
		}
		catch (Exception $e)
		{
			$app->enqueueMessage($e->getMessage(), 'error');

			return false;
		}

		// All checks done.
		$result = array(
			'text'    => '',
			'class'   => '',
			'result'  => true,
		);

		// Show the current effective calculated permission considering current
group, path and cascade.

		try
		{
			// Get the asset id by the name of the component.
			$query = $this->db->getQuery(true)
				->select($this->db->quoteName('id'))
				->from($this->db->quoteName('#__assets'))
				->where($this->db->quoteName('name') . ' =
' . $this->db->quote($permission['component']));

			$this->db->setQuery($query);

			$assetId = (int) $this->db->loadResult();

			// Fetch the parent asset id.
			$parentAssetId = null;

			/**
			 * @to do: incorrect info
			 * When creating a new item (not saving) it uses the calculated
permissions from the component (item <-> component <-> global
config).
			 * But if we have a section too (item <-> section(s) <->
component <-> global config) this is not correct.
			 * Also, currently it uses the component permission, but should use the
calculated permissions for achild of the component/section.
			 */

			// If not in global config we need the parent_id asset to calculate
permissions.
			if (!$isGlobalConfig)
			{
				// In this case we need to get the component rules too.
				$query->clear()
					->select($this->db->quoteName('parent_id'))
					->from($this->db->quoteName('#__assets'))
					->where($this->db->quoteName('id') . ' =
' . $assetId);

				$this->db->setQuery($query);

				$parentAssetId = (int) $this->db->loadResult();
			}

			// Get the group parent id of the current group.
			$query->clear()
				->select($this->db->quoteName('parent_id'))
				->from($this->db->quoteName('#__usergroups'))
				->where($this->db->quoteName('id') . ' = '
. (int) $permission['rule']);

			$this->db->setQuery($query);

			$parentGroupId = (int) $this->db->loadResult();

			// Count the number of child groups of the current group.
			$query->clear()
				->select('COUNT(' .
$this->db->quoteName('id') . ')')
				->from($this->db->quoteName('#__usergroups'))
				->where($this->db->quoteName('parent_id') . ' =
' . (int) $permission['rule']);

			$this->db->setQuery($query);

			$totalChildGroups = (int) $this->db->loadResult();
		}
		catch (Exception $e)
		{
			$app->enqueueMessage($e->getMessage(), 'error');

			return false;
		}

		// Clear access statistics.
		JAccess::clearStatics();

		// After current group permission is changed we need to check again if
the group has Super User permissions.
		$isSuperUserGroupAfter =
JAccess::checkGroup($permission['rule'], 'core.admin');

		// Get the rule for just this asset (non-recursive) and get the actual
setting for the action for this group.
		$assetRule = JAccess::getAssetRules($assetId, false,
false)->allow($permission['action'],
$permission['rule']);

		// Get the group, group parent id, and group global config recursive
calculated permission for the chosen action.
		$inheritedGroupRule = JAccess::checkGroup($permission['rule'],
$permission['action'], $assetId);

		if (!empty($parentAssetId))
		{
			$inheritedGroupParentAssetRule =
JAccess::checkGroup($permission['rule'],
$permission['action'], $parentAssetId);
		}
		else
		{
			$inheritedGroupParentAssetRule = null;
		}

		$inheritedParentGroupRule = !empty($parentGroupId) ?
JAccess::checkGroup($parentGroupId, $permission['action'],
$assetId) : null;

		// Current group is a Super User group, so calculated setting is
"Allowed (Super User)".
		if ($isSuperUserGroupAfter)
		{
			$result['class'] = 'label label-success';
			$result['text'] = '<span class="icon-lock
icon-white" aria-hidden="true"></span>' .
JText::_('JLIB_RULES_ALLOWED_ADMIN');
		}
		// Not super user.
		else
		{
			// First get the real recursive calculated setting and add (Inherited)
to it.

			// If recursive calculated setting is "Denied" or null.
Calculated permission is "Not Allowed (Inherited)".
			if ($inheritedGroupRule === null || $inheritedGroupRule === false)
			{
				$result['class'] = 'label label-important';
				$result['text']  =
JText::_('JLIB_RULES_NOT_ALLOWED_INHERITED');
			}
			// If recursive calculated setting is "Allowed". Calculated
permission is "Allowed (Inherited)".
			else
			{
				$result['class'] = 'label label-success';
				$result['text']  =
JText::_('JLIB_RULES_ALLOWED_INHERITED');
			}

			// Second part: Overwrite the calculated permissions labels if there is
an explicit permission in the current group.

			/**
			 * @todo: incorrect info
			 * If a component has a permission that doesn't exists in global
config (ex: frontend editing in com_modules) by default
			 * we get "Not Allowed (Inherited)" when we should get
"Not Allowed (Default)".
			 */

			// If there is an explicit permission "Not Allowed".
Calculated permission is "Not Allowed".
			if ($assetRule === false)
			{
				$result['class'] = 'label label-important';
				$result['text']  =
JText::_('JLIB_RULES_NOT_ALLOWED');
			}
			// If there is an explicit permission is "Allowed". Calculated
permission is "Allowed".
			elseif ($assetRule === true)
			{
				$result['class'] = 'label label-success';
				$result['text']  = JText::_('JLIB_RULES_ALLOWED');
			}

			// Third part: Overwrite the calculated permissions labels for special
cases.

			// Global configuration with "Not Set" permission. Calculated
permission is "Not Allowed (Default)".
			if (empty($parentGroupId) && $isGlobalConfig === true &&
$assetRule === null)
			{
				$result['class'] = 'label label-important';
				$result['text']  =
JText::_('JLIB_RULES_NOT_ALLOWED_DEFAULT');
			}

			/**
			 * Component/Item with explicit "Denied" permission at parent
Asset (Category, Component or Global config) configuration.
			 * Or some parent group has an explicit "Denied".
			 * Calculated permission is "Not Allowed (Locked)".
			 */
			elseif ($inheritedGroupParentAssetRule === false ||
$inheritedParentGroupRule === false)
			{
				$result['class'] = 'label label-important';
				$result['text']  = '<span class="icon-lock
icon-white" aria-hidden="true"></span>' .
JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED');
			}
		}

		// If removed or added super user from group, we need to refresh the page
to recalculate all settings.
		if ($isSuperUserGroupBefore != $isSuperUserGroupAfter)
		{
			$app->enqueueMessage(JText::_('JLIB_RULES_NOTICE_RECALCULATE_GROUP_PERMISSIONS'),
'notice');
		}

		// If this group has child groups, we need to refresh the page to
recalculate the child settings.
		if ($totalChildGroups > 0)
		{
			$app->enqueueMessage(JText::_('JLIB_RULES_NOTICE_RECALCULATE_GROUP_CHILDS_PERMISSIONS'),
'notice');
		}

		return $result;
	}

	/**
	 * Method to send a test mail which is called via an AJAX request
	 *
	 * @return boolean
	 *
	 * @since   3.5
	 * @throws Exception
	 */
	public function sendTestMail()
	{
		// Set the new values to test with the current settings
		$app      = JFactory::getApplication();
		$input    = $app->input;
		$smtppass = $input->get('smtppass', null, 'RAW');

		$app->set('smtpauth', $input->get('smtpauth'));
		$app->set('smtpuser', $input->get('smtpuser',
'', 'STRING'));
		$app->set('smtphost', $input->get('smtphost'));
		$app->set('smtpsecure',
$input->get('smtpsecure'));
		$app->set('smtpport', $input->get('smtpport'));
		$app->set('mailfrom', $input->get('mailfrom',
'', 'STRING'));
		$app->set('fromname', $input->get('fromname',
'', 'STRING'));
		$app->set('mailer', $input->get('mailer'));
		$app->set('mailonline',
$input->get('mailonline'));

		// Use smtppass only if it was submitted
		if ($smtppass !== null)
		{
			$app->set('smtppass', $smtppass);
		}

		$mail = JFactory::getMailer();

		// Prepare email and send try to send it
		$mailSubject = JText::sprintf('COM_CONFIG_SENDMAIL_SUBJECT',
$app->get('sitename'));
		$mailBody    = JText::sprintf('COM_CONFIG_SENDMAIL_BODY',
JText::_('COM_CONFIG_SENDMAIL_METHOD_' .
strtoupper($mail->Mailer)));

		if ($mail->sendMail($app->get('mailfrom'),
$app->get('fromname'), $app->get('mailfrom'),
$mailSubject, $mailBody) === true)
		{
			$methodName = JText::_('COM_CONFIG_SENDMAIL_METHOD_' .
strtoupper($mail->Mailer));

			// If JMail send the mail using PHP Mail as fallback.
			if ($mail->Mailer != $app->get('mailer'))
			{
				$app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS_FALLBACK',
$app->get('mailfrom'), $methodName), 'warning');
			}
			else
			{
				$app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS',
$app->get('mailfrom'), $methodName), 'message');
			}

			return true;
		}

		$app->enqueueMessage(JText::_('COM_CONFIG_SENDMAIL_ERROR'),
'error');

		return false;
	}
}
model/component.php000064400000012557151165335160010377 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Model for component configuration
 *
 * @since  3.2
 */
class ConfigModelComponent extends ConfigModelForm
{
	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return	void
	 *
	 * @since	3.2
	 */
	protected function populateState()
	{
		$input = JFactory::getApplication()->input;

		// Set the component (option) we are dealing with.
		$component = $input->get('component');
		$state = $this->loadState();
		$state->set('component.option', $component);

		// Set an alternative path for the configuration file.
		if ($path = $input->getString('path'))
		{
			$path = JPath::clean(JPATH_SITE . '/' . $path);
			JPath::check($path);
			$state->set('component.path', $path);
		}

		$this->setState($state);
	}

	/**
	 * Method to get a form object.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  mixed  A JForm object on success, false on failure
	 *
	 * @since	3.2
	 */
	public function getForm($data = array(), $loadData = true)
	{
		$state = $this->getState();
		$option = $state->get('component.option');

		if ($path = $state->get('component.path'))
		{
			// Add the search path for the admin component config.xml file.
			JForm::addFormPath($path);
		}
		else
		{
			// Add the search path for the admin component config.xml file.
			JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' .
$option);
		}

		// Get the form.
		$form = $this->loadForm(
			'com_config.component',
			'config',
			array('control' => 'jform', 'load_data'
=> $loadData),
			false,
			'/config'
		);

		if (empty($form))
		{
			return false;
		}

		$lang = JFactory::getLanguage();
		$lang->load($option, JPATH_BASE, null, false, true)
		|| $lang->load($option, JPATH_BASE . "/components/$option",
null, false, true);

		return $form;
	}

	/**
	 * Get the component information.
	 *
	 * @return	object
	 *
	 * @since	3.2
	 */
	public function getComponent()
	{
		$state = $this->getState();
		$option = $state->get('component.option');

		// Load common and local language files.
		$lang = JFactory::getLanguage();
		$lang->load($option, JPATH_BASE, null, false, true)
		|| $lang->load($option, JPATH_BASE . "/components/$option",
null, false, true);

		$result = JComponentHelper::getComponent($option);

		return $result;
	}

	/**
	 * Method to save the configuration data.
	 *
	 * @param   array  $data  An array containing all global config data.
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since	3.2
	 * @throws  RuntimeException
	 */
	public function save($data)
	{
		$table      = JTable::getInstance('extension');
		$dispatcher = JEventDispatcher::getInstance();
		$context    = $this->option . '.' . $this->name;
		JPluginHelper::importPlugin('extension');

		// Check super user group.
		if (isset($data['params']) &&
!JFactory::getUser()->authorise('core.admin'))
		{
			$form = $this->getForm(array(), false);

			foreach ($form->getFieldsets() as $fieldset)
			{
				foreach ($form->getFieldset($fieldset->name) as $field)
				{
					if ($field->type === 'UserGroupList' &&
isset($data['params'][$field->fieldname])
						&& (int)
$field->getAttribute('checksuperusergroup', 0) === 1
						&&
JAccess::checkGroup($data['params'][$field->fieldname],
'core.admin'))
					{
						throw new
RuntimeException(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
					}
				}
			}
		}

		// Save the rules.
		if (isset($data['params']) &&
isset($data['params']['rules']))
		{
			if (!JFactory::getUser()->authorise('core.admin',
$data['option']))
			{
				throw new
RuntimeException(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
			}

			$rules = new JAccessRules($data['params']['rules']);
			$asset = JTable::getInstance('asset');

			if (!$asset->loadByName($data['option']))
			{
				$root = JTable::getInstance('asset');
				$root->loadByName('root.1');
				$asset->name = $data['option'];
				$asset->title = $data['option'];
				$asset->setLocation($root->id, 'last-child');
			}

			$asset->rules = (string) $rules;

			if (!$asset->check() || !$asset->store())
			{
				throw new RuntimeException($asset->getError());
			}

			// We don't need this anymore
			unset($data['option']);
			unset($data['params']['rules']);
		}

		// Load the previous Data
		if (!$table->load($data['id']))
		{
			throw new RuntimeException($table->getError());
		}

		unset($data['id']);

		// Bind the data.
		if (!$table->bind($data))
		{
			throw new RuntimeException($table->getError());
		}

		// Check the data.
		if (!$table->check())
		{
			throw new RuntimeException($table->getError());
		}

		$result = $dispatcher->trigger('onExtensionBeforeSave',
array($context, $table, false));

			// Store the data.
		if (in_array(false, $result, true) || !$table->store())
		{
			throw new RuntimeException($table->getError());
		}

		// Trigger the after save event.
		$dispatcher->trigger('onExtensionAfterSave', array($context,
$table, false));

		// Clean the component cache.
		$this->cleanCache('_system', 0);
		$this->cleanCache('_system', 1);

		return true;
	}
}
model/field/configcomponents.php000064400000003461151165335160013025
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('List');

/**
 * Text Filters form field.
 *
 * @since  3.7.0
 */
class JFormFieldConfigComponents extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since	3.7.0
	 */
	public $type = 'ConfigComponents';

	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array  An array of JHtml options.
	 *
	 * @since   3.7.0
	 */
	protected function getOptions()
	{
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('name AS text, element AS value')
			->from('#__extensions')
			->where('enabled >= 1')
			->where('type =' . $db->quote('component'));

		$items = $db->setQuery($query)->loadObjectList();

		if ($items)
		{
			$lang = JFactory::getLanguage();

			foreach ($items as &$item)
			{
				// Load language
				$extension = $item->value;

				if (JFile::exists(JPATH_ADMINISTRATOR . '/components/' .
$extension . '/config.xml'))
				{
					$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
					$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null,
false, true)
					|| $lang->load("$extension.sys", $source, null, false,
true);

					// Translate component name
					$item->text = JText::_($item->text);
				}
				else
				{
					$item = null;
				}
			}

			// Sort by component name
			$items = ArrayHelper::sortObjects(array_filter($items),
'text', 1, true, true);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $items);

		return $options;
	}
}
model/field/filters.php000064400000015004151165335160011116
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Text Filters form field.
 *
 * @since  1.6
 */
class JFormFieldFilters extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since	1.6
	 */
	public $type = 'Filters';

	/**
	 * Method to get the field input markup.
	 *
	 * TODO: Add access check.
	 *
	 * @return	string	The field input markup.
	 *
	 * @since	1.6
	 */
	protected function getInput()
	{
		// Load Framework
		JHtml::_('jquery.framework');

		// Add translation string for notification
		JText::script('COM_CONFIG_TEXT_FILTERS_NOTE');

		// Add Javascript
		$doc = JFactory::getDocument();
		$doc->addScriptDeclaration('
			jQuery( document ).ready(function( $ ) {
				$("#filter-config select").change(function() {
					var currentFilter =
$(this).children("option:selected").val();

					if($(this).children("option:selected").val() ===
"NONE") {
						var child = $("#filter-config select[data-parent=" +
$(this).attr("data-id") + "]");
					
						while(child.length !== 0) {
							if(child.children("option:selected").val() !==
"NONE") {
								alert(Joomla.JText._("COM_CONFIG_TEXT_FILTERS_NOTE"));
								break;
							}
							
							child = $("#filter-config select[data-parent=" +
child.attr("data-id") + "]");
						}
						
						return;
					}

					var parent = $("#filter-config select[data-id=" +
$(this).attr("data-parent") + "]");

					while(parent.length !== 0) {
						if(parent.children("option:selected").val() ===
"NONE") {
							alert(Joomla.JText._("COM_CONFIG_TEXT_FILTERS_NOTE"));
							break;
						}
						
						parent = $("#filter-config select[data-id=" +
parent.attr("data-parent") + "]")
					}
				});
			});
		');

		// Get the available user groups.
		$groups = $this->getUserGroups();

		// Build the form control.
		$html = array();

		// Open the table.
		$html[] = '<table id="filter-config" class="table
table-striped">';

		// The table heading.
		$html[] = '	<thead>';
		$html[] = '	<tr>';
		$html[] = '		<th>';
		$html[] = '			<span class="acl-action">' .
JText::_('JGLOBAL_FILTER_GROUPS_LABEL') .
'</span>';
		$html[] = '		</th>';
		$html[] = '		<th>';
		$html[] = '			<span class="acl-action">' .
JText::_('JGLOBAL_FILTER_TYPE_LABEL') .
'</span>';
		$html[] = '		</th>';
		$html[] = '		<th>';
		$html[] = '			<span class="acl-action">' .
JText::_('JGLOBAL_FILTER_TAGS_LABEL') .
'</span>';
		$html[] = '		</th>';
		$html[] = '		<th>';
		$html[] = '			<span class="acl-action">' .
JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') .
'</span>';
		$html[] = '		</th>';
		$html[] = '	</tr>';
		$html[] = '	</thead>';

		// The table body.
		$html[] = '	<tbody>';

		foreach ($groups as $group)
		{
			if (!isset($this->value[$group->value]))
			{
				$this->value[$group->value] = array('filter_type' =>
'BL', 'filter_tags' => '',
'filter_attributes' => '');
			}

			$group_filter = $this->value[$group->value];

			$group_filter['filter_tags']       =
!empty($group_filter['filter_tags']) ?
$group_filter['filter_tags'] : '';
			$group_filter['filter_attributes'] =
!empty($group_filter['filter_attributes']) ?
$group_filter['filter_attributes'] : '';

			$html[] = '	<tr>';
			$html[] = '		<td class="acl-groups left">';
			$html[] = '			' .
JLayoutHelper::render('joomla.html.treeprefix',
array('level' => $group->level + 1)) . $group->text;
			$html[] = '		</td>';
			$html[] = '		<td>';
			$html[] = '				<select'
				. ' name="' . $this->name . '[' .
$group->value . '][filter_type]"'
				. ' id="' . $this->id . $group->value .
'_filter_type"'
				. ' data-parent="' . ($group->parent) . '"
'
				. ' data-id="' . ($group->value) . '"
'
				. ' class="novalidate"'
				. '>';
			$html[] = '					<option value="BL"' .
($group_filter['filter_type'] == 'BL' ? '
selected="selected"' : '') . '>'
				. JText::_('COM_CONFIG_FIELD_FILTERS_DEFAULT_BLACK_LIST') .
'</option>';
			$html[] = '					<option value="CBL"' .
($group_filter['filter_type'] == 'CBL' ? '
selected="selected"' : '') . '>'
				. JText::_('COM_CONFIG_FIELD_FILTERS_CUSTOM_BLACK_LIST') .
'</option>';
			$html[] = '					<option value="WL"' .
($group_filter['filter_type'] == 'WL' ? '
selected="selected"' : '') . '>'
				. JText::_('COM_CONFIG_FIELD_FILTERS_WHITE_LIST') .
'</option>';
			$html[] = '					<option value="NH"' .
($group_filter['filter_type'] == 'NH' ? '
selected="selected"' : '') . '>'
				. JText::_('COM_CONFIG_FIELD_FILTERS_NO_HTML') .
'</option>';
			$html[] = '					<option value="NONE"' .
($group_filter['filter_type'] == 'NONE' ? '
selected="selected"' : '') . '>'
				. JText::_('COM_CONFIG_FIELD_FILTERS_NO_FILTER') .
'</option>';
			$html[] = '				</select>';
			$html[] = '		</td>';
			$html[] = '		<td>';
			$html[] = '				<input'
				. ' name="' . $this->name . '[' .
$group->value . '][filter_tags]"'
				. ' type="text"'
				. ' id="' . $this->id . $group->value .
'_filter_tags" class="novalidate"'
				. ' value="' .
htmlspecialchars($group_filter['filter_tags'], ENT_QUOTES) .
'"'
				. '/>';
			$html[] = '		</td>';
			$html[] = '		<td>';
			$html[] = '				<input'
				. ' name="' . $this->name . '[' .
$group->value . '][filter_attributes]"'
				. ' type="text"'
				. ' id="' . $this->id . $group->value .
'_filter_attributes" class="novalidate"'
				. ' value="' .
htmlspecialchars($group_filter['filter_attributes'], ENT_QUOTES)
. '"'
				. '/>';
			$html[] = '		</td>';
			$html[] = '	</tr>';
		}

		$html[] = '	</tbody>';

		// Close the table.
		$html[] = '</table>';

		// Add notes
		$html[] = '<div class="alert">';
		$html[] = '<p>' .
JText::_('JGLOBAL_FILTER_TYPE_DESC') . '</p>';
		$html[] = '<p>' .
JText::_('JGLOBAL_FILTER_TAGS_DESC') . '</p>';
		$html[] = '<p>' .
JText::_('JGLOBAL_FILTER_ATTRIBUTES_DESC') .
'</p>';
		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * A helper to get the list of user groups.
	 *
	 * @return	array
	 *
	 * @since	1.6
	 */
	protected function getUserGroups()
	{
		// Get a database object.
		$db = JFactory::getDbo();

		// Get the user groups from the database.
		$query = $db->getQuery(true);
		$query->select('a.id AS value, a.title AS text, COUNT(DISTINCT
b.id) AS level, a.parent_id as parent');
		$query->from('#__usergroups AS a');
		$query->join('LEFT', '#__usergroups AS b on a.lft >
b.lft AND a.rgt < b.rgt');
		$query->group('a.id, a.title, a.lft');
		$query->order('a.lft ASC');
		$db->setQuery($query);
		$options = $db->loadObjectList();

		return $options;
	}
}
model/form/application.xml000064400000072644151165335160011657
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fieldset
		name="cache"
		label="COM_CONFIG_CACHE_SETTINGS_LABEL">

		<field
			name="cache_handler"
			type="cachehandler"
			label="COM_CONFIG_FIELD_CACHE_HANDLER_LABEL"
			description="COM_CONFIG_FIELD_CACHE_HANDLER_DESC"
			default=""
			filter="word"
		/>

		<field
			name="cache_path"
			type="text"
			label="COM_CONFIG_FIELD_CACHE_PATH_LABEL"
			description="COM_CONFIG_FIELD_CACHE_PATH_DESC"
			showon="cache_handler:file"
			filter="string"
			size="50"
		/>

		<field
			name="memcache_persist"
			type="radio"
			label="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			showon="cache_handler:memcache"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="memcache_compress"
			type="radio"
			label="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			showon="cache_handler:memcache"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="memcache_server_host"
			type="text"
			label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC"
			default="localhost"
			showon="cache_handler:memcache"
			filter="string"
			size="25"
		/>

		<field
			name="memcache_server_port"
			type="number"
			label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC"
			showon="cache_handler:memcache"
			min="1"
			max="65535"
			default="11211"
			filter="integer"
			validate="number"
			size="5"
		/>

		<field
			name="memcached_persist"
			type="radio"
			label="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			showon="cache_handler:memcached"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="memcached_compress"
			type="radio"
			label="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			showon="cache_handler:memcached"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="memcached_server_host"
			type="text"
			label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC"
			default="localhost"
			showon="cache_handler:memcached"
			filter="string"
			size="25"
		/>

		<field
			name="memcached_server_port"
			type="number"
			label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC"
			showon="cache_handler:memcached"
			min="1"
			max="65535"
			default="11211"
			filter="integer"
			validate="number"
			size="5"
		/>

		<field
			name="redis_persist"
			type="radio"
			label="COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL"
			description="COM_CONFIG_FIELD_REDIS_PERSISTENT_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			showon="cache_handler:redis"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="redis_server_host"
			type="text"
			label="COM_CONFIG_FIELD_REDIS_HOST_LABEL"
			description="COM_CONFIG_FIELD_REDIS_HOST_DESC"
			default="localhost"
			filter="string"
			showon="cache_handler:redis"
			size="25"
		/>

		<field
			name="redis_server_port"
			type="number"
			label="COM_CONFIG_FIELD_REDIS_PORT_LABEL"
			description="COM_CONFIG_FIELD_REDIS_PORT_DESC"
			showon="cache_handler:redis"
			min="1"
			max="65535"
			default="6379"
			filter="integer"
			validate="number"
			size="5"
		/>

		<field
			name="redis_server_auth"
			type="password"
			label="COM_CONFIG_FIELD_REDIS_AUTH_LABEL"
			description="COM_CONFIG_FIELD_REDIS_AUTH_DESC"
			filter="raw"
			showon="cache_handler:redis"
			autocomplete="off"
			size="30"
			hint="***************"
			lock="true"
		/>

		<field
			name="redis_server_db"
			type="number"
			label="COM_CONFIG_FIELD_REDIS_DB_LABEL"
			description="COM_CONFIG_FIELD_REDIS_DB_DESC"
			default="0"
			filter="integer"
			showon="cache_handler:redis"
			size="4"
		/>

		<field
			name="cachetime"
			type="number"
			label="COM_CONFIG_FIELD_CACHE_TIME_LABEL"
			description="COM_CONFIG_FIELD_CACHE_TIME_DESC"
			min="1"
			default="15"
			filter="integer"
			validate="number"
			size="6"
		/>

		<field
			name="cache_platformprefix"
			type="radio"
			label="COM_CONFIG_FIELD_CACHE_PLATFORMPREFIX_LABEL"
			description="COM_CONFIG_FIELD_CACHE_PLATFORMPREFIX_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="caching"
			type="list"
			label="COM_CONFIG_FIELD_CACHE_LABEL"
			description="COM_CONFIG_FIELD_CACHE_DESC"
			default="2"
			filter="integer"
			>
			<option
value="0">COM_CONFIG_FIELD_VALUE_CACHE_OFF</option>
			<option
value="1">COM_CONFIG_FIELD_VALUE_CACHE_CONSERVATIVE</option>
			<option
value="2">COM_CONFIG_FIELD_VALUE_CACHE_PROGRESSIVE</option>
		</field>

	</fieldset>

	<fieldset
		name="memcache"
		label="COM_CONFIG_MEMCACHE_SETTINGS_LABEL">
	</fieldset>

	<fieldset
		name="database"
		label="CONFIG_DATABASE_SETTINGS_LABEL">

		<field
			name="dbtype"
			type="databaseconnection"
			label="COM_CONFIG_FIELD_DATABASE_TYPE_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_TYPE_DESC"
			supported="mysql,mysqli,pgsql,pdomysql,postgresql,sqlsrv,sqlazure"
			filter="string"
		/>

		<field
			name="host"
			type="text"
			label="COM_CONFIG_FIELD_DATABASE_HOST_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_HOST_DESC"
			required="true"
			filter="string"
			size="30"
		/>

		<field
			name="user"
			type="text"
			label="COM_CONFIG_FIELD_DATABASE_USERNAME_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_USERNAME_DESC"
			required="true"
			filter="string"
			size="30"
		/>

		<field
			name="password"
			type="password"
			label="COM_CONFIG_FIELD_DATABASE_PASSWORD_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_PASSWORD_DESC"
			filter="raw"
			autocomplete="off"
			size="30"
			lock="true"
		/>

		<field
			name="db"
			type="text"
			label="COM_CONFIG_FIELD_DATABASE_NAME_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_NAME_DESC"
			required="true"
			filter="string"
			size="30"
		/>

		<field
			name="dbprefix"
			type="text"
			label="COM_CONFIG_FIELD_DATABASE_PREFIX_LABEL"
			description="COM_CONFIG_FIELD_DATABASE_PREFIX_DESC"
			default="jos_"
			filter="string"
			size="10"
		/>

	</fieldset>

	<fieldset
		name="debug"
		label="CONFIG_DEBUG_SETTINGS_LABEL">

		<field
			name="debug"
			type="radio"
			label="COM_CONFIG_FIELD_DEBUG_SYSTEM_LABEL"
			description="COM_CONFIG_FIELD_DEBUG_SYSTEM_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="debug_lang"
			type="radio"
			label="COM_CONFIG_FIELD_DEBUG_LANG_LABEL"
			description="COM_CONFIG_FIELD_DEBUG_LANG_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="debug_lang_const"
			type="radio"
			label="COM_CONFIG_FIELD_DEBUG_CONST_LANG_LABEL"
			description="COM_CONFIG_FIELD_DEBUG_CONST_LANG_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			showon="debug_lang:1"
			>
			<option
value="0">COM_CONFIG_FIELD_DEBUG_CONST</option>
			<option
value="1">COM_CONFIG_FIELD_DEBUG_VALUE</option>
		</field>

	</fieldset>

	<fieldset name="ftp"
label="CONFIG_FTP_SETTINGS_LABEL">

		<field
			name="ftp_enable"
			type="radio"
			label="COM_CONFIG_FIELD_FTP_ENABLE_LABEL"
			description="COM_CONFIG_FIELD_FTP_ENABLE_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="ftp_host"
			type="text"
			label="COM_CONFIG_FIELD_FTP_HOST_LABEL"
			description="COM_CONFIG_FIELD_FTP_HOST_DESC"
			filter="string"
			showon="ftp_enable:1"
			size="14"
		/>

		<field
			name="ftp_port"
			type="number"
			label="COM_CONFIG_FIELD_FTP_PORT_LABEL"
			description="COM_CONFIG_FIELD_FTP_PORT_DESC"
			showon="ftp_enable:1"
			min="1"
			max="65535"
			hint="21"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="ftp_user"
			type="text"
			label="COM_CONFIG_FIELD_FTP_USERNAME_LABEL"
			description="COM_CONFIG_FIELD_FTP_USERNAME_DESC"
			filter="string"
			showon="ftp_enable:1"
			autocomplete="off"
			size="25"
		/>

		<field
			name="ftp_pass"
			type="password"
			label="COM_CONFIG_FIELD_FTP_PASSWORD_LABEL"
			description="COM_CONFIG_FIELD_FTP_PASSWORD_DESC"
			filter="raw"
			showon="ftp_enable:1"
			autocomplete="off"
			size="25"
			lock="true"
		/>

		<field
			name="ftp_root"
			type="text"
			label="COM_CONFIG_FIELD_FTP_ROOT_LABEL"
			description="COM_CONFIG_FIELD_FTP_ROOT_DESC"
			showon="ftp_enable:1"
			filter="string"
			size="50"
		/>

	</fieldset>

	<fieldset
		name="proxy"
		label="CONFIG_PROXY_SETTINGS_LABEL">

		<field
			name="proxy_enable"
			type="radio"
			label="COM_CONFIG_FIELD_PROXY_ENABLE_LABEL"
			description="COM_CONFIG_FIELD_PROXY_ENABLE_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="proxy_host"
			type="text"
			label="COM_CONFIG_FIELD_PROXY_HOST_LABEL"
			description="COM_CONFIG_FIELD_PROXY_HOST_DESC"
			filter="string"
			showon="proxy_enable:1"
			size="14"
		/>

		<field
			name="proxy_port"
			type="number"
			label="COM_CONFIG_FIELD_PROXY_PORT_LABEL"
			description="COM_CONFIG_FIELD_PROXY_PORT_DESC"
			showon="proxy_enable:1"
			min="1"
			max="65535"
			hint="8080"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="proxy_user"
			type="text"
			label="COM_CONFIG_FIELD_PROXY_USERNAME_LABEL"
			description="COM_CONFIG_FIELD_PROXY_USERNAME_DESC"
			filter="string"
			showon="proxy_enable:1"
			autocomplete="off"
			size="25"
		/>

		<field
			name="proxy_pass"
			type="password"
			label="COM_CONFIG_FIELD_PROXY_PASSWORD_LABEL"
			description="COM_CONFIG_FIELD_PROXY_PASSWORD_DESC"
			filter="raw"
			showon="proxy_enable:1"
			autocomplete="off"
			size="25"
			lock="true"
		/>

	</fieldset>

	<fieldset
		name="locale"
		label="CONFIG_LOCATION_SETTINGS_LABEL">

		<field
			name="offset"
			type="timezone"
			label="COM_CONFIG_FIELD_SERVER_TIMEZONE_LABEL"
			description="COM_CONFIG_FIELD_SERVER_TIMEZONE_DESC"
			default="UTC"
			>
			<option
value="UTC">JLIB_FORM_VALUE_TIMEZONE_UTC</option>
		</field>

	</fieldset>

	<fieldset
		name="mail"
		label="CONFIG_MAIL_SETTINGS_LABEL">

		<field
			name="mailonline"
			type="radio"
			label="COM_CONFIG_FIELD_MAIL_MAILONLINE_LABEL"
			description="COM_CONFIG_FIELD_MAIL_MAILONLINE_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="massmailoff"
			type="radio"
			label="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_LABEL"
			description="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			showon="mailonline:1"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="mailfrom"
			type="email"
			label="COM_CONFIG_FIELD_MAIL_FROM_EMAIL_LABEL"
			description="COM_CONFIG_FIELD_MAIL_FROM_EMAIL_DESC"
			filter="string"
			size="30"
			validate="email"
			showon="mailonline:1"
		/>

		<field
			name="fromname"
			type="text"
			label="COM_CONFIG_FIELD_MAIL_FROM_NAME_LABEL"
			description="COM_CONFIG_FIELD_MAIL_FROM_NAME_DESC"
			filter="string"
			size="30"
			showon="mailonline:1"
		/>

		<field
			name="replyto"
			type="email"
			label="COM_CONFIG_FIELD_MAIL_REPLY_TO_EMAIL_LABEL"
			description="COM_CONFIG_FIELD_MAIL_REPLY_TO_EMAIL_DESC"
			filter="string"
			size="30"
			validate="email"
			showon="mailonline:1"
		/>

		<field
			name="replytoname"
			type="text"
			label="COM_CONFIG_FIELD_MAIL_REPLY_TO_NAME_LABEL"
			description="COM_CONFIG_FIELD_MAIL_REPLY_TO_NAME_DESC"
			filter="string"
			size="30"
			showon="mailonline:1"
		/>

		<field
			name="mailer"
			type="list"
			label="COM_CONFIG_FIELD_MAIL_MAILER_LABEL"
			description="COM_CONFIG_FIELD_MAIL_MAILER_DESC"
			default="mail"
			filter="word"
			showon="mailonline:1"
			>
			<option
value="mail">COM_CONFIG_FIELD_VALUE_PHP_MAIL</option>
			<option
value="sendmail">COM_CONFIG_FIELD_VALUE_SENDMAIL</option>
			<option
value="smtp">COM_CONFIG_FIELD_VALUE_SMTP</option>
		</field>

		<field
			name="sendmail"
			type="text"
			label="COM_CONFIG_FIELD_MAIL_SENDMAIL_PATH_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SENDMAIL_PATH_DESC"
			default="/usr/sbin/sendmail"
			showon="mailonline:1[AND]mailer:sendmail"
			filter="string"
			size="30"
		/>

		<field
			name="smtphost"
			type="text"
			label="COM_CONFIG_FIELD_MAIL_SMTP_HOST_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_HOST_DESC"
			default="localhost"
			showon="mailonline:1[AND]mailer:smtp"
			filter="string"
			size="30"
		/>

		<field
			name="smtpport"
			type="number"
			label="COM_CONFIG_FIELD_MAIL_SMTP_PORT_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_PORT_DESC"
			showon="mailonline:1[AND]mailer:smtp"
			min="1"
			max="65535"
			default="25"
			hint="25"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="smtpsecure"
			type="list"
			label="COM_CONFIG_FIELD_MAIL_SMTP_SECURE_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_SECURE_DESC"
			default="none"
			showon="mailonline:1[AND]mailer:smtp"
			filter="word"
			>
			<option
value="none">COM_CONFIG_FIELD_VALUE_NONE</option>
			<option
value="ssl">COM_CONFIG_FIELD_VALUE_SSL</option>
			<option
value="tls">COM_CONFIG_FIELD_VALUE_TLS</option>
		</field>

		<field
			name="smtpauth"
			type="radio"
			label="COM_CONFIG_FIELD_MAIL_SMTP_AUTH_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_AUTH_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			showon="mailonline:1[AND]mailer:smtp"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="smtpuser"
			type="text"
			label="COM_CONFIG_FIELD_MAIL_SMTP_USERNAME_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_USERNAME_DESC"
			showon="mailonline:1[AND]mailer:smtp[AND]smtpauth:1"
			filter="string"
			autocomplete="off"
			size="30"
		/>

		<field
			name="smtppass"
			type="password"
			label="COM_CONFIG_FIELD_MAIL_SMTP_PASSWORD_LABEL"
			description="COM_CONFIG_FIELD_MAIL_SMTP_PASSWORD_DESC"
			showon="mailonline:1[AND]mailer:smtp[AND]smtpauth:1"
			filter="raw"
			autocomplete="off"
			size="30"
			lock="true"
		/>

	</fieldset>

	<fieldset
		name="metadata"
		label="COM_CONFIG_METADATA_SETTINGS">

		<field
			name="MetaDesc"
			type="textarea"
			label="COM_CONFIG_FIELD_METADESC_LABEL"
			description="COM_CONFIG_FIELD_METADESC_DESC"
			filter="string"
			cols="60"
			rows="3"
		/>

		<field
			name="MetaKeys"
			type="textarea"
			label="COM_CONFIG_FIELD_METAKEYS_LABEL"
			description="COM_CONFIG_FIELD_METAKEYS_DESC"
			filter="string"
			cols="60"
			rows="3"
		/>

		<field
			name="robots"
			type="list"
			label="JFIELD_METADATA_ROBOTS_LABEL"
			description="JFIELD_METADATA_ROBOTS_DESC"
			default=""
			>
			<option value="">index, follow</option>
			<option value="noindex, follow"></option>
			<option value="index, nofollow"></option>
			<option value="noindex, nofollow"></option>
		</field>

		<field
			name="MetaRights"
			type="textarea"
			label="JFIELD_META_RIGHTS_LABEL"
			description="JFIELD_META_RIGHTS_DESC"
			filter="string"
			cols="60"
			rows="2"
		/>

		<field
			name="MetaAuthor"
			type="radio"
			label="COM_CONFIG_FIELD_METAAUTHOR_LABEL"
			description="COM_CONFIG_FIELD_METAAUTHOR_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="MetaVersion"
			type="radio"
			label="COM_CONFIG_FIELD_METAVERSION_LABEL"
			description="COM_CONFIG_FIELD_METAVERSION_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

	</fieldset>

	<fieldset
		name="seo"
		label="CONFIG_SEO_SETTINGS_LABEL">

		<field
			name="sef"
			type="radio"
			label="COM_CONFIG_FIELD_SEF_URL_LABEL"
			description="COM_CONFIG_FIELD_SEF_URL_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="sef_rewrite"
			type="radio"
			label="COM_CONFIG_FIELD_SEF_REWRITE_LABEL"
			description="COM_CONFIG_FIELD_SEF_REWRITE_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			showon="sef:1"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="sef_suffix"
			type="radio"
			label="COM_CONFIG_FIELD_SEF_SUFFIX_LABEL"
			description="COM_CONFIG_FIELD_SEF_SUFFIX_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			showon="sef:1"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="unicodeslugs"
			type="radio"
			label="COM_CONFIG_FIELD_UNICODESLUGS_LABEL"
			description="COM_CONFIG_FIELD_UNICODESLUGS_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			showon="sef:1"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="sitename_pagetitles"
			type="list"
			label="COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL"
			description="COM_CONFIG_FIELD_SITENAME_PAGETITLES_DESC"
			default="0"
			filter="integer"
			>
			<option
value="2">COM_CONFIG_FIELD_VALUE_AFTER</option>
			<option
value="1">COM_CONFIG_FIELD_VALUE_BEFORE</option>
			<option value="0">JNO</option>
		</field>

	</fieldset>

	<fieldset
		name="server"
		label="CONFIG_SERVER_SETTINGS_LABEL">

		<field
			name="tmp_path"
			type="text"
			label="COM_CONFIG_FIELD_TEMP_PATH_LABEL"
			description="COM_CONFIG_FIELD_TEMP_PATH_DESC"
			filter="string"
			size="50"
		/>

		<field
			name="gzip"
			type="radio"
			label="COM_CONFIG_FIELD_GZIP_COMPRESSION_LABEL"
			description="COM_CONFIG_FIELD_GZIP_COMPRESSION_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="error_reporting"
			type="list"
			label="COM_CONFIG_FIELD_ERROR_REPORTING_LABEL"
			description="COM_CONFIG_FIELD_ERROR_REPORTING_DESC"
			default="default"
			filter="cmd"
			>
			<option
value="default">COM_CONFIG_FIELD_VALUE_SYSTEM_DEFAULT</option>
			<option
value="none">COM_CONFIG_FIELD_VALUE_NONE</option>
			<option
value="simple">COM_CONFIG_FIELD_VALUE_SIMPLE</option>
			<option
value="maximum">COM_CONFIG_FIELD_VALUE_MAXIMUM</option>
			<option
value="development">COM_CONFIG_FIELD_VALUE_DEVELOPMENT</option>
		</field>

		<field
			name="force_ssl"
			type="list"
			label="COM_CONFIG_FIELD_FORCE_SSL_LABEL"
			description="COM_CONFIG_FIELD_FORCE_SSL_DESC"
			default="-1"
			filter="integer"
			>
			<option
value="0">COM_CONFIG_FIELD_VALUE_NONE</option>
			<option
value="1">COM_CONFIG_FIELD_VALUE_ADMINISTRATOR_ONLY</option>
			<option
value="2">COM_CONFIG_FIELD_VALUE_ENTIRE_SITE</option>
		</field>

	</fieldset>

	<fieldset
		name="session"
		label="CONFIG_SESSION_SETTINGS_LABEL">

		<field
			name="session_handler"
			type="sessionhandler"
			label="COM_CONFIG_FIELD_SESSION_HANDLER_LABEL"
			description="COM_CONFIG_FIELD_SESSION_HANDLER_DESC"
			default="none"
			filter="word"
		/>

		<field
			name="session_memcache_server_host"
			type="text"
			label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC"
			default="localhost"
			filter="string"
			showon="session_handler:memcache"
			size="25"
		/>

		<field
			name="session_memcache_server_port"
			type="number"
			label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC"
			showon="session_handler:memcache"
			min="1"
			max="65535"
			default="11211"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="session_memcached_server_host"
			type="text"
			label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC"
			default="localhost"
			filter="string"
			showon="session_handler:memcached"
			size="25"
		/>

		<field
			name="session_memcached_server_port"
			type="number"
			label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL"
			description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC"
			showon="session_handler:memcached"
			min="1"
			max="65535"
			default="11211"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="session_redis_persist"
			type="radio"
			label="COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL"
			description="COM_CONFIG_FIELD_REDIS_PERSISTENT_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			filter="integer"
			showon="session_handler:redis"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="session_redis_server_host"
			type="text"
			label="COM_CONFIG_FIELD_REDIS_HOST_LABEL"
			description="COM_CONFIG_FIELD_REDIS_HOST_DESC"
			default="localhost"
			filter="string"
			showon="session_handler:redis"
			size="25"
		/>

		<field
			name="session_redis_server_port"
			type="number"
			label="COM_CONFIG_FIELD_REDIS_PORT_LABEL"
			description="COM_CONFIG_FIELD_REDIS_PORT_DESC"
			showon="session_handler:redis"
			min="1"
			max="65535"
			default="6379"
			validate="number"
			filter="integer"
			size="5"
		/>

		<field
			name="session_redis_server_auth"
			type="password"
			label="COM_CONFIG_FIELD_REDIS_AUTH_LABEL"
			description="COM_CONFIG_FIELD_REDIS_AUTH_DESC"
			filter="raw"
			showon="session_handler:redis"
			autocomplete="off"
			size="30"
			lock="true"
		/>

		<field
			name="session_redis_server_db"
			type="number"
			label="COM_CONFIG_FIELD_REDIS_DB_LABEL"
			description="COM_CONFIG_FIELD_REDIS_DB_DESC"
			default="0"
			filter="integer"
			showon="session_handler:redis"
			size="4"
		/>
		<field
			name="lifetime"
			type="number"
			label="COM_CONFIG_FIELD_SESSION_TIME_LABEL"
			description="COM_CONFIG_FIELD_SESSION_TIME_DESC"
			min="1"
			max="16383"
			default="15"
			filter="integer"
			validate="number"
			size="6"
		/>

		<field
			name="shared_session"
			type="radio"
			label="COM_CONFIG_FIELD_SHARED_SESSION_LABEL"
			description="COM_CONFIG_FIELD_SHARED_SESSION_DESC"
			class="btn-group btn-group-yesno"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

	</fieldset>

	<fieldset
		name="site"
		label="CONFIG_SITE_SETTINGS_LABEL">

		<field
			name="sitename"
			type="text"
			label="COM_CONFIG_FIELD_SITE_NAME_LABEL"
			description="COM_CONFIG_FIELD_SITE_NAME_DESC"
			required="true"
			filter="string"
			size="50"
		/>

		<field
			name="offline"
			type="radio"
			label="COM_CONFIG_FIELD_SITE_OFFLINE_LABEL"
			description="COM_CONFIG_FIELD_SITE_OFFLINE_DESC"
			class="btn-group btn-group-yesno btn-group-reversed"
			default="0"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="display_offline_message"
			type="list"
			label="COM_CONFIG_FIELD_SITE_DISPLAY_MESSAGE_LABEL"
			description="COM_CONFIG_FIELD_SITE_DISPLAY_MESSAGE_DESC"
			default="1"
			filter="integer"
			showon="offline:1"
			>
			<option value="0">JHIDE</option>
			<option
value="1">COM_CONFIG_FIELD_VALUE_DISPLAY_OFFLINE_MESSAGE_CUSTOM</option>
			<option
value="2">COM_CONFIG_FIELD_VALUE_DISPLAY_OFFLINE_MESSAGE_LANGUAGE</option>
		</field>

		<field
			name="offline_message"
			type="textarea"
			label="COM_CONFIG_FIELD_OFFLINE_MESSAGE_LABEL"
			description="COM_CONFIG_FIELD_OFFLINE_MESSAGE_DESC"
			filter="safehtml"
			cols="60"
			rows="2"
			showon="offline:1[AND]display_offline_message:1"
		/>

		<field
			name="offline_image"
			type="media"
			label="COM_CONFIG_FIELD_OFFLINE_IMAGE_LABEL"
			description="COM_CONFIG_FIELD_OFFLINE_IMAGE_DESC"
			showon="offline:1"
		/>

		<field
			name="frontediting"
			type="list"
			label="COM_CONFIG_FRONTEDITING_LABEL"
			description="COM_CONFIG_FRONTEDITING_DESC"
			default="1"
			filter="integer"
			>
			<option
value="2">COM_CONFIG_FRONTEDITING_MENUSANDMODULES</option>
			<option
value="1">COM_CONFIG_FRONTEDITING_MODULES</option>
			<option value="0">JNONE</option>
		</field>

		<field
			name="editor"
			type="plugins"
			label="COM_CONFIG_FIELD_DEFAULT_EDITOR_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_EDITOR_DESC"
			folder="editors"
			default="tinymce"
			filter="cmd"
		/>

		<field
			name="captcha"
			type="plugins"
			label="COM_CONFIG_FIELD_DEFAULT_CAPTCHA_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_CAPTCHA_DESC"
			folder="captcha"
			default="0"
			filter="cmd"
			>
			<option value="0">JOPTION_DO_NOT_USE</option>
		</field>

		<field
			name="access"
			type="accesslevel"
			label="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_DESC"
			default="1"
			filter="integer"
		/>

		<field
			name="list_limit"
			type="list"
			label="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_DESC"
			default="20"
			filter="integer"
			>
			<option value="5">J5</option>
			<option value="10">J10</option>
			<option value="15">J15</option>
			<option value="20">J20</option>
			<option value="25">J25</option>
			<option value="30">J30</option>
			<option value="50">J50</option>
			<option value="100">J100</option>
			<option value="200">J200</option>
			<option value="500">J500</option>
		</field>

		<field
			name="feed_limit"
			type="list"
			label="COM_CONFIG_FIELD_DEFAULT_FEED_LIMIT_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_FEED_LIMIT_DESC"
			default="10"
			filter="integer"
			>
			<option value="5">J5</option>
			<option value="10">J10</option>
			<option value="15">J15</option>
			<option value="20">J20</option>
			<option value="25">J25</option>
			<option value="30">J30</option>
			<option value="50">J50</option>
			<option value="100">J100</option>
		</field>

		<field
			name="feed_email"
			type="list"
			label="COM_CONFIG_FIELD_FEED_EMAIL_LABEL"
			description="COM_CONFIG_FIELD_FEED_EMAIL_DESC"
			default="none"
			filter="word"
			>
			<option
value="author">COM_CONFIG_FIELD_VALUE_AUTHOR_EMAIL</option>
			<option
value="site">COM_CONFIG_FIELD_VALUE_SITE_EMAIL</option>
			<option
value="none">COM_CONFIG_FIELD_VALUE_NO_EMAIL</option>

		</field>

	</fieldset>

	<fieldset
		name="system"
		label="CONFIG_SYSTEM_SETTINGS_LABEL">

		<field
			name="log_path"
			type="text"
			label="COM_CONFIG_FIELD_LOG_PATH_LABEL"
			description="COM_CONFIG_FIELD_LOG_PATH_DESC"
			required="true"
			filter="string"
			size="50"
		/>

	</fieldset>

	<fieldset
		name="cookie"
		label="CONFIG_COOKIE_SETTINGS_LABEL">

		<field
			name="cookie_domain"
			type="text"
			label="COM_CONFIG_FIELD_COOKIE_DOMAIN_LABEL"
			description="COM_CONFIG_FIELD_COOKIE_DOMAIN_DESC"
			filter="string"
			size="40"
		/>

		<field
			name="cookie_path"
			type="text"
			label="COM_CONFIG_FIELD_COOKIE_PATH_LABEL"
			description="COM_CONFIG_FIELD_COOKIE_PATH_DESC"
			filter="string"
			size="40"
		/>

	</fieldset>

	<fieldset
		name="permissions"
		label="CONFIG_PERMISSION_SETTINGS_LABEL">

		<field
			name="rules"
			type="rules"
			label="FIELD_RULES_LABEL"
			translate_label="false"
			validate="rules"
			filter="rules"
			>
			<action
				name="core.login.site"
				title="JACTION_LOGIN_SITE"
				description="COM_CONFIG_ACTION_LOGIN_SITE_DESC"
			/>
			<action
				name="core.login.admin"
				title="JACTION_LOGIN_ADMIN"
				description="COM_CONFIG_ACTION_LOGIN_ADMIN_DESC"
			/>
			<action
				name="core.login.offline"
				title="JACTION_LOGIN_OFFLINE"
				description="COM_CONFIG_ACTION_LOGIN_OFFLINE_DESC"
			/>
			<action
				name="core.admin"
				title="JACTION_ADMIN_GLOBAL"
				description="COM_CONFIG_ACTION_ADMIN_DESC"
			/>
			<action
				name="core.options"
				title="JACTION_OPTIONS"
				description="COM_CONFIG_ACTION_OPTIONS_DESC"
			/>
			<action
				name="core.manage"
				title="JACTION_MANAGE"
				description="COM_CONFIG_ACTION_MANAGE_DESC"
			/>
			<action
				name="core.create"
				title="JACTION_CREATE"
				description="COM_CONFIG_ACTION_CREATE_DESC"
			/>
			<action
				name="core.delete"
				title="JACTION_DELETE"
				description="COM_CONFIG_ACTION_DELETE_DESC"
			/>
			<action
				name="core.edit"
				title="JACTION_EDIT"
				description="COM_CONFIG_ACTION_EDIT_DESC"
			/>
			<action
				name="core.edit.state"
				title="JACTION_EDITSTATE"
				description="COM_CONFIG_ACTION_EDITSTATE_DESC"
			/>
			<action
				name="core.edit.own"
				title="JACTION_EDITOWN"
				description="COM_CONFIG_ACTION_EDITOWN_DESC"
			/>
			<action
				name="core.edit.value"
				title="JACTION_EDITVALUE"
				description="COM_CONFIG_ACTION_EDITVALUE_DESC"
			/>
		</field>

	</fieldset>

	<fieldset
		name="filters"
		label="COM_CONFIG_TEXT_FILTERS"
		description="COM_CONFIG_TEXT_FILTERS_DESC">

		<field
			name="filters"
			type="filters"
			label="COM_CONFIG_TEXT_FILTERS"
			filter=""
		/>

	</fieldset>

	<fieldset>

		<field
			name="asset_id"
			type="hidden"
		/>

	</fieldset>
</form>
models/application.php000064400000001134151165335160011050 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

try
{
	JLog::add(
		sprintf('ConfigModelApplication has moved from %1$s to %2$s',
__FILE__, dirname(__DIR__) . '/model/application.php'),
		JLog::WARNING,
		'deprecated'
	);
}
catch (RuntimeException $exception)
{
	// Informational log only
}

include_once JPATH_ADMINISTRATOR .
'/components/com_config/model/application.php';
models/component.php000064400000001126151165335160010550 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

try
{
	JLog::add(
		sprintf('ConfigModelComponent has moved from %1$s to %2$s',
__FILE__, dirname(__DIR__) . '/model/component.php'),
		JLog::WARNING,
		'deprecated'
	);
}
catch (RuntimeException $exception)
{
	// Informational log only
}

include_once JPATH_ADMINISTRATOR .
'/components/com_config/model/component.php';
view/application/html.php000064400000004142151165335160011505
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View for the global configuration
 *
 * @since  3.2
 */
class ConfigViewApplicationHtml extends ConfigViewCmsHtml
{
	public $state;

	public $form;

	public $data;

	/**
	 * Method to display the view.
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		$form = null;
		$data = null;

		try
		{
			// Load Form and Data
			$form = $this->model->getForm();
			$data = $this->model->getData();
			$user = JFactory::getUser();
		}
		catch (Exception $e)
		{
			JFactory::getApplication()->enqueueMessage($e->getMessage(),
'error');

			return false;
		}

		// Bind data
		if ($form && $data)
		{
			$form->bind($data);
		}

		// Get the params for com_users.
		$usersParams = JComponentHelper::getParams('com_users');

		// Get the params for com_media.
		$mediaParams = JComponentHelper::getParams('com_media');

		// Load settings for the FTP layer.
		$ftp = JClientHelper::setCredentialsFromRequest('ftp');

		$this->form = &$form;
		$this->data = &$data;
		$this->ftp = &$ftp;
		$this->usersParams = &$usersParams;
		$this->mediaParams = &$mediaParams;

		$this->components = ConfigHelperConfig::getComponentsWithConfig();
		ConfigHelperConfig::loadLanguageForComponents($this->components);

		$this->userIsSuperAdmin = $user->authorise('core.admin');

		$this->addToolbar();

		return parent::render();
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since	3.2
	 */
	protected function addToolbar()
	{
		JToolbarHelper::title(JText::_('COM_CONFIG_GLOBAL_CONFIGURATION'),
'equalizer config');
		JToolbarHelper::apply('config.save.application.apply');
		JToolbarHelper::save('config.save.application.save');
		JToolbarHelper::divider();
		JToolbarHelper::cancel('config.cancel.application');
		JToolbarHelper::divider();
		JToolbarHelper::help('JHELP_SITE_GLOBAL_CONFIGURATION');
	}
}
view/application/json.php000064400000002671151165335160011517
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View for the component configuration
 *
 * @since  3.2
 */
class ConfigViewApplicationJson extends ConfigViewCmsJson
{
	public $state;

	public $data;

	/**
	 * Display the view
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		try
		{
			$this->data = $this->model->getData();
			$user = JFactory::getUser();
		}
		catch (Exception $e)
		{
			JFactory::getApplication()->enqueueMessage($e->getMessage(),
'error');

			return false;
		}

		$this->userIsSuperAdmin = $user->authorise('core.admin');

		// Required data
		$requiredData = array(
			'sitename'            => null,
			'offline'             => null,
			'access'              => null,
			'list_limit'          => null,
			'MetaDesc'            => null,
			'MetaKeys'            => null,
			'MetaRights'          => null,
			'sef'                 => null,
			'sitename_pagetitles' => null,
			'debug'               => null,
			'debug_lang'          => null,
			'error_reporting'     => null,
			'mailfrom'            => null,
			'fromname'            => null
		);

		$this->data = array_intersect_key($this->data, $requiredData);

		return json_encode($this->data);
	}
}
view/application/tmpl/default.php000064400000010327151165335160013143
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

// Load tooltips behavior
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');
JHtml::_('formbehavior.chosen', 'select');

// Load JS message titles
JText::script('ERROR');
JText::script('WARNING');
JText::script('NOTICE');
JText::script('MESSAGE');

JFactory::getDocument()->addScriptDeclaration('
	Joomla.submitbutton = function(task)
	{
		if (task === "config.cancel.application" ||
document.formvalidator.isValid(document.getElementById("application-form")))
		{
			jQuery("#permissions-sliders
select").attr("disabled", "disabled");
			Joomla.submitform(task,
document.getElementById("application-form"));
		}
	};
');
?>

<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
id="application-form" method="post"
name="adminForm" class="form-validate">
	<div class="row-fluid">
		<!-- Begin Sidebar -->
		<div id="sidebar" class="span2">
			<div class="sidebar-nav">
				<?php echo $this->loadTemplate('navigation'); ?>
				<?php
				// Display the submenu position modules
				$this->submenumodules =
JModuleHelper::getModules('submenu');
				foreach ($this->submenumodules as $submenumodule)
				{
					$output = JModuleHelper::renderModule($submenumodule);
					$params = new Registry($submenumodule->params);
					echo $output;
				}
				?>
			</div>
		</div>
		<!-- End Sidebar -->
		<!-- Begin Content -->
		<div class="span10">
			<ul class="nav nav-tabs">
				<li class="active"><a href="#page-site"
data-toggle="tab"><?php echo JText::_('JSITE');
?></a></li>
				<li><a href="#page-system"
data-toggle="tab"><?php echo
JText::_('COM_CONFIG_SYSTEM'); ?></a></li>
				<li><a href="#page-server"
data-toggle="tab"><?php echo
JText::_('COM_CONFIG_SERVER'); ?></a></li>
				<li><a href="#page-filters"
data-toggle="tab"><?php echo
JText::_('COM_CONFIG_TEXT_FILTERS'); ?></a></li>
				<?php if ($this->ftp) : ?>
					<li><a href="#page-ftp"
data-toggle="tab"><?php echo
JText::_('COM_CONFIG_FTP_SETTINGS'); ?></a></li>
				<?php endif; ?>
				<li><a href="#page-permissions"
data-toggle="tab"><?php echo
JText::_('COM_CONFIG_PERMISSIONS'); ?></a></li>
			</ul>
			<div id="config-document" class="tab-content">
				<div id="page-site" class="tab-pane active">
					<div class="row-fluid">
						<div class="span6">
							<?php echo $this->loadTemplate('site'); ?>
							<?php echo $this->loadTemplate('metadata'); ?>
						</div>
						<div class="span6">
							<?php echo $this->loadTemplate('seo'); ?>
							<?php echo $this->loadTemplate('cookie'); ?>
						</div>
					</div>
				</div>
				<div id="page-system" class="tab-pane">
					<div class="row-fluid">
						<div class="span12">
							<?php echo $this->loadTemplate('system'); ?>
							<?php echo $this->loadTemplate('debug'); ?>
							<?php echo $this->loadTemplate('cache'); ?>
							<?php echo $this->loadTemplate('session'); ?>
						</div>
					</div>
				</div>
				<div id="page-server" class="tab-pane">
					<div class="row-fluid">
						<div class="span6">
							<?php echo $this->loadTemplate('server'); ?>
							<?php echo $this->loadTemplate('locale'); ?>
							<?php echo $this->loadTemplate('ftp'); ?>
							<?php echo $this->loadTemplate('proxy'); ?>
						</div>
						<div class="span6">
							<?php echo $this->loadTemplate('database'); ?>
							<?php echo $this->loadTemplate('mail'); ?>
						</div>
					</div>
				</div>
				<div id="page-filters" class="tab-pane">
					<div class="row-fluid">
						<?php echo $this->loadTemplate('filters'); ?>
					</div>
				</div>
				<?php if ($this->ftp) : ?>
					<div id="page-ftp" class="tab-pane">
						<?php echo $this->loadTemplate('ftplogin'); ?>
					</div>
				<?php endif; ?>
				<div id="page-permissions" class="tab-pane">
					<div class="row-fluid">
						<?php echo $this->loadTemplate('permissions'); ?>
					</div>
				</div>
				<input type="hidden" name="task"
value="" />
				<?php echo JHtml::_('form.token'); ?>
			</div>
		</div>
		<!-- End Content -->
	</div>
</form>
view/application/tmpl/default.xml000064400000000314151165335160013147
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_CONFIG_CONFIG_VIEW_DEFAULT_TITLE">
		<message>
			<![CDATA[COM_CONFIG_CONFIG_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>
</metadata>
view/application/tmpl/default_cache.php000064400000000654151165335160014270
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_CACHE_SETTINGS');
$this->fieldsname = 'cache';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_cookie.php000064400000000656151165335160014500
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_COOKIE_SETTINGS');
$this->fieldsname = 'cookie';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_database.php000064400000000662151165335160014770
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_DATABASE_SETTINGS');
$this->fieldsname = 'database';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_debug.php000064400000000654151165335160014313
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_DEBUG_SETTINGS');
$this->fieldsname = 'debug';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_filters.php000064400000000760151165335160014673
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_TEXT_FILTER_SETTINGS');
$this->fieldsname = 'filters';
$this->description = JText::_('COM_CONFIG_TEXT_FILTERS_DESC');
echo JLayoutHelper::render('joomla.content.text_filters', $this);
view/application/tmpl/default_ftp.php000064400000000650151165335160014012
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_FTP_SETTINGS');
$this->fieldsname = 'ftp';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_ftplogin.php000064400000002171151165335160015043
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<fieldset title="<?php echo
JText::_('COM_CONFIG_FTP_DETAILS'); ?>"
class="form-horizontal">
	<legend><?php echo JText::_('COM_CONFIG_FTP_DETAILS');
?></legend>
	<?php echo JText::_('COM_CONFIG_FTP_DETAILS_TIP'); ?>
	<?php if ($this->ftp instanceof Exception) : ?>
		<p><?php echo JText::_($this->ftp->message);
?></p>
	<?php endif; ?>
	<div class="control-group">
		<div class="control-label"><label
for="username"><?php echo
JText::_('JGLOBAL_USERNAME'); ?></label></div>
		<div class="controls">
			<input type="text" id="username"
name="username" class="input_box" size="70"
value="" />
		</div>
	</div>
	<div class="control-group">
		<div class="control-label"><?php echo
JText::_('JGLOBAL_PASSWORD'); ?></div>
		<div class="controls">
			<input type="password" id="password"
name="password" class="input_box" size="70"
value="" />
		</div>
	</div>
</fieldset>
view/application/tmpl/default_locale.php000064400000000660151165335160014461
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_LOCATION_SETTINGS');
$this->fieldsname = 'locale';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_mail.php000064400000002375151165335160014151
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('jquery.token');
JHtml::_('script', 'system/sendtestmail.js',
array('version' => 'auto', 'relative'
=> true));

// Load JavaScript message titles
JText::script('ERROR');
JText::script('WARNING');
JText::script('NOTICE');
JText::script('MESSAGE');

// Add strings for JavaScript error translations.
JText::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT');
JText::script('JLIB_JS_AJAX_ERROR_NO_CONTENT');
JText::script('JLIB_JS_AJAX_ERROR_OTHER');
JText::script('JLIB_JS_AJAX_ERROR_PARSE');
JText::script('JLIB_JS_AJAX_ERROR_TIMEOUT');

// Ajax request data.
$ajaxUri =
JRoute::_('index.php?option=com_config&task=config.sendtestmail.application&format=json');

$this->name = JText::_('COM_CONFIG_MAIL_SETTINGS');
$this->fieldsname = 'mail';
echo JLayoutHelper::render('joomla.content.options_default',
$this);

echo '<button class="btn btn-small"
data-ajaxuri="' . $ajaxUri . '" 
type="button" id="sendtestmail">
		<span>' .
JText::_('COM_CONFIG_SENDMAIL_ACTION_BUTTON') .
'</span>
	</button>';
view/application/tmpl/default_metadata.php000064400000000662151165335160015004
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_METADATA_SETTINGS');
$this->fieldsname = 'metadata';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_navigation.php000064400000001631151165335160015360
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<ul class="nav nav-list">
	<?php if ($this->userIsSuperAdmin) : ?>
		<li class="nav-header"><?php echo
JText::_('COM_CONFIG_SYSTEM'); ?></li>
		<li class="active">
			<a href="index.php?option=com_config"><?php echo
JText::_('COM_CONFIG_GLOBAL_CONFIGURATION'); ?></a>
		</li>
		<li class="divider"></li>
	<?php endif; ?>
	<li class="nav-header"><?php echo
JText::_('COM_CONFIG_COMPONENT_FIELDSET_LABEL'); ?></li>
	<?php foreach ($this->components as $component) : ?>
		<li>
			<a
href="index.php?option=com_config&view=component&component=<?php
echo $component; ?>"><?php echo JText::_($component);
?></a>
		</li>
	<?php endforeach; ?>
</ul>
view/application/tmpl/default_permissions.php000064400000001032151165335160015567
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name        =
JText::_('COM_CONFIG_PERMISSION_SETTINGS');
$this->description = '';
$this->fieldsname  = 'permissions';
$this->formclass   = 'form-vertical';
$this->showlabel   = false;
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_proxy.php000064400000000654151165335160014406
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_PROXY_SETTINGS');
$this->fieldsname = 'proxy';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_seo.php000064400000000650151165335160014007
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_SEO_SETTINGS');
$this->fieldsname = 'seo';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_server.php000064400000000656151165335160014535
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_SERVER_SETTINGS');
$this->fieldsname = 'server';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_session.php000064400000000660151165335160014705
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_SESSION_SETTINGS');
$this->fieldsname = 'session';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_site.php000064400000000652151165335160014167
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_SITE_SETTINGS');
$this->fieldsname = 'site';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/application/tmpl/default_system.php000064400000000656151165335160014553
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$this->name = JText::_('COM_CONFIG_SYSTEM_SETTINGS');
$this->fieldsname = 'system';
echo JLayoutHelper::render('joomla.content.options_default',
$this);
view/component/html.php000064400000004755151165335160011216
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View for the component configuration
 *
 * @since  3.2
 */
class ConfigViewComponentHtml extends ConfigViewCmsHtml
{
	public $state;

	public $form;

	public $component;

	/**
	 * Display the view
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 *
	 */
	public function render()
	{
		$form = null;
		$component = null;

		try
		{
			$component = $this->model->getComponent();

			if (!$component->enabled)
			{
				return false;
			}

			$form = $this->model->getForm();
			$user = JFactory::getUser();
		}
		catch (Exception $e)
		{
			JFactory::getApplication()->enqueueMessage($e->getMessage(),
'error');

			return false;
		}

		// Bind the form to the data.
		if ($form && $component->params)
		{
			$form->bind($component->params);
		}

		$this->fieldsets   = $form ? $form->getFieldsets() : null;
		$this->formControl = $form ? $form->getFormControl() : null;

		// Don't show permissions fieldset if not authorised.
		if (!$user->authorise('core.admin', $component->option)
&& isset($this->fieldsets['permissions']))
		{
			unset($this->fieldsets['permissions']);
		}

		$this->form = &$form;
		$this->component = &$component;

		$this->components = ConfigHelperConfig::getComponentsWithConfig();

		$this->userIsSuperAdmin = $user->authorise('core.admin');
		$this->currentComponent =
JFactory::getApplication()->input->get('component');
		$this->return =
JFactory::getApplication()->input->get('return',
'', 'base64');

		$this->addToolbar();

		return parent::render();
	}

	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	protected function addToolbar()
	{
		JToolbarHelper::title(JText::_($this->component->option .
'_configuration'), 'equalizer config');
		JToolbarHelper::apply('config.save.component.apply');
		JToolbarHelper::save('config.save.component.save');
		JToolbarHelper::divider();
		JToolbarHelper::cancel('config.cancel.component');
		JToolbarHelper::divider();

		$helpUrl = $this->form->getData()->get('helpURL');
		$helpKey = (string)
$this->form->getXml()->config->help['key'];
		$helpKey = $helpKey ?: 'JHELP_COMPONENTS_' .
strtoupper($this->currentComponent) . '_OPTIONS';

		JToolbarHelper::help($helpKey, (boolean) $helpUrl, null,
$this->currentComponent);
	}
}
view/component/tmpl/default.php000064400000011120151165335160012632
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$app = JFactory::getApplication();
$template = $app->getTemplate();

// Load the tooltip behavior.
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', '.chzn-custom-value',
null, array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', 'select');

// Load JS message titles
JText::script('ERROR');
JText::script('WARNING');
JText::script('NOTICE');
JText::script('MESSAGE');

JFactory::getDocument()->addScriptDeclaration(
	'
	Joomla.submitbutton = function(task)
	{
		if (task === "config.cancel.component" ||
document.formvalidator.isValid(document.getElementById("component-form")))
		{
			jQuery("#permissions-sliders
select").attr("disabled", "disabled");
			Joomla.submitform(task,
document.getElementById("component-form"));
		}
	};

	// Select first tab
	jQuery(document).ready(function() {
		jQuery("#configTabs a:first").tab("show");
	});'
);
?>

<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
id="component-form" method="post"
name="adminForm" autocomplete="off"
class="form-validate form-horizontal">
	<div class="row-fluid">

		<!-- Begin Sidebar -->
		<div class="span2" id="sidebar">
			<div class="sidebar-nav">
				<?php echo $this->loadTemplate('navigation'); ?>
			</div>
		</div><!-- End Sidebar -->

		<div class="span10" id="config">

			<?php if ($this->fieldsets): ?>
			<ul class="nav nav-tabs" id="configTabs">
				<?php foreach ($this->fieldsets as $name => $fieldSet) : ?>
					<?php $dataShowOn = ''; ?>
					<?php if (!empty($fieldSet->showon)) : ?>
						<?php JHtml::_('jquery.framework'); ?>
						<?php JHtml::_('script', 'jui/cms.js',
array('version' => 'auto', 'relative'
=> true)); ?>
						<?php $dataShowOn = ' data-showon=\'' .
json_encode(JFormHelper::parseShowOnConditions($fieldSet->showon,
$this->formControl)) . '\''; ?>
					<?php endif; ?>
					<?php $label = empty($fieldSet->label) ? 'COM_CONFIG_'
. $name . '_FIELDSET_LABEL' : $fieldSet->label; ?>
					<li<?php echo $dataShowOn; ?>><a
data-toggle="tab" href="#<?php echo $name;
?>"><?php echo JText::_($label); ?></a></li>
				<?php endforeach; ?>
			</ul><!-- /configTabs -->

			<div class="tab-content" id="configContent">
				<?php foreach ($this->fieldsets as $name => $fieldSet) : ?>
					<div class="tab-pane" id="<?php echo $name;
?>">
						<?php if (isset($fieldSet->description) &&
!empty($fieldSet->description)) : ?>
							<div class="tab-description alert alert-info">
								<span class="icon-info"
aria-hidden="true"></span> <?php echo
JText::_($fieldSet->description); ?>
							</div>
						<?php endif; ?>
						<?php foreach ($this->form->getFieldset($name) as $field) :
?>
							<?php
								$dataShowOn = '';
								$groupClass = $field->type === 'Spacer' ? '
field-spacer' : '';
							?>
							<?php if ($field->showon) : ?>
								<?php JHtml::_('jquery.framework'); ?>
								<?php JHtml::_('script', 'jui/cms.js',
array('version' => 'auto', 'relative'
=> true)); ?>
								<?php $dataShowOn = ' data-showon=\'' .
json_encode(JFormHelper::parseShowOnConditions($field->showon,
$field->formControl, $field->group)) . '\''; ?>
							<?php endif; ?>
							<?php if ($field->hidden) : ?>
								<?php echo $field->input; ?>
							<?php else : ?>
								<div class="control-group<?php echo $groupClass;
?>"<?php echo $dataShowOn; ?>>
									<?php if ($name != 'permissions') : ?>
										<div class="control-label">
											<?php echo $field->label; ?>
										</div>
									<?php endif; ?>
									<div class="<?php if ($name != 'permissions')
: ?>controls<?php endif; ?>">
										<?php echo $field->input; ?>
									</div>
								</div>
							<?php endif; ?>
						<?php endforeach; ?>
					</div>
				<?php endforeach; ?>
			</div><!-- /configContent -->
			<?php else: ?>
				<div class="alert alert-info"><span
class="icon-info" aria-hidden="true"></span>
<?php echo
JText::_('COM_CONFIG_COMPONENT_NO_CONFIG_FIELDS_MESSAGE');
?></div>
			<?php endif; ?>

		</div><!-- /config -->

		<input type="hidden" name="id"
value="<?php echo $this->component->id; ?>" />
		<input type="hidden" name="component"
value="<?php echo $this->component->option; ?>" />
		<input type="hidden" name="return"
value="<?php echo $this->return; ?>" />
		<input type="hidden" name="task"
value="" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
view/component/tmpl/default.xml000064400000001017151165335160012647
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_CONFIG_COMPONENT_VIEW_DEFAULT_TITLE">
		<message>
			<![CDATA[COM_CONFIG_COMPONENT_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>
	<fields name="request">
		<fieldset name="request"
addfieldpath="administrator/components/com_config/model/field">
			<field
				name="component"
				type="configComponents"
				label="JGLOBAL_CHOOSE_COMPONENT_LABEL"
				description="JGLOBAL_CHOOSE_COMPONENT_DESC"
				required="true"
			/>
		</fieldset>
	</fields>
</metadata>
view/component/tmpl/default_navigation.php000064400000002014151165335160015053
0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<ul class="nav nav-list">
	<?php if ($this->userIsSuperAdmin) : ?>
		<li class="nav-header"><?php echo
JText::_('COM_CONFIG_SYSTEM'); ?></li>
		<li><a href="index.php?option=com_config"><?php
echo JText::_('COM_CONFIG_GLOBAL_CONFIGURATION');
?></a></li>
		<li class="divider"></li>
	<?php endif; ?>
	<li class="nav-header"><?php echo
JText::_('COM_CONFIG_COMPONENT_FIELDSET_LABEL'); ?></li>
	<?php foreach ($this->components as $component) : ?>
		<?php
		$active = '';
		if ($this->currentComponent === $component)
		{
			$active = ' class="active"';
		}
		?>
		<li<?php echo $active; ?>>
			<a
href="index.php?option=com_config&view=component&component=<?php
echo $component; ?>"><?php echo JText::_($component);
?></a>
		</li>
	<?php endforeach; ?>
</ul>
controller/cancel.php000064400000001316151165463500010674 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Cancel Controller
 *
 * @since  3.2
 */
class ConfigControllerCancel extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Method to handle cancel
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Redirect back to home(base) page
		$this->app->redirect(JUri::base());
	}
}
controller/canceladmin.php000064400000002736151165463500011714
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Cancel Controller for Admin
 *
 * @since  3.2
 */
class ConfigControllerCanceladmin extends ConfigControllerCancel
{
	/**
	 * The context for storing internal data, e.g. record.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $context;

	/**
	 * The URL option for the component.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $option;

	/**
	 * URL for redirection.
	 *
	 * @var    string
	 * @since  3.2
	 * @note   Replaces _redirect.
	 */
	protected $redirect;

	/**
	 * Method to handle admin cancel
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
			$this->app->redirect('index.php');
		}

		if (empty($this->context))
		{
			$this->context = $this->option . '.edit' .
$this->context;
		}

		// Redirect.
		$this->app->setUserState($this->context . '.data',
null);

		if (!empty($this->redirect))
		{
			// Don't redirect to an external URL.
			if (!JUri::isInternal($this->redirect))
			{
				$this->redirect = JUri::base();
			}

			$this->app->redirect($this->redirect);
		}
		else
		{
			parent::execute();
		}
	}
}
controller/cmsbase.php000064400000002110151165463500011055 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Base Display Controller
 *
 * @since  3.2
 */
class ConfigControllerCmsbase extends JControllerBase
{
	/**
	 * Prefix for the view and model classes
	 *
	 * @var    string
	 * @since  3.2
	 */
	public $prefix;

	/**
	 * Execute the controller.
	 *
	 * @return  mixed  A rendered view or true
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
			$this->app->redirect('index.php');
		}

		// Get the application
		$this->app = $this->getApplication();
		$this->app->redirect('index.php?option=' .
$this->input->get('option'));

		$this->componentFolder =
$this->input->getWord('option', 'com_content');
		$this->viewName        =
$this->input->getWord('view');

		return $this;
	}
}
controller/config/display.php000064400000004452151165463500012365
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Display Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerConfigDisplay extends ConfigControllerDisplay
{
	/**
	 * Method to display global configuration.
	 *
	 * @return  boolean	True on success, false on failure.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Get the application
		$app = $this->getApplication();

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

		$viewName     = $this->input->getWord('view',
'config');
		$viewFormat   = $document->getType();
		$layoutName   = $this->input->getWord('layout',
'default');

		// Access backend com_config
		JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR .
'/components/com_config');
		$displayClass = new ConfigControllerApplicationDisplay;

		// Set backend required params
		$document->setType('json');
		$app->input->set('view', 'application');

		// Execute backend controller
		$serviceData = json_decode($displayClass->execute(), true);

		// Reset params back after requesting from service
		$document->setType('html');
		$app->input->set('view', $viewName);

		// Register the layout paths for the view
		$paths = new SplPriorityQueue;
		$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');

		$viewClass  = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
		$modelClass = 'ConfigModel' . ucfirst($viewName);

		if (class_exists($viewClass))
		{
			if ($viewName !== 'close')
			{
				$model = new $modelClass;

				// Access check.
				if (!JFactory::getUser()->authorise('core.admin',
$model->getState('component.option')))
				{
					return;
				}
			}

			$view = new $viewClass($model, $paths);

			$view->setLayout($layoutName);

			// Push document object into the view.
			$view->document = $document;

			// Load form and bind data
			$form = $model->getForm();

			if ($form)
			{
				$form->bind($serviceData);
			}

			// Set form and data to the view
			$view->form = &$form;
			$view->data = &$serviceData;

			// Render view.
			echo $view->render();
		}

		return true;
	}
}
controller/config/save.php000064400000005634151165463500011661
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Save Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerConfigSave extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Method to save global configuration.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE'));
			$this->app->redirect('index.php');
		}

		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin'))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
			$this->app->redirect('index.php');
		}

		// Set FTP credentials, if given.
		JClientHelper::setCredentialsFromRequest('ftp');

		$model = new ConfigModelConfig;
		$form  = $model->getForm();
		$data  = $this->input->post->get('jform', array(),
'array');

		// Validate the posted data.
		$return = $model->validate($form, $data);

		// Check for validation errors.
		if ($return === false)
		{
			/*
			 * The validate method enqueued all messages for us, so we just need to
redirect back.
			 */

			// Save the data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Redirect back to the edit screen.
			$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));
		}

		// Attempt to save the configuration.
		$data = $return;

		// Access backend com_config
		JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR .
'/components/com_config');
		$saveClass = new ConfigControllerApplicationSave;

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

		// Set backend required params
		$document->setType('json');

		// Execute backend controller
		$return = $saveClass->execute();

		// Reset params back after requesting from service
		$document->setType('html');

		// Check the return value.
		if ($return === false)
		{
			/*
			 * The save method enqueued all messages for us, so we just need to
redirect back.
			 */

			// Save the data in the session.
			$this->app->setUserState('com_config.config.global.data',
$data);

			// Save failed, go back to the screen and display a notice.
			$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));
		}

		// Redirect back to com_config display
		$this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
		$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config',
false));

		return true;
	}
}
controller/display.php000064400000005314151165463500011116 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Base Display Controller
 *
 * @since  3.2
 */
class ConfigControllerDisplay extends JControllerBase
{
	/**
	 * Application object - Redeclared for proper typehinting
	 *
	 * @var    JApplicationCms
	 * @since  3.2
	 */
	protected $app;

	/**
	 * Prefix for the view and model classes
	 *
	 * @var    string
	 * @since  3.2
	 */
	public $prefix = 'Config';

	/**
	 * Execute the controller.
	 *
	 * @return  mixed  A rendered view or true
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Get the document object.
		$document = JFactory::getDocument();

		$componentFolder = $this->input->getWord('option',
'com_config');

		if ($this->app->isClient('administrator'))
		{
			$viewName = $this->input->getWord('view',
'application');
		}
		else
		{
			$viewName = $this->input->getWord('view',
'config');
		}

		$viewFormat = $document->getType();
		$layoutName = $this->input->getWord('layout',
'default');

		// Register the layout paths for the view
		$paths = new SplPriorityQueue;

		if ($this->app->isClient('administrator'))
		{
			$paths->insert(JPATH_ADMINISTRATOR . '/components/' .
$componentFolder . '/view/' . $viewName . '/tmpl', 1);
		}
		else
		{
			$paths->insert(JPATH_BASE . '/components/' .
$componentFolder . '/view/' . $viewName . '/tmpl', 1);
		}

		$viewClass  = $this->prefix . 'View' . ucfirst($viewName) .
ucfirst($viewFormat);
		$modelClass = $this->prefix . 'Model' . ucfirst($viewName);

		if (class_exists($viewClass))
		{
			$model     = new $modelClass;
			$component =
$model->getState()->get('component.option');

			// Make sure com_joomlaupdate and com_privacy can only be accessed by
SuperUser
			if (in_array(strtolower($component), array('com_joomlaupdate',
'com_privacy'))
				&& !JFactory::getUser()->authorise('core.admin'))
			{
				$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');

				return;
			}

			// Access check.
			if (!JFactory::getUser()->authorise('core.admin',
$component)
				&& !JFactory::getUser()->authorise('core.options',
$component))
			{
				$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');

				return;
			}

			$view = new $viewClass($model, $paths);

			$view->setLayout($layoutName);

			// Push document object into the view.
			$view->document = $document;

			// Reply for service requests
			if ($viewFormat === 'json')
			{
				$this->app->allowCache(false);
				return $view->render();
			}

			// Render view.
			echo $view->render();
		}

		return true;
	}
}
controller/helper.php000064400000005106151165463500010727 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Helper class for controllers
 *
 * @since  3.2
 */
class ConfigControllerHelper
{
	/**
	 * Method to parse a controller from a url
	 * Defaults to the base controllers and passes an array of options.
	 * $options[0] is the location of the controller which defaults to the
core libraries (referenced as 'j'
	 * and then the named folder within the component entry point file.
	 * $options[1] is the name of the controller file,
	 * $options[2] is the name of the folder found in the component controller
folder for controllers
	 * not prefixed with Config.
	 * Additional options maybe added to parameterize the controller.
	 *
	 * @param   JApplicationBase  $app  An application object
	 *
	 * @return  JController  A JController object
	 *
	 * @since   3.2
	 */
	public function parseController($app)
	{
		$tasks = array();

		if ($task = $app->input->get('task'))
		{
			// Toolbar expects old style but we are using new style
			// Remove when toolbar can handle either directly
			if (strpos($task, '/') !== false)
			{
				$tasks = explode('/', $task);
			}
			else
			{
				$tasks = explode('.', $task);
			}
		}
		elseif ($controllerTask = $app->input->get('controller'))
		{
			// Temporary solution
			if (strpos($controllerTask, '/') !== false)
			{
				$tasks = explode('/', $controllerTask);
			}
			else
			{
				$tasks = explode('.', $controllerTask);
			}
		}

		if (empty($tasks[0]) || $tasks[0] === 'Config')
		{
			$location = 'Config';
		}
		else
		{
			$location = ucfirst(strtolower($tasks[0]));
		}

		if (empty($tasks[1]))
		{
			$activity = 'Display';
		}
		else
		{
			$activity = ucfirst(strtolower($tasks[1]));
		}

		$view = '';

		if (!empty($tasks[2]))
		{
			$view = ucfirst(strtolower($tasks[2]));
		}

		// Some special handling for com_config administrator
		$option = $app->input->get('option');

		if ($option === 'com_config' &&
$app->isClient('administrator'))
		{
			$component = $app->input->get('component');

			if (!empty($component))
			{
				$view = 'Component';
			}
			elseif ($option === 'com_config')
			{
				$view = 'Application';
			}
		}

		$controllerName = $location . 'Controller' . $view . $activity;

		if (!class_exists($controllerName))
		{
			return false;
		}

		$controller = new $controllerName;
		$controller->options = array();
		$controller->options = $tasks;

		return $controller;
	}
}
controller/modules/cancel.php000064400000003242151165463500012344
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Cancel Controller for module editing
 *
 * @package     Joomla.Site
 * @subpackage  com_config
 * @since       3.2
 */
class ConfigControllerModulesCancel extends ConfigControllerCanceladmin
{
	/**
	 * Method to cancel module editing.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check if the user is authorized to do this.
		$user = JFactory::getUser();

		if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $this->input->get('id')))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
			$this->app->redirect('index.php');
		}

		$this->context = 'com_config.config.global';

		// Get returnUri
		$returnUri = $this->input->post->get('return', null,
'base64');

		if (!empty($returnUri))
		{
			$this->redirect = base64_decode(urldecode($returnUri));
		}
		else
		{
			$this->redirect = JUri::base();
		}

		$id = $this->input->getInt('id');

		// Access backend com_module
		JLoader::register('ModulesControllerModule',
JPATH_ADMINISTRATOR .
'/components/com_modules/controllers/module.php');
		JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR .
'/components/com_modules/views/module/view.json.php');
		JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');

		$cancelClass = new ModulesControllerModule;

		$cancelClass->cancel($id);

		parent::execute();
	}
}
controller/modules/display.php000064400000006154151165463500012571
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Display Controller for module editing
 *
 * @package     Joomla.Site
 * @subpackage  com_config
 * @since       3.2
 */
class ConfigControllerModulesDisplay extends ConfigControllerDisplay
{
	/**
	 * Method to display module editing.
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since   3.2
	 */
	public function execute()
	{

		// Get the application
		$app = $this->getApplication();

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

		$viewName     = $this->input->getWord('view',
'modules');
		$viewFormat   = $document->getType();
		$layoutName   = $this->input->getWord('layout',
'default');
		$returnUri    = $this->input->get->get('return', null,
'base64');

		// Construct redirect URI
		if (!empty($returnUri))
		{
			$redirect = base64_decode(urldecode($returnUri));

			// Don't redirect to an external URL.
			if (!JUri::isInternal($redirect))
			{
				$redirect = JUri::base();
			}
		}
		else
		{
			$redirect = JUri::base();
		}

		// Access backend com_module
		JLoader::register('ModulesController', JPATH_ADMINISTRATOR .
'/components/com_modules/controller.php');
		JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR .
'/components/com_modules/views/module/view.json.php');
		JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');

		$displayClass = new ModulesController;

		// Get the parameters of the module with Id
		$document->setType('json');

		// Execute backend controller
		if (!($serviceData = json_decode($displayClass->display(), true)))
		{
			$app->redirect($redirect);
		}

		// Reset params back after requesting from service
		$document->setType('html');
		$app->input->set('view', $viewName);

		// Register the layout paths for the view
		$paths = new SplPriorityQueue;
		$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');

		$viewClass  = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
		$modelClass = 'ConfigModel' . ucfirst($viewName);

		if (class_exists($viewClass))
		{
			$model = new $modelClass;

			// Access check.
			$user = JFactory::getUser();

			if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $serviceData['id']))
			{
				$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
				$app->redirect($redirect);
			}

			// Need to add module name to the state of model
			$model->getState()->set('module.name',
$serviceData['module']);

			$view = new $viewClass($model, $paths);

			$view->setLayout($layoutName);

			// Push document object into the view.
			$view->document = $document;

			// Load form and bind data
			$form = $model->getForm();

			if ($form)
			{
				$form->bind($serviceData);
			}

			// Set form and data to the view
			$view->form = &$form;
			$view->item = &$serviceData;

			// Render view.
			echo $view->render();
		}

		return true;
	}
}
controller/modules/save.php000064400000006232151165463500012057
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Save Controller for module editing
 *
 * @package     Joomla.Site
 * @subpackage  com_config
 * @since       3.2
 */
class ConfigControllerModulesSave extends JControllerBase
{
	/**
	 * Method to save module editing.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			$this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
			$this->app->redirect('index.php');
		}

		// Check if the user is authorized to do this.
		$user = JFactory::getUser();

		if (!$user->authorise('module.edit.frontend',
'com_modules.module.' . $this->input->get('id')))
		{
			$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');
			$this->app->redirect('index.php');
		}

		// Set FTP credentials, if given.
		JClientHelper::setCredentialsFromRequest('ftp');

		// Get submitted module id
		$moduleId = '&id=' .
$this->input->get('id');

		// Get returnUri
		$returnUri = $this->input->post->get('return', null,
'base64');
		$redirect = '';

		if (!empty($returnUri))
		{
			$redirect = '&return=' . $returnUri;
		}

		// Access backend com_modules to be done
		JLoader::register('ModulesControllerModule',
JPATH_ADMINISTRATOR .
'/components/com_modules/controllers/module.php');
		JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR .
'/components/com_modules/models/module.php');

		$controllerClass = new ModulesControllerModule;

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

		// Set backend required params
		$document->setType('json');

		// Execute backend controller
		$return = $controllerClass->save();

		// Reset params back after requesting from service
		$document->setType('html');

		// Check the return value.
		if ($return === false)
		{
			// Save the data in the session.
			$data = $this->input->post->get('jform', array(),
'array');

			$this->app->setUserState('com_config.modules.global.data',
$data);

			// Save failed, go back to the screen and display a notice.
			$this->app->enqueueMessage(JText::_('JERROR_SAVE_FAILED'));
			$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules'
. $moduleId . $redirect, false));
		}

		// Redirect back to com_config display
		$this->app->enqueueMessage(JText::_('COM_CONFIG_MODULES_SAVE_SUCCESS'));

		// Set the redirect based on the task.
		switch ($this->options[3])
		{
			case 'apply':
				$this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules'
. $moduleId . $redirect, false));
				break;

			case 'save':
			default:

				if (!empty($returnUri))
				{
					$redirect = base64_decode(urldecode($returnUri));

					// Don't redirect to an external URL.
					if (!JUri::isInternal($redirect))
					{
						$redirect = JUri::base();
					}
				}
				else
				{
					$redirect = JUri::base();
				}

				$this->app->redirect($redirect);
				break;
		}
	}
}
controller/templates/display.php000064400000005117151165463500013115
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Display Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerTemplatesDisplay extends ConfigControllerDisplay
{
	/**
	 * Method to display global configuration.
	 *
	 * @return  boolean  True on success, false on failure.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Get the application
		$app = $this->getApplication();

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

		$viewName     = $this->input->getWord('view',
'templates');
		$viewFormat   = $document->getType();
		$layoutName   = $this->input->getWord('layout',
'default');

		// Access backend com_config
		JLoader::register('TemplatesController', JPATH_ADMINISTRATOR .
'/components/com_templates/controller.php');
		JLoader::register('TemplatesViewStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/views/style/view.json.php');
		JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/models/style.php');

		$displayClass = new TemplatesController;

		// Set backend required params
		$document->setType('json');
		$this->input->set('id',
$app->getTemplate(true)->id);

		// Execute backend controller
		$serviceData = json_decode($displayClass->display(), true);

		// Reset params back after requesting from service
		$document->setType('html');
		$this->input->set('view', $viewName);

		// Register the layout paths for the view
		$paths = new SplPriorityQueue;
		$paths->insert(JPATH_COMPONENT . '/view/' . $viewName .
'/tmpl', 'normal');

		$viewClass  = 'ConfigView' . ucfirst($viewName) .
ucfirst($viewFormat);
		$modelClass = 'ConfigModel' . ucfirst($viewName);

		if (class_exists($viewClass))
		{
			if ($viewName !== 'close')
			{
				$model = new $modelClass;

				// Access check.
				if (!JFactory::getUser()->authorise('core.admin',
$model->getState('component.option')))
				{
					$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'),
'error');

					return;
				}
			}

			$view = new $viewClass($model, $paths);

			$view->setLayout($layoutName);

			// Push document object into the view.
			$view->document = $document;

			// Load form and bind data
			$form = $model->getForm();

			if ($form)
			{
				$form->bind($serviceData);
			}

			// Set form and data to the view
			$view->form = &$form;

			// Render view.
			echo $view->render();
		}

		return true;
	}
}
controller/templates/save.php000064400000004670151165463500012411
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Save Controller for global configuration
 *
 * @since  3.2
 */
class ConfigControllerTemplatesSave extends JControllerBase
{
	/**
	 * Method to save global configuration.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.2
	 */
	public function execute()
	{
		// Check for request forgeries.
		if (!JSession::checkToken())
		{
			JFactory::getApplication()->redirect('index.php',
JText::_('JINVALID_TOKEN'));
		}

		// Check if the user is authorized to do this.
		if (!JFactory::getUser()->authorise('core.admin'))
		{
			JFactory::getApplication()->redirect('index.php',
JText::_('JERROR_ALERTNOAUTHOR'));

			return;
		}

		// Set FTP credentials, if given.
		JClientHelper::setCredentialsFromRequest('ftp');

		$app = JFactory::getApplication();

		// Access backend com_templates
		JLoader::register('TemplatesControllerStyle',
JPATH_ADMINISTRATOR .
'/components/com_templates/controllers/style.php');
		JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/models/style.php');
		JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR .
'/components/com_templates/tables/style.php');
		$controllerClass = new TemplatesControllerStyle;

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

		// Set backend required params
		$document->setType('json');
		$this->input->set('id',
$app->getTemplate(true)->id);

		// Execute backend controller
		$return = $controllerClass->save();

		// Reset params back after requesting from service
		$document->setType('html');

		// Check the return value.
		if ($return === false)
		{
			// Save the data in the session.
			$app->setUserState('com_config.config.global.data', $data);

			// Save failed, go back to the screen and display a notice.
			$message = JText::sprintf('JERROR_SAVE_FAILED');

			$app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates',
false), $message, 'error');

			return false;
		}

		// Set the success message.
		$message = JText::_('COM_CONFIG_SAVE_SUCCESS');

		// Redirect back to com_config display
		$app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates',
false), $message);

		return true;
	}
}
model/cms.php000064400000014075151165463500007154 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

/**
 * Prototype admin model.
 *
 * @since  3.2
 */
abstract class ConfigModelCms extends JModelDatabase
{
	/**
	 * The model (base) name
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $name;

	/**
	 * The URL option for the component.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $option = null;

	/**
	 * The prefix to use with controller messages.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $text_prefix = null;

	/**
	 * Indicates if the internal state has been set
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $__state_set = null;

	/**
	 * Constructor
	 *
	 * @param   array  $config  An array of configuration options (name,
state, dbo, table_path, ignore_request).
	 *
	 * @since   3.2
	 * @throws  Exception
	 */
	public function __construct($config = array())
	{
		// Guess the option from the class name (Option)Model(View).
		if (empty($this->option))
		{
			$r = null;

			if (!preg_match('/(.*)Model/i', get_class($this), $r))
			{
				throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'),
500);
			}

			$this->option = 'com_' . strtolower($r[1]);
		}

		// Set the view name
		if (empty($this->name))
		{
			if (array_key_exists('name', $config))
			{
				$this->name = $config['name'];
			}
			else
			{
				$this->name = $this->getName();
			}
		}

		// Set the model state
		if (array_key_exists('state', $config))
		{
			$this->state = $config['state'];
		}
		else
		{
			$this->state = new Registry;
		}

		// Set the model dbo
		if (array_key_exists('dbo', $config))
		{
			$this->db = $config['dbo'];
		}

		// Register the paths for the form
		$paths = $this->registerTablePaths($config);

		// Set the internal state marker - used to ignore setting state from the
request
		if (!empty($config['ignore_request']))
		{
			$this->__state_set = true;
		}

		// Set the clean cache event
		if (isset($config['event_clean_cache']))
		{
			$this->event_clean_cache = $config['event_clean_cache'];
		}
		elseif (empty($this->event_clean_cache))
		{
			$this->event_clean_cache = 'onContentCleanCache';
		}

		$state = new Registry($config);

		parent::__construct($state);
	}

	/**
	 * Method to get the model name
	 *
	 * The model name. By default parsed using the classname or it can be set
	 * by passing a $config['name'] in the class constructor
	 *
	 * @return  string  The name of the model
	 *
	 * @since   3.2
	 * @throws  Exception
	 */
	public function getName()
	{
		if (empty($this->name))
		{
			$r = null;

			if (!preg_match('/Model(.*)/i', get_class($this), $r))
			{
				throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'),
500);
			}

			$this->name = strtolower($r[1]);
		}

		return $this->name;
	}

	/**
	 * Method to get model state variables
	 *
	 * @return  object  The property where specified, the state object where
omitted
	 *
	 * @since   3.2
	 */
	public function getState()
	{
		if (!$this->__state_set)
		{
			// Protected method to auto-populate the model state.
			$this->populateState();

			// Set the model state set flag to true.
			$this->__state_set = true;
		}

		return $this->state;
	}

	/**
	 * Method to register paths for tables
	 *
	 * @param   array  $config  Configuration array
	 *
	 * @return  object  The property where specified, the state object where
omitted
	 *
	 * @since   3.2
	 */
	public function registerTablePaths($config = array())
	{
		// Set the default view search path
		if (array_key_exists('table_path', $config))
		{
			$this->addTablePath($config['table_path']);
		}
		elseif (defined('JPATH_COMPONENT_ADMINISTRATOR'))
		{
			// Register the paths for the form
			$paths = new SplPriorityQueue;
			$paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/table',
'normal');

			// For legacy purposes. Remove for 4.0
			$paths->insert(JPATH_COMPONENT_ADMINISTRATOR . '/tables',
'normal');
		}
	}

	/**
	 * Clean the cache
	 *
	 * @param   string   $group     The cache group
	 * @param   integer  $clientId  The ID of the client
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	protected function cleanCache($group = null, $clientId = 0)
	{
		$conf = JFactory::getConfig();
		$dispatcher = JEventDispatcher::getInstance();

		$options = array(
			'defaultgroup' => $group ?: (isset($this->option) ?
$this->option :
JFactory::getApplication()->input->get('option')),
			'cachebase' => $clientId ? JPATH_ADMINISTRATOR .
'/cache' : $conf->get('cache_path', JPATH_SITE .
'/cache'));

		$cache = JCache::getInstance('callback', $options);
		$cache->clean();

		// Trigger the onContentCleanCache event.
		$dispatcher->trigger($this->event_clean_cache, $options);
	}

	/**
	 * Method to auto-populate the model state.
	 *
	 * This method should only be called once per instantiation and is
designed
	 * to be called on the first call to the getState() method unless the
model
	 * configuration flag to ignore the request is set.
	 *
	 * @return  void
	 *
	 * @note    Calling getState in this method will result in recursion.
	 * @since   3.2
	 */
	protected function populateState()
	{
		$this->loadState();
	}

	/**
	 * Method to test whether a record can be deleted.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to delete the record. Defaults to the
permission set in the component.
	 *
	 * @since   3.2
	 */
	protected function canDelete($record)
	{
		if (empty($record->id) || $record->published != -2)
		{
			return false;
		}

		return JFactory::getUser()->authorise('core.delete',
$this->option);
	}

	/**
	 * Method to test whether a record can have its state changed.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to change the state of the record.
Defaults to the permission set in the component.
	 *
	 * @since   3.2
	 */
	protected function canEditState($record)
	{
		return JFactory::getUser()->authorise('core.edit.state',
$this->option);
	}
}
model/config.php000064400000001646151165463500007637 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Model for the global configuration
 *
 * @since  3.2
 */
class ConfigModelConfig extends ConfigModelForm
{
	/**
	 * Method to get a form object.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  mixed	A JForm object on success, false on failure
	 *
	 * @since	3.2
	 */
	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_config.config',
'config', array('control' => 'jform',
'load_data' => $loadData));

		if (empty($form))
		{
			return false;
		}

		return $form;
	}
}
model/form/config.xml000064400000005261151165463500010610 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<form>
	<fieldset
		name="metadata"
		label="COM_CONFIG_METADATA_SETTINGS">
		<field
			name="MetaDesc"
			type="textarea"
			label="COM_CONFIG_FIELD_METADESC_LABEL"
			description="COM_CONFIG_FIELD_METADESC_DESC"
			filter="string"
			cols="60"
			rows="3" 
		/>

		<field
			name="MetaKeys"
			type="textarea"
			label="COM_CONFIG_FIELD_METAKEYS_LABEL"
			description="COM_CONFIG_FIELD_METAKEYS_DESC"
			filter="string"
			cols="60"
			rows="3" 
		/>

		<field
			name="MetaRights"
			type="textarea"
			label="JFIELD_META_RIGHTS_LABEL"
			description="JFIELD_META_RIGHTS_DESC"
			filter="string"
			cols="60"
			rows="2"
		/>

	</fieldset>

	<fieldset
		name="seo"
		label="CONFIG_SEO_SETTINGS_LABEL">
		<field
			name="sef"
			type="radio"
			label="COM_CONFIG_FIELD_SEF_URL_LABEL"
			description="COM_CONFIG_FIELD_SEF_URL_DESC"
			default="1"
			class="btn-group"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="sitename_pagetitles"
			type="list"
			label="COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL"
			description="COM_CONFIG_FIELD_SITENAME_PAGETITLES_DESC"
			default="0"
			filter="integer"
			>
			<option
value="2">COM_CONFIG_FIELD_VALUE_AFTER</option>
			<option
value="1">COM_CONFIG_FIELD_VALUE_BEFORE</option>
			<option value="0">JNO</option>
		</field>

	</fieldset>	

	<fieldset
		name="site"
		label="CONFIG_SITE_SETTINGS_LABEL">

		<field
			name="sitename"
			type="text"
			label="COM_CONFIG_FIELD_SITE_NAME_LABEL"
			description="COM_CONFIG_FIELD_SITE_NAME_DESC"
			required="true"
			filter="string"
			size="50" 
		/>

		<field
			name="offline"
			type="radio"
			label="COM_CONFIG_FIELD_SITE_OFFLINE_LABEL"
			description="COM_CONFIG_FIELD_SITE_OFFLINE_DESC"
			default="0"
			class="btn-group"
			filter="integer"
			>
			<option value="1">JYES</option>
			<option value="0">JNO</option>
		</field>

		<field
			name="access"
			type="accesslevel"
			label="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_ACCESS_LEVEL_DESC"
			default="1"
			filter="integer" 
		/>

		<field
			name="list_limit"
			type="list"
			label="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_LABEL"
			description="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_DESC"
			default="20"
			filter="integer"
			>
			<option value="5">J5</option>
			<option value="10">J10</option>
			<option value="15">J15</option>
			<option value="20">J20</option>
			<option value="25">J25</option>
			<option value="30">J30</option>
			<option value="50">J50</option>
			<option value="100">J100</option>
		</field>
		
	</fieldset>

	<fieldset>
		<field
			name="asset_id"
			type="hidden" 
		/>
	</fieldset>
</form>
model/form/modules.xml000064400000005704151165463500011015 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<form>
	<fieldset>
		<field 
			name="id" 
			type="number"
			label="JGLOBAL_FIELD_ID_LABEL"
			description="JGLOBAL_FIELD_ID_DESC"
			default="0"
			readonly="true"
		/>

		<field
			name="title" 
			type="text"
			label="JGLOBAL_TITLE"
			description="COM_MODULES_FIELD_TITLE_DESC"
			maxlength="100"
			required="true"
			size="35"
		/>

		<field 
			name="note" 
			type="text"
			label="COM_MODULES_FIELD_NOTE_LABEL"
			description="COM_MODULES_FIELD_NOTE_DESC"
			maxlength="255"
			size="35"
		/>

		<field 
			name="module" 
			type="hidden"
			label="COM_MODULES_FIELD_MODULE_LABEL"
			description="COM_MODULES_FIELD_MODULE_DESC"
			readonly="readonly"
			size="20"
		/>

		<field 
			name="showtitle" 
			type="radio"
			label="COM_MODULES_FIELD_SHOWTITLE_LABEL"
			description="COM_MODULES_FIELD_SHOWTITLE_DESC"
			class="btn-group btn-group-yesno"
			default="1"
			size="1"
			>
			<option value="1">JSHOW</option>
			<option value="0">JHIDE</option>
		</field>

		<field 
			name="published" 
			type="radio"
			label="JSTATUS"
			description="COM_MODULES_FIELD_PUBLISHED_DESC"
			class="btn-group"
			default="1"
			size="1"
			>
			<option value="1">JPUBLISHED</option>
			<option value="0">JUNPUBLISHED</option>
			<option value="-2">JTRASHED</option>
		</field>

		<field
			name="publish_up"
			type="calendar"
			label="COM_MODULES_FIELD_PUBLISH_UP_LABEL"
			description="COM_MODULES_FIELD_PUBLISH_UP_DESC"
			filter="user_utc"
			class="input-medium"
			translateformat="true"
			showtime="true"
			size="22"
		/>

		<field
			name="publish_down"
			type="calendar"
			label="COM_MODULES_FIELD_PUBLISH_DOWN_LABEL"
			description="COM_MODULES_FIELD_PUBLISH_DOWN_DESC"
			filter="user_utc"
			class="input-medium"
			translateformat="true"
			showtime="true"
			size="22"
		/>

		<field 
			name="client_id" 
			type="hidden"
			label="COM_MODULES_FIELD_CLIENT_ID_LABEL"
			description="COM_MODULES_FIELD_CLIENT_ID_DESC"
			readonly="true"
			size="1"
		/>

		<field 
			name="position" 
			type="moduleposition"
			label="COM_MODULES_FIELD_POSITION_LABEL"
			description="COM_MODULES_FIELD_POSITION_DESC"
			default=""
			maxlength="50"
		/>

		<field 
			name="access" 
			type="accesslevel"
			label="JFIELD_ACCESS_LABEL"
			description="JFIELD_ACCESS_DESC"
			size="1"
		/>

		<field 
			name="ordering" 
			type="moduleorder"
			label="JFIELD_ORDERING_LABEL"
			description="JFIELD_ORDERING_DESC"
		/>

		<field 
			name="content" 
			type="editor"
			label="COM_MODULES_FIELD_CONTENT_LABEL"
			description="COM_MODULES_FIELD_CONTENT_DESC"
			buttons="true"
			class="inputbox"
			filter="JComponentHelper::filterText"
			hide="readmore,pagebreak"
		/>

		<field 
			name="language" 
			type="contentlanguage"
			label="JFIELD_LANGUAGE_LABEL"
			description="JFIELD_MODULE_LANGUAGE_DESC"
			>
			<option value="*">JALL</option>
		</field>

		<field name="assignment" type="hidden" />

		<field name="assigned" type="hidden" />
	</fieldset>
</form>
model/form/modules_advanced.xml000064400000002050151165463500012631
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="params">
		<fieldset
			name="advanced">

			<field
				name="module_tag"
				type="moduletag"
				label="COM_MODULES_FIELD_MODULE_TAG_LABEL"
				description="COM_MODULES_FIELD_MODULE_TAG_DESC"
				default="div"
				validate="options"
			/>

			<field
				name="bootstrap_size"
				type="integer"
				label="COM_MODULES_FIELD_BOOTSTRAP_SIZE_LABEL"
				description="COM_MODULES_FIELD_BOOTSTRAP_SIZE_DESC"
				first="0"
				last="12"
				step="1"
			/>

			<field
				name="header_tag"
				type="headertag"
				label="COM_MODULES_FIELD_HEADER_TAG_LABEL"
				description="COM_MODULES_FIELD_HEADER_TAG_DESC"
				default="h3"
				validate="options"
			/>

			<field
				name="header_class"
				type="text"
				label="COM_MODULES_FIELD_HEADER_CLASS_LABEL"
				description="COM_MODULES_FIELD_HEADER_CLASS_DESC"
			/>

			<field
				name="style"
				type="chromestyle"
				label="COM_MODULES_FIELD_MODULE_STYLE_LABEL"
				description="COM_MODULES_FIELD_MODULE_STYLE_DESC"
			/>
		</fieldset>
	</fields>
</form>
model/form/templates.xml000064400000001576151165463500011346
0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fieldset>
		<field
			name="id"
			type="number"
			label="JGLOBAL_FIELD_ID_LABEL"
			description="JGLOBAL_FIELD_ID_DESC"
			id="id"
			default="0"
			readonly="true"
			class="readonly"
		/>

		<field
			name="template"
			type="text"
			label="COM_TEMPLATES_FIELD_TEMPLATE_LABEL"
			description="COM_TEMPLATES_FIELD_TEMPLATE_DESC"
			class="readonly"
			size="30"
			readonly="true" 
		/>

		<field
			name="client_id"
			type="hidden"
			label="COM_TEMPLATES_FIELD_CLIENT_LABEL"
			description="COM_TEMPLATES_FIELD_CLIENT_DESC"
			class="readonly"
			default="0"
			readonly="true" 
		/>

		<field
			name="title"
			type="text"
			label="COM_TEMPLATES_FIELD_TITLE_LABEL"
			description="COM_TEMPLATES_FIELD_TITLE_DESC"
			class="inputbox"
			size="50"
			required="true" 
		/>

		<field name="assigned" type="hidden" />

	</fieldset>
</form>
model/form.php000064400000021121151165463500007323 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
 * Prototype form model.
 *
 * @see    JForm
 * @see    JFormField
 * @see    JFormRule
 * @since  3.2
 */
abstract class ConfigModelForm extends ConfigModelCms
{
	/**
	 * Array of form objects.
	 *
	 * @var    array
	 * @since  3.2
	 */
	protected $forms = array();

	/**
	 * Method to checkin a row.
	 *
	 * @param   integer  $pk  The numeric id of the primary key.
	 *
	 * @return  boolean  False on failure or error, true otherwise.
	 *
	 * @since   3.2
	 * @throws  RuntimeException
	 */
	public function checkin($pk = null)
	{
		// Only attempt to check the row in if it exists.
		if ($pk)
		{
			$user = JFactory::getUser();

			// Get an instance of the row to checkin.
			$table = $this->getTable();

			if (!$table->load($pk))
			{
				throw new RuntimeException($table->getError());
			}

			// Check if this is the user has previously checked out the row.
			if ($table->checked_out > 0 && $table->checked_out !=
$user->get('id') &&
!$user->authorise('core.admin', 'com_checkin'))
			{
				throw new RuntimeException($table->getError());
			}

			// Attempt to check the row in.
			if (!$table->checkin($pk))
			{
				throw new RuntimeException($table->getError());
			}
		}

		return true;
	}

	/**
	 * Method to check-out a row for editing.
	 *
	 * @param   integer  $pk  The numeric id of the primary key.
	 *
	 * @return  boolean  False on failure or error, true otherwise.
	 *
	 * @since   3.2
	 */
	public function checkout($pk = null)
	{
		// Only attempt to check the row in if it exists.
		if ($pk)
		{
			$user = JFactory::getUser();

			// Get an instance of the row to checkout.
			$table = $this->getTable();

			if (!$table->load($pk))
			{
				throw new RuntimeException($table->getError());
			}

			// Check if this is the user having previously checked out the row.
			if ($table->checked_out > 0 && $table->checked_out !=
$user->get('id'))
			{
				throw new
RuntimeException(JText::_('JLIB_APPLICATION_ERROR_CHECKOUT_USER_MISMATCH'));
			}

			// Attempt to check the row out.
			if (!$table->checkout($user->get('id'), $pk))
			{
				throw new RuntimeException($table->getError());
			}
		}

		return true;
	}

	/**
	 * Abstract method for getting the form from the model.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  mixed  A JForm object on success, false on failure
	 *
	 * @since   3.2
	 */
	abstract public function getForm($data = array(), $loadData = true);

	/**
	 * Method to get a form object.
	 *
	 * @param   string   $name     The name of the form.
	 * @param   string   $source   The form source. Can be XML string if file
flag is set to false.
	 * @param   array    $options  Optional array of options for the form
creation.
	 * @param   boolean  $clear    Optional argument to force load a new form.
	 * @param   string   $xpath    An optional xpath to search for the fields.
	 *
	 * @return  mixed  JForm object on success, False on error.
	 *
	 * @see     JForm
	 * @since   3.2
	 */
	protected function loadForm($name, $source = null, $options = array(),
$clear = false, $xpath = false)
	{
		// Handle the optional arguments.
		$options['control'] = ArrayHelper::getValue($options,
'control', false);

		// Create a signature hash.
		$hash = sha1($source . serialize($options));

		// Check if we can use a previously loaded form.
		if (isset($this->_forms[$hash]) && !$clear)
		{
			return $this->_forms[$hash];
		}

		// Get the form.
		// Register the paths for the form -- failing here
		$paths = new SplPriorityQueue;
		$paths->insert(JPATH_COMPONENT_ADMINISTRATOR .
'/model/form', 'normal');
		$paths->insert(JPATH_COMPONENT_ADMINISTRATOR .
'/model/field', 'normal');
		$paths->insert(JPATH_COMPONENT . '/model/form',
'normal');
		$paths->insert(JPATH_COMPONENT . '/model/field',
'normal');
		$paths->insert(JPATH_COMPONENT . '/model/rule',
'normal');

		// Legacy support to be removed in 4.0.  -- failing here
		$paths->insert(JPATH_COMPONENT . '/models/forms',
'normal');
		$paths->insert(JPATH_COMPONENT . '/models/fields',
'normal');
		$paths->insert(JPATH_COMPONENT . '/models/rules',
'normal');

		// Solution until JForm supports splqueue
		JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
		JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
		JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR .
'/model/form');
		JForm::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR .
'/model/field');
		JForm::addFormPath(JPATH_COMPONENT . '/model/form');
		JForm::addFieldPath(JPATH_COMPONENT . '/model/field');

		try
		{
			$form = JForm::getInstance($name, $source, $options, false, $xpath);

			if (isset($options['load_data']) &&
$options['load_data'])
			{
				// Get the data for the form.
				$data = $this->loadFormData();
			}
			else
			{
				$data = array();
			}

			// Allow for additional modification of the form, and events to be
triggered.
			// We pass the data because plugins may require it.
			$this->preprocessForm($form, $data);

			// Load the data into the form after the plugins have operated.
			$form->bind($data);
		}
		catch (Exception $e)
		{
			JFactory::getApplication()->enqueueMessage($e->getMessage());

			return false;
		}

		// Store the form for later.
		$this->_forms[$hash] = $form;

		return $form;
	}

	/**
	 * Method to get the data that should be injected in the form.
	 *
	 * @return  array    The default data is an empty array.
	 *
	 * @since   3.2
	 */
	protected function loadFormData()
	{
		return array();
	}

	/**
	 * Method to allow derived classes to preprocess the data.
	 *
	 * @param   string  $context  The context identifier.
	 * @param   mixed   &$data    The data to be processed. It gets
altered directly.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	protected function preprocessData($context, &$data)
	{
		// Get the dispatcher and load the users plugins.
		$dispatcher = JEventDispatcher::getInstance();
		JPluginHelper::importPlugin('content');

		// Trigger the data preparation event.
		$results = $dispatcher->trigger('onContentPrepareData',
array($context, $data));

		// Check for errors encountered while preparing the data.
		if (count($results) > 0 && in_array(false, $results, true))
		{
			JFactory::getApplication()->enqueueMessage($dispatcher->getError(),
'error');
		}
	}

	/**
	 * Method to allow derived classes to preprocess the form.
	 *
	 * @param   JForm   $form   A JForm object.
	 * @param   mixed   $data   The data expected for the form.
	 * @param   string  $group  The name of the plugin group to import
(defaults to "content").
	 *
	 * @return  void
	 *
	 * @see     JFormField
	 * @since   3.2
	 * @throws  Exception if there is an error in the form event.
	 */
	protected function preprocessForm(JForm $form, $data, $group =
'content')
	{
		// Import the appropriate plugin group.
		JPluginHelper::importPlugin($group);

		// Get the dispatcher.
		$dispatcher = JEventDispatcher::getInstance();

		// Trigger the form preparation event.
		$results = $dispatcher->trigger('onContentPrepareForm',
array($form, $data));

		// Check for errors encountered while preparing the form.
		if (count($results) && in_array(false, $results, true))
		{
			// Get the last error.
			$error = $dispatcher->getError();

			if (!($error instanceof Exception))
			{
				throw new Exception($error);
			}
		}
	}

	/**
	 * Method to validate the form data.
	 *
	 * @param   JForm   $form   The form to validate against.
	 * @param   array   $data   The data to validate.
	 * @param   string  $group  The name of the field group to validate.
	 *
	 * @return  mixed  Array of filtered data if valid, false otherwise.
	 *
	 * @see     JFormRule
	 * @see     JFilterInput
	 * @since   3.2
	 */
	public function validate($form, $data, $group = null)
	{
		// Filter and validate the form data.
		$data   = $form->filter($data);
		$return = $form->validate($data, $group);

		// Check for an error.
		if ($return instanceof Exception)
		{
			JFactory::getApplication()->enqueueMessage($return->getMessage(),
'error');

			return false;
		}

		// Check the validation results.
		if ($return === false)
		{
			// Get the validation messages from the form.
			foreach ($form->getErrors() as $message)
			{
				if ($message instanceof Exception)
				{
					$message = $message->getMessage();
				}

				JFactory::getApplication()->enqueueMessage($message,
'error');
			}

			return false;
		}

		return $data;
	}
}
model/modules.php000064400000015037151165463500010041 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Config Module model.
 *
 * @since  3.2
 */
class ConfigModelModules extends ConfigModelForm
{
	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	protected function populateState()
	{
		$app = JFactory::getApplication('administrator');

		// Load the User state.
		$pk = $app->input->getInt('id');

		$state = $this->loadState();

		$state->set('module.id', $pk);

		$this->setState($state);
	}

	/**
	 * Method to get the record form.
	 *
	 * @param   array    $data      Data for the form.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  JForm  A JForm object on success, false on failure
	 *
	 * @since   3.2
	 */
	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_config.modules',
'modules', array('control' => 'jform',
'load_data' => $loadData));

		if (empty($form))
		{
			return false;
		}

		$form->setFieldAttribute('position', 'client', 
'site');

		return $form;
	}

	/**
	 * Method to preprocess the form
	 *
	 * @param   JForm   $form   A form object.
	 * @param   mixed   $data   The data expected for the form.
	 * @param   string  $group  The name of the plugin group to import
(defaults to "content").
	 *
	 * @return  void
	 *
	 * @since   3.2
	 * @throws  Exception if there is an error loading the form.
	 */
	protected function preprocessForm(JForm $form, $data, $group =
'content')
	{
		jimport('joomla.filesystem.path');

		$lang     = JFactory::getLanguage();

		$module = $this->getState()->get('module.name');
		$basePath = JPATH_BASE;

		$formFile = JPath::clean($basePath . '/modules/' . $module .
'/' . $module . '.xml');

		// Load the core and/or local language file(s).
		$lang->load($module, $basePath, null, false, true)
			||	 $lang->load($module, $basePath . '/modules/' . $module,
null, false, true);

		if (file_exists($formFile))
		{
			// Get the module form.
			if (!$form->loadFile($formFile, false, '//config'))
			{
				throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
			}

			// Attempt to load the xml file.
			if (!$xml = simplexml_load_file($formFile))
			{
				throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
			}
		}

		// Load the default advanced params
		JForm::addFormPath(JPATH_BASE .
'/components/com_config/model/form');
		$form->loadFile('modules_advanced', false);

		// Trigger the default form events.
		parent::preprocessForm($form, $data, $group);
	}

	/**
	 * Method to get list of module positions in current template
	 *
	 * @return  array
	 *
	 * @since   3.2
	 */
	public function getPositions()
	{
		$lang         = JFactory::getLanguage();
		$templateName = JFactory::getApplication()->getTemplate();

		// Load templateDetails.xml file
		$path = JPath::clean(JPATH_BASE . '/templates/' . $templateName
. '/templateDetails.xml');
		$currentTemplatePositions = array();

		if (file_exists($path))
		{
			$xml = simplexml_load_file($path);

			if (isset($xml->positions[0]))
			{
				// Load language files
				$lang->load('tpl_' . $templateName . '.sys',
JPATH_BASE, null, false, true)
				||	$lang->load('tpl_' . $templateName . '.sys',
JPATH_BASE . '/templates/' . $templateName, null, false, true);

				foreach ($xml->positions[0] as $position)
				{
					$value = (string) $position;
					$text = preg_replace('/[^a-zA-Z0-9_\-]/', '_',
'TPL_' . strtoupper($templateName) . '_POSITION_' .
strtoupper($value));

					// Construct list of positions
					$currentTemplatePositions[] = self::createOption($value,
JText::_($text) . ' [' . $value . ']');
				}
			}
		}

		$templateGroups = array();

		// Add an empty value to be able to deselect a module position
		$option = self::createOption();
		$templateGroups[''] = self::createOptionGroup('',
array($option));

		$templateGroups[$templateName] = self::createOptionGroup($templateName,
$currentTemplatePositions);

		// Add custom position to options
		$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');

		$editPositions   = true;
		$customPositions = self::getActivePositions(0, $editPositions);
		$templateGroups[$customGroupText] =
self::createOptionGroup($customGroupText, $customPositions);

		return $templateGroups;
	}

	/**
	 * Get a list of modules positions
	 *
	 * @param   integer  $clientId       Client ID
	 * @param   boolean  $editPositions  Allow to edit the positions
	 *
	 * @return  array  A list of positions
	 *
	 * @since   3.6.3
	 */
	public static function getActivePositions($clientId, $editPositions =
false)
	{
		$db = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('DISTINCT position')
			->from($db->quoteName('#__modules'))
			->where($db->quoteName('client_id') . ' = ' .
(int) $clientId)
			->order($db->quoteName('position'));

		$db->setQuery($query);

		try
		{
			$positions = $db->loadColumn();
			$positions = is_array($positions) ? $positions : array();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());

			return;
		}

		// Build the list
		$options = array();

		foreach ($positions as $position)
		{
			if (!$position && !$editPositions)
			{
				$options[] = JHtml::_('select.option', 'none',
':: ' . JText::_('JNONE') . ' ::');
			}
			else
			{
				$options[] = JHtml::_('select.option', $position, $position);
			}
		}

		return $options;
	}

	/**
	 * Create and return a new Option
	 *
	 * @param   string  $value  The option value [optional]
	 * @param   string  $text   The option text [optional]
	 *
	 * @return  object  The option as an object (stdClass instance)
	 *
	 * @since   3.6.3
	 */
	private static function createOption($value = '', $text =
'')
	{
		if (empty($text))
		{
			$text = $value;
		}

		$option = new stdClass;
		$option->value = $value;
		$option->text  = $text;

		return $option;
	}

	/**
	 * Create and return a new Option Group
	 *
	 * @param   string  $label    Value and label for group [optional]
	 * @param   array   $options  Array of options to insert into group
[optional]
	 *
	 * @return  array  Return the new group as an array
	 *
	 * @since   3.6.3
	 */
	private static function createOptionGroup($label = '', $options
= array())
	{
		$group = array();
		$group['value'] = $label;
		$group['text']  = $label;
		$group['items'] = $options;

		return $group;
	}
}
model/templates.php000064400000006127151165463500010367 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Template style model.
 *
 * @since  3.2
 */
class ConfigModelTemplates extends ConfigModelForm
{
	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @return  null
	 *
	 * @since   3.2
	 */
	protected function populateState()
	{
		$state = $this->loadState();

		// Load the parameters.
		$params = JComponentHelper::getParams('com_templates');
		$state->set('params', $params);

		$this->setState($state);
	}

	/**
	 * Method to get the record form.
	 *
	 * @param   array    $data      An optional array of data for the form to
interrogate.
	 * @param   boolean  $loadData  True if the form is to load its own data
(default case), false if not.
	 *
	 * @return  JForm    A JForm object on success, false on failure
	 *
	 * @since   3.2
	 */
	public function getForm($data = array(), $loadData = true)
	{
		// Get the form.
		$form = $this->loadForm('com_config.templates',
'templates', array('control' => 'jform',
'load_data' => $loadData));

		try
		{
			$form = new JForm('com_config.templates');
			$data = array();
			$this->preprocessForm($form, $data);

			// Load the data into the form
			$form->bind($data);
		}
		catch (Exception $e)
		{
			JFactory::getApplication()->enqueueMessage($e->getMessage());

			return false;
		}

		if (empty($form))
		{
			return false;
		}

		return $form;
	}

	/**
	 * Method to preprocess the form
	 *
	 * @param   JForm   $form   A form object.
	 * @param   mixed   $data   The data expected for the form.
	 * @param   string  $group  Plugin group to load
	 *
	 * @return  void
	 *
	 * @since   3.2
	 * @throws	Exception if there is an error in the form event.
	 */
	protected function preprocessForm(JForm $form, $data, $group =
'content')
	{
		$lang = JFactory::getLanguage();

		$template = JFactory::getApplication()->getTemplate();

		jimport('joomla.filesystem.path');

		// Load the core and/or local language file(s).
		$lang->load('tpl_' . $template, JPATH_BASE, null, false,
true)
		|| $lang->load('tpl_' . $template, JPATH_BASE .
'/templates/' . $template, null, false, true);

		// Look for com_config.xml, which contains fields to display
		$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template
. '/com_config.xml');

		if (!file_exists($formFile))
		{
			// If com_config.xml not found, fall back to templateDetails.xml
			$formFile = JPath::clean(JPATH_BASE . '/templates/' .
$template . '/templateDetails.xml');
		}

		// Get the template form.
		if (file_exists($formFile) && !$form->loadFile($formFile,
false, '//config'))
		{
			throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
		}

		// Attempt to load the xml file.
		if (!$xml = simplexml_load_file($formFile))
		{
			throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
		}

		// Trigger the default form events.
		parent::preprocessForm($form, $data, $group);
	}
}
view/cms/html.php000064400000012454151165463500007771 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Prototype admin view.
 *
 * @since  3.2
 */
abstract class ConfigViewCmsHtml extends JViewHtml
{
	/**
	 * The output of the template script.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $_output = null;

	/**
	 * The name of the default template source file.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $_template = null;

	/**
	 * The set of search directories for resources (templates)
	 *
	 * @var    array
	 * @since  3.2
	 */
	protected $_path = array('template' => array(),
'helper' => array());

	/**
	 * Layout extension
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $_layoutExt = 'php';

	/**
	 * Method to instantiate the view.
	 *
	 * @param   JModel            $model  The model object.
	 * @param   SplPriorityQueue  $paths  The paths queue.
	 *
	 * @since   3.2
	 */
	public function __construct(JModel $model, SplPriorityQueue $paths = null)
	{
		$app = JFactory::getApplication();
		$component = JApplicationHelper::getComponentName();
		$component = preg_replace('/[^A-Z0-9_\.-]/i', '',
$component);

		if (isset($paths))
		{
			$paths->insert(JPATH_THEMES . '/' . $app->getTemplate()
. '/html/' . $component . '/' . $this->getName(),
2);
		}

		parent::__construct($model, $paths);
	}

	/**
	 * Load a template file -- first look in the templates folder for an
override
	 *
	 * @param   string  $tpl  The name of the template source file;
automatically searches the template paths and compiles as needed.
	 *
	 * @return  string  The output of the the template script.
	 *
	 * @since   3.2
	 * @throws  Exception
	 */
	public function loadTemplate($tpl = null)
	{
		// Clear prior output
		$this->_output = null;

		$template = JFactory::getApplication()->getTemplate();
		$layout = $this->getLayout();

		// Create the template file name based on the layout
		$file = isset($tpl) ? $layout . '_' . $tpl : $layout;

		// Clean the file name
		$file = preg_replace('/[^A-Z0-9_\.-]/i', '', $file);
		$tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\.-]/i',
'', $tpl) : $tpl;

		// Load the language file for the template
		$lang = JFactory::getLanguage();
		$lang->load('tpl_' . $template, JPATH_BASE, null, false,
true)
		|| $lang->load('tpl_' . $template, JPATH_THEMES .
"/$template", null, false, true);

		// Prevents adding path twise
		if (empty($this->_path['template']))
		{
			// Adding template paths
			$this->paths->top();
			$defaultPath = $this->paths->current();
			$this->paths->next();
			$templatePath = $this->paths->current();
			$this->_path['template'] = array($defaultPath,
$templatePath);
		}

		// Load the template script
		jimport('joomla.filesystem.path');
		$filetofind = $this->_createFileName('template',
array('name' => $file));
		$this->_template = JPath::find($this->_path['template'],
$filetofind);

		// If alternate layout can't be found, fall back to default layout
		if ($this->_template == false)
		{
			$filetofind = $this->_createFileName('',
array('name' => 'default' . (isset($tpl) ?
'_' . $tpl : $tpl)));
			$this->_template = JPath::find($this->_path['template'],
$filetofind);
		}

		if ($this->_template != false)
		{
			// Unset so as not to introduce into template scope
			unset($tpl, $file);

			// Never allow a 'this' property
			if (isset($this->this))
			{
				unset($this->this);
			}

			// Start capturing output into a buffer
			ob_start();

			// Include the requested template filename in the local scope
			// (this will execute the view logic).
			include $this->_template;

			// Done with the requested template; get the buffer and
			// clear it.
			$this->_output = ob_get_contents();
			ob_end_clean();

			return $this->_output;
		}
		else
		{
			throw new
Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND',
$file), 500);
		}
	}

	/**
	 * Create the filename for a resource
	 *
	 * @param   string  $type   The resource type to create the filename for
	 * @param   array   $parts  An associative array of filename information
	 *
	 * @return  string  The filename
	 *
	 * @since   3.2
	 */
	protected function _createFileName($type, $parts = array())
	{
		switch ($type)
		{
			case 'template':
				$filename = strtolower($parts['name']) . '.' .
$this->_layoutExt;
				break;

			default:
				$filename = strtolower($parts['name']) . '.php';
				break;
		}

		return $filename;
	}

	/**
	 * Method to get the view name
	 *
	 * The model name by default parsed using the classname, or it can be set
	 * by passing a $config['name'] in the class constructor
	 *
	 * @return  string  The name of the model
	 *
	 * @since   3.2
	 * @throws  Exception
	 */
	public function getName()
	{
		if (empty($this->_name))
		{
			$classname = get_class($this);
			$viewpos = strpos($classname, 'View');

			if ($viewpos === false)
			{
				throw new
Exception(JText::_('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500);
			}

			$lastPart = substr($classname, $viewpos + 4);
			$pathParts = explode(' ',
JStringNormalise::fromCamelCase($lastPart));

			if (!empty($pathParts[1]))
			{
				$this->_name = strtolower($pathParts[0]);
			}
			else
			{
				$this->_name = strtolower($lastPart);
			}
		}

		return $this->_name;
	}
}
view/cms/json.php000064400000001166151165463500007774 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Prototype admin view.
 *
 * @since  3.2
 */
abstract class ConfigViewCmsJson extends ConfigViewCmsHtml
{
	public $state;

	public $data;

	/**
	 * Method to render the view.
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		$this->data = $this->model->getData();

		return json_encode($this->data);
	}
}
view/config/html.php000064400000001245151165463500010450 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View for the global configuration
 *
 * @since  3.2
 */
class ConfigViewConfigHtml extends ConfigViewCmsHtml
{
	public $form;

	public $data;

	/**
	 * Method to render the view.
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		$user = JFactory::getUser();
		$this->userIsSuperAdmin = $user->authorise('core.admin');

		return parent::render();
	}
}
view/config/tmpl/default.php000064400000003445151165463500012110
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Load tooltips behavior
JHtml::_('behavior.formvalidator');
JHtml::_('bootstrap.tooltip');
JHtml::_('formbehavior.chosen', 'select');

JFactory::getDocument()->addScriptDeclaration("
	Joomla.submitbutton = function(task)
	{
		if (task == 'config.cancel' ||
document.formvalidator.isValid(document.getElementById('application-form')))
{
			Joomla.submitform(task,
document.getElementById('application-form'));
		}
	}
");
?>

<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
id="application-form" method="post"
name="adminForm" class="form-validate">

	<div class="row-fluid">
		<!-- Begin Content -->

		<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
			<div class="btn-group">
				<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.config.apply')">
					<span class="icon-ok"></span> <?php echo
JText::_('JSAVE') ?>
				</button>
			</div>
			<div class="btn-group">
				<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel')">
					<span class="icon-cancel"></span> <?php echo
JText::_('JCANCEL') ?>
				</button>
			</div>
		</div>

		<hr class="hr-condensed" />

		<div id="page-site" class="tab-pane active">
			<div class="row-fluid">
				<?php echo $this->loadTemplate('site'); ?>
				<?php echo $this->loadTemplate('metadata'); ?>
				<?php echo $this->loadTemplate('seo'); ?>
			</div>
		</div>

		<input type="hidden" name="task"
value="" />
		<?php echo JHtml::_('form.token'); ?>

		<!-- End Content -->
	</div>

</form>
view/config/tmpl/default.xml000064400000000757151165463500012124
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_CONFIG_CONFIG_VIEW_DEFAULT_TITLE"
option="COM_CONFIG_CONFIG_VIEW_DEFAULT_OPTION">
		<help
			key = "JHELP_MENUS_MENU_ITEM_DISPLAY_SITE_CONFIGURATION"
		/>
		<message>
			<![CDATA[COM_CONFIG_CONFIG_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>
	<fields name="request">
		<fieldset name="request">
			<field 
				name="controller" 
				type="hidden"
				default="config.display.config"
			/>
		</fieldset>
	</fields>
</metadata>view/config/tmpl/default_metadata.php000064400000001212151165463500013736
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
	<legend><?php echo
JText::_('COM_CONFIG_METADATA_SETTINGS'); ?></legend>
	<?php
	foreach ($this->form->getFieldset('metadata') as $field) :
	?>
		<div class="control-group">
			<div class="control-label"><?php echo
$field->label; ?></div>
			<div class="controls"><?php echo $field->input;
?></div>
		</div>
	<?php
	endforeach;
	?>
</fieldset>
view/config/tmpl/default_seo.php000064400000001200151165463510012742
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
	<legend><?php echo JText::_('COM_CONFIG_SEO_SETTINGS');
?></legend>
	<?php
	foreach ($this->form->getFieldset('seo') as $field) :
	?>
		<div class="control-group">
			<div class="control-label"><?php echo
$field->label; ?></div>
			<div class="controls"><?php echo $field->input;
?></div>
		</div>
	<?php
	endforeach;
	?>
</fieldset>
view/config/tmpl/default_site.php000064400000001202151165463510013122
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
?>
<fieldset class="form-horizontal">
	<legend><?php echo
JText::_('COM_CONFIG_SITE_SETTINGS'); ?></legend>
	<?php
	foreach ($this->form->getFieldset('site') as $field) :
	?>
		<div class="control-group">
			<div class="control-label"><?php echo
$field->label; ?></div>
			<div class="controls"><?php echo $field->input;
?></div>
		</div>
	<?php
	endforeach;
	?>
</fieldset>
view/modules/html.php000064400000001444151165463510010655 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View to edit a module.
 *
 * @package     Joomla.Site
 * @subpackage  com_config
 * @since       3.2
 */
class ConfigViewModulesHtml extends ConfigViewCmsHtml
{
	public $item;

	public $form;

	/**
	 * Display the view
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		$lang = JFactory::getApplication()->getLanguage();
		$lang->load('', JPATH_ADMINISTRATOR, $lang->getTag());
		$lang->load('com_modules', JPATH_ADMINISTRATOR,
$lang->getTag());

		return parent::render();
	}
}
view/modules/tmpl/default.php000064400000014061151165463510012310
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.combobox');
JHtml::_('formbehavior.chosen', 'select');

jimport('joomla.filesystem.file');

$editorText  = false;
$moduleXml   = JPATH_SITE . '/modules/' .
$this->item['module'] . '/' .
$this->item['module'] . '.xml';

if (JFile::exists($moduleXml))
{
	$xml = simplexml_load_file($moduleXml);

	if (isset($xml->customContent))
	{
		$editorText = true;
	}
}

// If multi-language site, make language read-only
if (JLanguageMultilang::isEnabled())
{
	$this->form->setFieldAttribute('language',
'readonly', 'true');
}

JFactory::getDocument()->addScriptDeclaration("
	Joomla.submitbutton = function(task)
	{
		if (task == 'config.cancel.modules' ||
document.formvalidator.isValid(document.getElementById('modules-form')))
		{
			Joomla.submitform(task,
document.getElementById('modules-form'));
		}
	}
");
?>

<form
	action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
	method="post" name="adminForm"
id="modules-form"
	class="form-validate">

	<div class="row-fluid">

		<!-- Begin Content -->
		<div class="span12">

			<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
				<div class="btn-group">
					<button type="button" class="btn btn-primary"
						onclick="Joomla.submitbutton('config.save.modules.apply')">
						<span class="icon-apply"
aria-hidden="true"></span>
						<?php echo JText::_('JAPPLY'); ?>
					</button>
				</div>
				<div class="btn-group">
					<button type="button" class="btn"
						onclick="Joomla.submitbutton('config.save.modules.save')">
						<span class="icon-save"
aria-hidden="true"></span>
						<?php echo JText::_('JSAVE'); ?>
					</button>
				</div>
				<div class="btn-group">
					<button type="button" class="btn"
						onclick="Joomla.submitbutton('config.cancel.modules')">
						<span class="icon-cancel"
aria-hidden="true"></span>
						<?php echo JText::_('JCANCEL'); ?>
					</button>
				</div>
			</div>

			<hr class="hr-condensed" />

			<legend><?php echo
JText::_('COM_CONFIG_MODULES_SETTINGS_TITLE');
?></legend>

			<div>
				<?php echo JText::_('COM_CONFIG_MODULES_MODULE_NAME');
?>
				<span class="label label-default"><?php echo
$this->item['title']; ?></span>
				&nbsp;&nbsp;
				<?php echo JText::_('COM_CONFIG_MODULES_MODULE_TYPE');
?>
				<span class="label label-default"><?php echo
$this->item['module']; ?></span>
			</div>
			<hr />

			<div class="row-fluid">
				<div class="span12">
					<fieldset class="form-horizontal">
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('title'); ?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('title'); ?>
							</div>
						</div>
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('showtitle');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('showtitle');
?>
							</div>
						</div>
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('position');
?>
							</div>
							<div class="controls">
								<?php echo $this->loadTemplate('positions'); ?>
							</div>
						</div>

						<hr />

						<?php if
(JFactory::getUser()->authorise('core.edit.state',
'com_modules.module.' . $this->item['id'])) : ?>
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('published');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('published');
?>
							</div>
						</div>
						<?php endif ?>

						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('publish_up');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('publish_up');
?>
							</div>
						</div>
						<div class="control-group">
							<div class="control-label">
								<?php echo
$this->form->getLabel('publish_down'); ?>
							</div>
							<div class="controls">
								<?php echo
$this->form->getInput('publish_down'); ?>
							</div>
						</div>

						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('access');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('access');
?>
							</div>
						</div>
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('ordering');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('ordering');
?>
							</div>
						</div>

						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('language');
?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('language');
?>
							</div>
						</div>
						<div class="control-group">
							<div class="control-label">
								<?php echo $this->form->getLabel('note'); ?>
							</div>
							<div class="controls">
								<?php echo $this->form->getInput('note'); ?>
							</div>
						</div>

						<hr />

						<div id="options">
							<?php echo $this->loadTemplate('options'); ?>
						</div>

						<?php if ($editorText) : ?>
							<div class="tab-pane" id="custom">
								<?php echo $this->form->getInput('content');
?>
							</div>
						<?php endif; ?>
					</fieldset>
				</div>

				<input type="hidden" name="id"
value="<?php echo $this->item['id']; ?>" />
				<input type="hidden" name="return"
value="<?php echo
JFactory::getApplication()->input->get('return', null,
'base64'); ?>" />
				<input type="hidden" name="task"
value="" />
				<?php echo JHtml::_('form.token'); ?>

			</div>

		</div>
		<!-- End Content -->
	</div>

</form>
view/modules/tmpl/default_options.php000064400000002653151165463510014067
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

$fieldSets = $this->form->getFieldsets('params');

echo JHtml::_('bootstrap.startAccordion',
'collapseTypes');
$i = 0;

foreach ($fieldSets as $name => $fieldSet) :

$label = !empty($fieldSet->label) ? $fieldSet->label :
'COM_MODULES_' . $name . '_FIELDSET_LABEL';
$class = isset($fieldSet->class) && !empty($fieldSet->class)
? $fieldSet->class : '';


if (isset($fieldSet->description) &&
trim($fieldSet->description)) :
echo '<p class="tip">' .
$this->escape(JText::_($fieldSet->description)) .
'</p>';
endif;
?>
<?php echo JHtml::_('bootstrap.addSlide',
'collapseTypes', JText::_($label), 'collapse' .
($i++)); ?>

<ul class="nav nav-tabs nav-stacked">
<?php foreach ($this->form->getFieldset($name) as $field) : ?>

	<li>
		<?php // If multi-language site, make menu-type selection read-only
?>
		<?php if (JLanguageMultilang::isEnabled() &&
$this->item['module'] === 'mod_menu' &&
$field->getAttribute('name') === 'menutype') : ?>
			<?php $field->readonly = true; ?>
		<?php endif; ?>
		<?php echo $field->renderField(); ?>
	</li>

<?php endforeach; ?>
</ul>

<?php echo JHtml::_('bootstrap.endSlide'); ?>
<?php endforeach; ?>
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
view/modules/tmpl/default_positions.php000064400000001536151165463510014422
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;
$positions = $this->model->getPositions();

// Add custom position to options
$customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION');

// Build field
$attr = array(
	'id'          => 'jform_position',
	'list.select' => $this->item['position'],
	'list.attr'   => 'class="chzn-custom-value"
'
		. 'data-custom_group_text="' . $customGroupText .
'" '
		. 'data-no_results_text="' .
JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" '
		. 'data-placeholder="' .
JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '"
'
);

echo JHtml::_('select.groupedlist', $positions,
'jform[position]', $attr);
view/templates/html.php000064400000001245151165463510011202
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * View to edit a template style.
 *
 * @since  3.2
 */
class ConfigViewTemplatesHtml extends ConfigViewCmsHtml
{
	public $item;

	public $form;

	/**
	 * Method to render the view.
	 *
	 * @return  string  The rendered view.
	 *
	 * @since   3.2
	 */
	public function render()
	{
		$user = JFactory::getUser();
		$this->userIsSuperAdmin = $user->authorise('core.admin');

		return parent::render();
	}
}
view/templates/tmpl/default.php000064400000003356151165463510012643
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
$user = JFactory::getUser();

JFactory::getDocument()->addScriptDeclaration("
	Joomla.submitbutton = function(task)
	{
		if (task == 'config.cancel' ||
document.formvalidator.isValid(document.getElementById('templates-form')))
		{
			Joomla.submitform(task,
document.getElementById('templates-form'));
		}
	}
");
?>

<form action="<?php echo
JRoute::_('index.php?option=com_config'); ?>"
method="post" name="adminForm"
id="templates-form" class="form-validate">

	<div class="row-fluid">
		<!-- Begin Content -->

		<div class="btn-toolbar" role="toolbar"
aria-label="<?php echo JText::_('JTOOLBAR');
?>">
			<div class="btn-group">
				<button type="button" class="btn btn-primary"
onclick="Joomla.submitbutton('config.save.templates.apply')">
					<span class="icon-ok"></span> <?php echo
JText::_('JSAVE') ?>
				</button>
			</div>
			<div class="btn-group">
				<button type="button" class="btn"
onclick="Joomla.submitbutton('config.cancel')">
					<span class="icon-cancel"></span> <?php echo
JText::_('JCANCEL') ?>
				</button>
			</div>
		</div>

		<hr class="hr-condensed" />

		<div id="page-site" class="tab-pane active">
			<div class="row-fluid">
				<?php // Get the menu parameters that are automatically set but may
be modified.
				echo $this->loadTemplate('options'); ?>
			</div>
		</div>

		<input type="hidden" name="task"
value="" />
		<?php echo JHtml::_('form.token'); ?>

		<!-- End Content -->
	</div>

</form>
view/templates/tmpl/default.xml000064400000000772151165463510012653
0ustar00<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_CONFIG_TEMPLATES_VIEW_DEFAULT_TITLE"
option="COM_CONFIG_TEMPLATES_VIEW_DEFAULT_OPTION">
		<help
			key = "JHELP_MENUS_MENU_ITEM_DISPLAY_TEMPLATE_OPTIONS"
		/>
		<message>
			<![CDATA[COM_CONFIG_TEMPLATES_VIEW_DEFAULT_DESC]]>
		</message>
	</layout>
	<fields name="request">
		<fieldset name="request" >
			<field 
				name="controller" 
				type="hidden"
				default="config.display.templates"
			/>
		</fieldset>
	</fields>
</metadata>view/templates/tmpl/default_options.php000064400000002207151165463510014410
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

// Load chosen.css
JHtml::_('formbehavior.chosen', 'select');

?>
<?php

	$fieldSets = $this->form->getFieldsets('params');
?>

<legend><?php echo
JText::_('COM_CONFIG_TEMPLATE_SETTINGS'); ?></legend>

<?php

	// Search for com_config field set
	if (!empty($fieldSets['com_config'])) : ?>

	<fieldset class="form-horizontal">
		<?php echo $this->form->renderFieldset('com_config');
?>
	</fieldset>

<?php else :

	// Fall-back to display all in params
	foreach ($fieldSets as $name => $fieldSet) :
	$label = !empty($fieldSet->label) ? $fieldSet->label :
'COM_CONFIG_' . $name . '_FIELDSET_LABEL';

	if (isset($fieldSet->description) &&
trim($fieldSet->description)) :
		echo '<p class="tip">' .
$this->escape(JText::_($fieldSet->description)) .
'</p>';
	endif;
	?>

<fieldset class="form-horizontal">
	<?php echo $this->form->renderFieldset($name); ?>
</fieldset>
	<?php endforeach;
	endif;