File manager - Edit - /home/opticamezl/www/newok/com_config.tar
Back
access.xml 0000644 00000000264 15172734602 0006540 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <access component="com_config"> <section name="component"> <action name="core.admin" title="JACTION_ADMIN" /> </section> </access> config.xml 0000644 00000002400 15172734602 0006536 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <extension type="component" method="upgrade"> <name>com_config</name> <author>Joomla! Project</author> <creationDate>2006-04</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</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>4.0.0</version> <description>COM_CONFIG_XML_DESCRIPTION</description> <namespace path="src">Joomla\Component\Config</namespace> <files folder="site"> <folder>forms</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages folder="site"> <language tag="en-GB">language/en-GB/com_config.ini</language> </languages> <media destination="com_config" folder="media"> <folder>js</folder> </media> <administration> <files folder="admin"> <filename>access.xml</filename> <filename>config.xml</filename> <folder>forms</folder> <folder>services</folder> <folder>src</folder> <folder>tmpl</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> services/provider.php 0000644 00000003616 15172734602 0010747 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\Extension\Service\Provider\RouterFactory; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\Component\Config\Administrator\Extension\ConfigComponent; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; /** * The config service provider. * * @since 4.0.0 */ return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.0.0 */ public function register(Container $container) { $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Config')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Config')); $container->registerServiceProvider(new RouterFactory('\\Joomla\\Component\\Config')); $container->set( ComponentInterface::class, function (Container $container) { $component = new ConfigComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setRouterFactory($container->get(RouterFactoryInterface::class)); return $component; } ); } }; tmpl/component/default.php 0000644 00000014021 15172734602 0011664 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; $app = Factory::getApplication(); $template = $app->getTemplate(); Text::script('ERROR'); Text::script('WARNING'); Text::script('NOTICE'); Text::script('MESSAGE'); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('form.validate') ->useScript('keepalive'); if ($this->fieldsets) { HTMLHelper::_('bootstrap.framework'); } $xml = $this->form->getXml(); ?> <form action="<?php echo Route::_('index.php?option=com_config'); ?>" id="component-form" method="post" class="form-validate main-card" name="adminForm" autocomplete="off"> <div class="row main-card-columns"> <?php // Begin Sidebar ?> <div class="col-md-3" id="sidebar"> <button class="btn btn-sm btn-secondary my-2 options-menu d-md-none" type="button" data-bs-toggle="collapse" data-bs-target=".sidebar-nav" aria-controls="sidebar-nav" aria-expanded="false"> <span class="icon-align-justify" aria-hidden="true"></span> <?php echo Text::_('JTOGGLE_SIDEBAR_MENU'); ?> </button> <div id="sidebar-nav" class="sidebar-nav"> <?php echo $this->loadTemplate('navigation'); ?> </div> </div> <?php // End Sidebar ?> <div class="col-md-9" id="config"> <?php if ($this->fieldsets) : ?> <?php $opentab = 0; ?> <?php echo HTMLHelper::_('uitab.startTabSet', 'configTabs', ['recall' => true, 'breakpoint' => 768]); ?> <?php foreach ($this->fieldsets as $name => $fieldSet) : ?> <?php $hasChildren = $xml->xpath('//fieldset[@name="' . $name . '"]/fieldset'); $hasParent = $xml->xpath('//fieldset/fieldset[@name="' . $name . '"]'); $isGrandchild = $xml->xpath('//fieldset/fieldset/fieldset[@name="' . $name . '"]'); ?> <?php $dataShowOn = ''; ?> <?php if (!empty($fieldSet->showon)) : ?> <?php $wa->useScript('showon'); ?> <?php $dataShowOn = ' data-showon=\'' . json_encode(FormHelper::parseShowOnConditions($fieldSet->showon, $this->formControl)) . '\''; ?> <?php endif; ?> <?php $label = empty($fieldSet->label) ? 'COM_CONFIG_' . $name . '_FIELDSET_LABEL' : $fieldSet->label; ?> <?php if (!$isGrandchild && $hasParent) : ?> <fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-menu options-form"> <legend><?php echo Text::_($fieldSet->label); ?></legend> <div class="form-grid"> <?php elseif (!$hasParent) : ?> <?php if ($opentab) : ?> <?php if ($opentab > 1) : ?> </div> </fieldset> <?php endif; ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', $name, Text::_($label)); ?> <?php $opentab = 1; ?> <?php if (!$hasChildren) : ?> <fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-menu options-form"> <legend><?php echo Text::_($fieldSet->label); ?></legend> <div class="form-grid"> <?php $opentab = 2; ?> <?php endif; ?> <?php endif; ?> <?php if (!empty($fieldSet->description)) : ?> <div class="tab-description alert alert-info"> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <?php echo Text::_($fieldSet->description); ?> </div> <?php endif; ?> <?php if (!$hasChildren) : ?> <?php echo $this->form->renderFieldset($name, $name === 'permissions' ? ['hiddenLabel' => true, 'class' => 'revert-controls'] : []); ?> <?php endif; ?> <?php if (!$isGrandchild && $hasParent) : ?> </div> </fieldset> <?php endif; ?> <?php endforeach; ?> <?php if ($opentab) : ?> <?php if ($opentab > 1) : ?> </div> </fieldset> <?php endif; ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php endif; ?> <?php echo HTMLHelper::_('uitab.endTabSet'); ?> <?php else : ?> <div class="alert alert-info"> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <?php echo Text::_('COM_CONFIG_COMPONENT_NO_CONFIG_FIELDS_MESSAGE'); ?> </div> <?php endif; ?> </div> <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 HTMLHelper::_('form.token'); ?> </div> </form> tmpl/component/default.xml 0000644 00000000735 15172734602 0011704 0 ustar 00 <?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" addfieldprefix="Joomla\Component\Config\Administrator\Field"> <field name="component" type="configComponents" label="JGLOBAL_CHOOSE_COMPONENT_LABEL" required="true" /> </fieldset> </fields> </metadata> tmpl/component/default_navigation.php 0000644 00000002213 15172734602 0014103 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; defined('_JEXEC') or die; ?> <ul class="nav flex-column"> <?php if ($this->userIsSuperAdmin) : ?> <li class="nav-header"><?php echo Text::_('COM_CONFIG_SYSTEM'); ?></li> <li class="item"><a href="index.php?option=com_config"><?php echo Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'); ?></a></li> <li class="divider"></li> <?php endif; ?> <li class="nav-header"><?php echo Text::_('COM_CONFIG_COMPONENT_FIELDSET_LABEL'); ?></li> <?php foreach ($this->components as $component) : ?> <?php $active = ''; if ($this->currentComponent === $component) { $active = ' active'; } ?> <li class="item<?php echo $active; ?>"> <a href="index.php?option=com_config&view=component&component=<?php echo $component; ?>"><?php echo Text::_($component); ?></a> </li> <?php endforeach; ?> </ul> tmpl/application/default_webservices.php 0000644 00000001036 15172734602 0014570 0 ustar 00 <?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 */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_WEBSERVICES_SETTINGS'); $this->fieldsname = 'webservices'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_cookie.php 0000644 00000001007 15172734602 0013516 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_COOKIE_SETTINGS'); $this->fieldsname = 'cookie'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_server.php 0000644 00000001007 15172734602 0013553 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_SERVER_SETTINGS'); $this->fieldsname = 'server'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_metadata.php 0000644 00000001013 15172734602 0014022 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_METADATA_SETTINGS'); $this->fieldsname = 'metadata'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_logging.php 0000644 00000001011 15172734602 0013666 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_LOGGING_SETTINGS'); $this->fieldsname = 'logging'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_cache.php 0000644 00000001005 15172734602 0013306 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_CACHE_SETTINGS'); $this->fieldsname = 'cache'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_database.php 0000644 00000001013 15172734602 0014006 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_DATABASE_SETTINGS'); $this->fieldsname = 'database'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_debug.php 0000644 00000001005 15172734602 0013331 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_DEBUG_SETTINGS'); $this->fieldsname = 'debug'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_site.php 0000644 00000001003 15172734602 0013205 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_SITE_SETTINGS'); $this->fieldsname = 'site'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_locale.php 0000644 00000001011 15172734602 0013477 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_LOCATION_SETTINGS'); $this->fieldsname = 'locale'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_mail.php 0000644 00000002732 15172734602 0013175 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; defined('_JEXEC') or die; HTMLHelper::_('form.csrf'); $this->document->getWebAssetManager() ->useScript('webcomponent.field-send-test-mail'); // Load JavaScript message titles Text::script('ERROR'); Text::script('WARNING'); Text::script('NOTICE'); Text::script('MESSAGE'); // Add strings for JavaScript error translations. Text::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT'); Text::script('JLIB_JS_AJAX_ERROR_NO_CONTENT'); Text::script('JLIB_JS_AJAX_ERROR_OTHER'); Text::script('JLIB_JS_AJAX_ERROR_PARSE'); Text::script('JLIB_JS_AJAX_ERROR_TIMEOUT'); // Ajax request data. $ajaxUri = Route::_('index.php?option=com_config&task=application.sendtestmail&format=json'); $this->name = Text::_('COM_CONFIG_MAIL_SETTINGS'); $this->fieldsname = 'mail'; $this->formclass = 'options-form'; ?> <joomla-field-send-test-mail uri="<?php echo $ajaxUri; ?>"> <?php echo LayoutHelper::render('joomla.content.options_default', $this); ?> <button class="btn btn-primary" type="button" id="sendtestmail"> <span><?php echo Text::_('COM_CONFIG_SENDMAIL_ACTION_BUTTON'); ?></span> </button> </joomla-field-send-test-mail> tmpl/application/default_proxy.php 0000644 00000001005 15172734602 0013424 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2014 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_PROXY_SETTINGS'); $this->fieldsname = 'proxy'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_logging_custom.php 0000644 00000001027 15172734602 0015267 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_LOGGING_CUSTOM_SETTINGS'); $this->fieldsname = 'logging_custom'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default.php 0000644 00000007727 15172734602 0012204 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); $wa->useScript('keepalive') ->useScript('form.validate'); // Load JS message titles Text::script('ERROR'); Text::script('WARNING'); Text::script('NOTICE'); Text::script('MESSAGE'); ?> <form action="<?php echo Route::_('index.php?option=com_config'); ?>" id="application-form" method="post" name="adminForm" class="main-card form-validate"> <div class="row main-card-columns"> <div id="sidebar" class="col-md-3"> <button class="btn btn-sm btn-secondary my-2 options-menu d-md-none" type="button" data-bs-toggle="collapse" data-bs-target=".sidebar-nav" aria-controls="sidebar-nav" aria-expanded="false" aria-label="<?php echo Text::_('JTOGGLE_SIDEBAR_MENU'); ?>"> <span class="icon-align-justify" aria-hidden="true"></span> <?php echo Text::_('JTOGGLE_SIDEBAR_MENU'); ?> </button> <div id="sidebar-nav" class="sidebar-nav"> <?php echo $this->loadTemplate('navigation'); ?> </div> </div> <div class="col-md-9"> <?php echo HTMLHelper::_('uitab.startTabSet', 'configTabs', ['active' => 'page-site', 'recall' => true, 'breakpoint' => 768]); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-site', Text::_('JSITE')); ?> <?php echo $this->loadTemplate('site'); ?> <?php echo $this->loadTemplate('metadata'); ?> <?php echo $this->loadTemplate('seo'); ?> <?php echo $this->loadTemplate('cookie'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-system', Text::_('COM_CONFIG_SYSTEM')); ?> <?php echo $this->loadTemplate('debug'); ?> <?php echo $this->loadTemplate('cache'); ?> <?php echo $this->loadTemplate('session'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-server', Text::_('COM_CONFIG_SERVER')); ?> <?php echo $this->loadTemplate('server'); ?> <?php echo $this->loadTemplate('locale'); ?> <?php echo $this->loadTemplate('webservices'); ?> <?php echo $this->loadTemplate('proxy'); ?> <?php echo $this->loadTemplate('database'); ?> <?php echo $this->loadTemplate('mail'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-logging', Text::_('COM_CONFIG_LOGGING')); ?> <?php echo $this->loadTemplate('logging'); ?> <?php echo $this->loadTemplate('logging_custom'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-filters', Text::_('COM_CONFIG_TEXT_FILTERS')); ?> <?php echo $this->loadTemplate('filters'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-permissions', Text::_('COM_CONFIG_PERMISSIONS')); ?> <?php echo $this->loadTemplate('permissions'); ?> <?php echo HTMLHelper::_('uitab.endTab'); ?> <?php echo HTMLHelper::_('uitab.endTabSet'); ?> <input type="hidden" name="task" value=""> <?php echo HTMLHelper::_('form.token'); ?> </div> </div> </form> tmpl/application/default.xml 0000644 00000000314 15172734602 0012176 0 ustar 00 <?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> tmpl/application/default_navigation.php 0000644 00000002002 15172734602 0014400 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; defined('_JEXEC') or die; ?> <ul class="nav flex-column"> <?php if ($this->userIsSuperAdmin) : ?> <li class="nav-header"><?php echo Text::_('COM_CONFIG_SYSTEM'); ?></li> <li class="item active"> <a href="index.php?option=com_config"><?php echo Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'); ?></a> </li> <li class="divider"></li> <?php endif; ?> <li class="nav-header"><?php echo Text::_('COM_CONFIG_COMPONENT_FIELDSET_LABEL'); ?></li> <?php foreach ($this->components as $component) : ?> <li class="item"> <a href="index.php?option=com_config&view=component&component=<?php echo $component; ?>"><?php echo Text::_($component); ?></a> </li> <?php endforeach; ?> </ul> tmpl/application/default_session.php 0000644 00000001011 15172734602 0013723 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_SESSION_SETTINGS'); $this->fieldsname = 'session'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_filters.php 0000644 00000001012 15172734602 0013711 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_TEXT_FILTER_SETTINGS'); $this->fieldsname = 'filters'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.text_filters', $this); tmpl/application/default_permissions.php 0000644 00000001137 15172734602 0014624 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_PERMISSION_SETTINGS'); $this->description = ''; $this->fieldsname = 'permissions'; $this->formclass = 'form-no-columns options-form'; $this->showlabel = false; echo LayoutHelper::render('joomla.content.options_default', $this); tmpl/application/default_seo.php 0000644 00000001001 15172734602 0013025 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; defined('_JEXEC') or die; $this->name = Text::_('COM_CONFIG_SEO_SETTINGS'); $this->fieldsname = 'seo'; $this->formclass = 'options-form'; echo LayoutHelper::render('joomla.content.options_default', $this); src/Dispatcher/Dispatcher.php 0000644 00000003643 15172734602 0012235 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Dispatcher; use Joomla\CMS\Access\Exception\NotAllowed; use Joomla\CMS\Dispatcher\ComponentDispatcher; use Joomla\Component\Config\Administrator\Helper\ConfigHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * ComponentDispatcher class for com_config * * @since 4.2.9 */ class Dispatcher extends ComponentDispatcher { /** * Check if the user have the right access to the component config * * @return void * * @since 4.2.9 * * @throws \Exception */ protected function checkAccess(): void { // sendtestmail and store do their own checks, so leave the method to handle the permission and send response itself if (in_array($this->input->getCmd('task'), ['application.sendtestmail', 'application.store'], true)) { return; } $task = $this->input->getCmd('task', 'display'); $view = $this->input->getCmd('view'); $component = $this->input->getCmd('component'); if ($component && (substr($task, 0, 10) === 'component.' || $view === 'component')) { // User is changing component settings, check if he has permission to do that $canAccess = ConfigHelper::canChangeComponentConfig($component); } else { // For everything else, user is required to have global core.admin permission to perform action $canAccess = $this->app->getIdentity()->authorise('core.admin'); } if (!$canAccess) { throw new NotAllowed($this->app->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403); } } } src/Helper/ConfigHelper.php 0000644 00000010156 15172734602 0011642 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Helper; use Joomla\CMS\Application\ApplicationHelper; use Joomla\CMS\Factory; use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\Language\Text; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Components helper for com_config * * @since 3.0 */ class ConfigHelper extends ContentHelper { /** * Get an array of all enabled components. * * @return array * * @since 3.0 */ public static function getAllComponents() { $db = Factory::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 true if the current user has permission to access and change configuration options. * * @param string $component Component name * * @return boolean * * @since 4.2.9 */ public static function canChangeComponentConfig(string $component) { $user = Factory::getApplication()->getIdentity(); if (!in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy'], true)) { return $user->authorise('core.admin', $component) || $user->authorise('core.options', $component); } return $user->authorise('core.admin'); } /** * 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 = []; $components = self::getAllComponents(); // Remove com_config from the array as that may have weird side effects $components = array_diff($components, ['com_config']); foreach ($components as $component) { if (self::hasComponentConfig($component) && (!$authCheck || self::canChangeComponentConfig($component))) { self::loadLanguageForComponent($component); $result[$component] = ApplicationHelper::stringURLSafe(Text::_($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 = Factory::getLanguage(); // Load the core file then // Load extension-local file. $lang->load($component . '.sys', JPATH_BASE) || $lang->load($component . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component); } } src/Controller/DisplayController.php 0000644 00000003554 15172734602 0013656 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Controller for global configuration * * @since 1.5 */ class DisplayController extends BaseController { /** * The default view. * * @var string * @since 1.6 */ protected $default_view = 'application'; /** * Typical view method for MVC based architecture * * This function is provide as a default implementation, in most cases * you will need to override it in your own controllers. * * @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 InputFilter::clean()}. * * @return static A \JControllerLegacy object to support chaining. * * @since 3.0 * @throws \Exception */ public function display($cachable = false, $urlparams = []) { $component = $this->input->get('component', ''); // Make sure com_joomlaupdate and com_privacy can only be accessed by SuperUser if ( in_array(strtolower($component), ['com_joomlaupdate', 'com_privacy']) && !$this->app->getIdentity()->authorise('core.admin') ) { $this->setRedirect(Route::_('index.php'), Text::_('JERROR_ALERTNOAUTHOR'), 'error'); } return parent::display($cachable, $urlparams); } } src/Controller/ComponentController.php 0000644 00000015501 15172734602 0014206 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Controller; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; use Joomla\Input\Input; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Note: this view is intended only to be opened in a popup * * @since 1.5 */ class ComponentController extends FormController { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * @param MVCFactoryInterface $factory The factory. * @param CMSApplication $app The Application for the dispatcher * @param Input $input Input * * @since 3.0 */ public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) { parent::__construct($config, $factory, $app, $input); // Map the apply task to the save method. $this->registerTask('apply', 'save'); } /** * Method to save component configuration. * * @param string $key The name of the primary key of the URL variable. * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). * * @return boolean * * @since 3.2 */ public function save($key = null, $urlVar = null) { // Check for request forgeries. $this->checkToken(); $data = $this->input->get('jform', [], 'ARRAY'); $id = $this->input->get('id', null, 'INT'); $option = $this->input->get('component'); $user = $this->app->getIdentity(); $context = "$this->option.edit.$this->context.$option"; /** @var \Joomla\Component\Config\Administrator\Model\ComponentModel $model */ $model = $this->getModel('Component', 'Administrator'); $model->setState('component.option', $option); $form = $model->getForm(); // Make sure com_joomlaupdate and com_privacy can only be accessed by SuperUser if (\in_array(strtolower($option), ['com_joomlaupdate', 'com_privacy'], true) && !$user->authorise('core.admin')) { $this->setRedirect(Route::_('index.php', false), Text::_('JERROR_ALERTNOAUTHOR'), 'error'); } // Check if the user is authorised to do this. if (!$user->authorise('core.admin', $option) && !$user->authorise('core.options', $option)) { $this->setRedirect(Route::_('index.php', false), Text::_('JERROR_ALERTNOAUTHOR'), 'error'); } // 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) { // Save the data in the session. $this->app->setUserState($context . '.data', $data); // Redirect back to the edit screen. $this->setRedirect( Route::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false), $model->getError(), 'error' ); return false; } // Attempt to save the configuration. $data = [ 'params' => $return, 'id' => $id, 'option' => $option, ]; try { $model->save($data); } catch (\RuntimeException $e) { // Save the data in the session. $this->app->setUserState($context . '.data', $data); // Save failed, go back to the screen and display a notice. $this->setRedirect( Route::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false), Text::_('JERROR_SAVE_FAILED', $e->getMessage()), 'error' ); return false; } // Clear session data. $this->app->setUserState($context . '.data', null); // Set the redirect based on the task. switch ($this->input->get('task')) { case 'apply': $this->setRedirect( Route::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false), Text::_('COM_CONFIG_SAVE_SUCCESS'), 'message' ); break; case 'save': $this->setMessage(Text::_('COM_CONFIG_SAVE_SUCCESS'), 'message'); // No break default: $redirect = 'index.php?option=' . $option; if (!empty($returnUri)) { $redirect = base64_decode($returnUri); } // Don't redirect to an external URL. if (!Uri::isInternal($redirect)) { $redirect = Uri::base(); } $this->setRedirect(Route::_($redirect, false)); } return true; } /** * Method to cancel global configuration component. * * @param string $key The name of the primary key of the URL variable. * * @return boolean * * @since 3.2 */ public function cancel($key = null) { $component = $this->input->get('component'); // Clear session data. $this->app->setUserState("$this->option.edit.$this->context.$component.data", null); // Calculate redirect URL $returnUri = $this->input->post->get('return', null, 'base64'); $redirect = 'index.php?option=' . $component; if (!empty($returnUri)) { $redirect = base64_decode($returnUri); } // Don't redirect to an external URL. if (!Uri::isInternal($redirect)) { $redirect = Uri::base(); } $this->setRedirect(Route::_($redirect, false)); return true; } } src/Controller/RequestController.php 0000644 00000005446 15172734602 0013703 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Controller; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Requests from the frontend * * @since 4.0.0 */ class RequestController extends BaseController { /** * Execute the controller. * * @return mixed A rendered view or false * * @since 3.2 */ public function getJson() { $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'); } // 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); } $model = new \Joomla\Component\Config\Administrator\Model\ApplicationModel(); $component = $model->getState()->get('component.option'); // Access check. if ( !$this->app->getIdentity()->authorise('core.admin', $component) && !$this->app->getIdentity()->authorise('core.options', $component) ) { $this->app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } try { $data = $model->getData(); } catch (\Exception $e) { $this->app->enqueueMessage($e->getMessage(), 'error'); return false; } // Required data $requiredData = [ 'sitename' => null, 'offline' => null, 'access' => null, 'list_limit' => null, 'MetaDesc' => null, 'MetaRights' => null, 'sef' => null, 'sitename_pagetitles' => null, 'debug' => null, 'debug_lang' => null, 'error_reporting' => null, 'mailfrom' => null, 'fromname' => null, ]; $data = array_intersect_key($data, $requiredData); return json_encode($data); } } src/Controller/ApplicationController.php 0000644 00000022224 15172734602 0014507 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Controller; use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Response\JsonResponse; use Joomla\CMS\Router\Route; use Joomla\CMS\Session\Session; use Joomla\Input\Input; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Controller for global configuration * * @since 1.5 */ class ApplicationController extends BaseController { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'default_task', 'model_path', and * 'view_path' (this list is not meant to be comprehensive). * @param MVCFactoryInterface $factory The factory. * @param CMSApplication $app The Application for the dispatcher * @param Input $input Input * * @since 3.0 */ public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) { parent::__construct($config, $factory, $app, $input); // Map the apply task to the save method. $this->registerTask('apply', 'save'); } /** * Cancel operation. * * @return void * * @since 3.0.0 */ public function cancel() { $this->setRedirect(Route::_('index.php?option=com_cpanel')); } /** * Saves the form * * @return void|boolean Void on success. Boolean false on fail. * * @since 4.0.0 */ public function save() { // Check for request forgeries. $this->checkToken(); // Check if the user is authorized to do this. if (!$this->app->getIdentity()->authorise('core.admin')) { $this->setRedirect('index.php', Text::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } $this->app->setUserState('com_config.config.global.data', null); /** @var \Joomla\Component\Config\Administrator\Model\ApplicationModel $model */ $model = $this->getModel('Application', 'Administrator'); $data = $this->input->post->get('jform', [], 'array'); // Complete data array if needed $oldData = $model->getData(); $data = array_replace($oldData, $data); // Get request type $saveFormat = $this->app->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) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof \Exception) { $this->app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $this->app->enqueueMessage($errors[$i], 'warning'); } } // Save the posted data in the session. $this->app->setUserState('com_config.config.global.data', $data); // Redirect back to the edit screen. $this->setRedirect(Route::_('index.php?option=com_config', false)); return false; } // Validate database connection data. $data = $return; $return = $model->validateDbConnection($data); // Check for validation errors. if ($return === false) { /* * The validateDbConnection method enqueued all messages for us. */ // Save the posted data in the session. $this->app->setUserState('com_config.config.global.data', $data); // Redirect back to the edit screen. $this->setRedirect(Route::_('index.php?option=com_config', false)); return false; } // Save the validated data in the session. $this->app->setUserState('com_config.config.global.data', $return); // 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 failed, go back to the screen and display a notice. $this->setRedirect(Route::_('index.php?option=com_config', false)); return false; } // Set the success message. $this->app->enqueueMessage(Text::_('COM_CONFIG_SAVE_SUCCESS'), 'message'); // Set the redirect based on the task. switch ($this->input->getCmd('task')) { case 'apply': $this->setRedirect(Route::_('index.php?option=com_config', false)); break; case 'save': default: $this->setRedirect(Route::_('index.php', false)); break; } } /** * Method to remove root in global configuration. * * @return boolean * * @since 3.2 */ public function removeroot() { // Check for request forgeries. if (!Session::checkToken('get')) { $this->setRedirect('index.php', Text::_('JINVALID_TOKEN'), 'error'); return false; } // Check if the user is authorized to do this. if (!$this->app->getIdentity()->authorise('core.admin')) { $this->setRedirect('index.php', Text::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } // Initialise model. /** @var \Joomla\Component\Config\Administrator\Model\ApplicationModel $model */ $model = $this->getModel('Application', 'Administrator'); // 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->setRedirect('index.php', Text::_('JERROR_SAVE_FAILED', $e->getMessage()), 'error'); return false; } // Set the redirect based on the task. $this->setRedirect(Route::_('index.php'), Text::_('COM_CONFIG_SAVE_SUCCESS')); return true; } /** * Method to send the test mail. * * @return void * * @since 3.5 */ public function sendtestmail() { // 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 (!Session::checkToken()) { $this->app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error'); echo new JsonResponse(); $this->app->close(); } // Check if the user is authorized to do this. if (!$this->app->getIdentity()->authorise('core.admin')) { $this->app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); echo new JsonResponse(); $this->app->close(); } /** @var \Joomla\Component\Config\Administrator\Model\ApplicationModel $model */ $model = $this->getModel('Application', 'Administrator'); echo new JsonResponse($model->sendTestMail()); $this->app->close(); } /** * Method to GET permission value and give it to the model for storing in the database. * * @return void * * @since 3.5 */ public function store() { // 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 (!Session::checkToken('get')) { $this->app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error'); echo new JsonResponse(); $this->app->close(); } /** @var \Joomla\Component\Config\Administrator\Model\ApplicationModel $model */ $model = $this->getModel('Application', 'Administrator'); echo new JsonResponse($model->storePermissions()); $this->app->close(); } } src/Extension/ConfigComponent.php 0000644 00000001334 15172734602 0013120 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Extension; use Joomla\CMS\Component\Router\RouterServiceInterface; use Joomla\CMS\Component\Router\RouterServiceTrait; use Joomla\CMS\Extension\MVCComponent; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Component class for com_config * * @since 4.0.0 */ class ConfigComponent extends MVCComponent implements RouterServiceInterface { use RouterServiceTrait; } src/View/Component/HtmlView.php 0000644 00000010047 15172734602 0012470 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\View\Component; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Config\Administrator\Helper\ConfigHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View for the component configuration * * @since 3.2 */ class HtmlView extends BaseHtmlView { /** * The model state * * @var \Joomla\CMS\Object\CMSObject * @since 3.2 */ public $state; /** * The form object * * @var \Joomla\CMS\Form\Form * @since 3.2 */ public $form; /** * An object with the information for the component * * @var \Joomla\CMS\Component\ComponentRecord * @since 3.2 */ public $component; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void * * @see \JViewLegacy::loadTemplate() * @since 3.2 */ public function display($tpl = null) { try { $component = $this->get('component'); if (!$component->enabled) { return; } $form = $this->get('form'); $user = $this->getCurrentUser(); } catch (\Exception $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return; } $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 = ConfigHelper::getComponentsWithConfig(); $this->userIsSuperAdmin = $user->authorise('core.admin'); $this->currentComponent = Factory::getApplication()->getInput()->get('component'); $this->return = Factory::getApplication()->getInput()->get('return', '', 'base64'); $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 3.2 */ protected function addToolbar() { $toolbar = Toolbar::getInstance(); ToolbarHelper::title(Text::_($this->component->option . '_configuration'), 'cog config'); $toolbar->apply('component.apply'); $toolbar->divider(); $toolbar->save('component.save'); $toolbar->divider(); $toolbar->cancel('component.cancel'); $toolbar->divider(); $inlinehelp = (string) $this->form->getXml()->config->inlinehelp['button'] == 'show' ?: false; $targetClass = (string) $this->form->getXml()->config->inlinehelp['targetclass'] ?: 'hide-aware-inline-help'; if ($inlinehelp) { $toolbar->inlinehelp($targetClass); } $helpUrl = $this->form->getData()->get('helpURL'); $helpKey = (string) $this->form->getXml()->config->help['key']; // Try with legacy language key if (!$helpKey) { $language = Factory::getApplication()->getLanguage(); $languageKey = 'JHELP_COMPONENTS_' . strtoupper($this->currentComponent) . '_OPTIONS'; if ($language->hasKey($languageKey)) { $helpKey = $languageKey; } } $toolbar->help($helpKey, (bool) $helpUrl, null, $this->currentComponent); } } src/View/Application/HtmlView.php 0000644 00000006144 15172734602 0012774 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\View\Application; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Config\Administrator\Helper\ConfigHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * View for the global configuration * * @since 3.2 */ class HtmlView extends BaseHtmlView { /** * The model state * * @var \Joomla\CMS\Object\CMSObject * @since 3.2 */ public $state; /** * The form object * * @var \Joomla\CMS\Form\Form * @since 3.2 */ public $form; /** * The data to be displayed in the form * * @var array * @since 3.2 */ public $data; /** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void * * @see \JViewLegacy::loadTemplate() * @since 3.0 */ public function display($tpl = null) { try { // Load Form and Data $form = $this->get('form'); $data = $this->get('data'); $user = $this->getCurrentUser(); } catch (\Exception $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return; } // Bind data if ($form && $data) { $form->bind($data); } // Get the params for com_users. $usersParams = ComponentHelper::getParams('com_users'); // Get the params for com_media. $mediaParams = ComponentHelper::getParams('com_media'); $this->form = &$form; $this->data = &$data; $this->usersParams = &$usersParams; $this->mediaParams = &$mediaParams; $this->components = ConfigHelper::getComponentsWithConfig(); ConfigHelper::loadLanguageForComponents($this->components); $this->userIsSuperAdmin = $user->authorise('core.admin'); $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 3.2 */ protected function addToolbar() { $toolbar = Toolbar::getInstance(); ToolbarHelper::title(Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'cog config'); $toolbar->apply('application.apply'); $toolbar->divider(); $toolbar->save('application.save'); $toolbar->divider(); $toolbar->cancel('application.cancel'); $toolbar->divider(); $toolbar->inlinehelp(); $toolbar->help('Site_Global_Configuration'); } } src/Field/FiltersField.php 0000644 00000015502 15172734602 0011455 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormField; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Text Filters form field. * * @since 1.6 */ class FiltersField extends FormField { /** * 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() { // Add translation string for notification Text::script('COM_CONFIG_TEXT_FILTERS_NOTE'); // Add Javascript Factory::getDocument()->getWebAssetManager()->useScript('com_config.filters'); // Get the available user groups. $groups = $this->getUserGroups(); // Build the form control. $html = []; // Open the table. $html[] = '<table id="filter-config" class="table">'; // The table heading. $html[] = ' <thead>'; $html[] = ' <tr>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_GROUPS_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_TYPE_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_TAGS_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('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] = ['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[] = ' ' . LayoutHelper::render('joomla.html.treeprefix', ['level' => $group->level + 1]) . $group->text; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_type" class="visually-hidden">' . Text::_('JGLOBAL_FILTER_TYPE_LABEL') . '</label>'; $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 form-select"' . '>'; $html[] = ' <option value="BL"' . ($group_filter['filter_type'] == 'BL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_DEFAULT_FORBIDDEN_LIST') . '</option>'; $html[] = ' <option value="CBL"' . ($group_filter['filter_type'] == 'CBL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_CUSTOM_FORBIDDEN_LIST') . '</option>'; $html[] = ' <option value="WL"' . ($group_filter['filter_type'] == 'WL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_ALLOWED_LIST') . '</option>'; $html[] = ' <option value="NH"' . ($group_filter['filter_type'] == 'NH' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_NO_HTML') . '</option>'; $html[] = ' <option value="NONE"' . ($group_filter['filter_type'] == 'NONE' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_NO_FILTER') . '</option>'; $html[] = ' </select>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_tags" class="visually-hidden">' . Text::_('JGLOBAL_FILTER_TAGS_LABEL') . '</label>'; $html[] = ' <input' . ' name="' . $this->name . '[' . $group->value . '][filter_tags]"' . ' type="text"' . ' id="' . $this->id . $group->value . '_filter_tags" class="novalidate form-control"' . ' value="' . htmlspecialchars($group_filter['filter_tags'], ENT_QUOTES) . '"' . '>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_attributes"' . ' class="visually-hidden">' . Text::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . '</label>'; $html[] = ' <input' . ' name="' . $this->name . '[' . $group->value . '][filter_attributes]"' . ' type="text"' . ' id="' . $this->id . $group->value . '_filter_attributes" class="novalidate form-control"' . ' value="' . htmlspecialchars($group_filter['filter_attributes'], ENT_QUOTES) . '"' . '>'; $html[] = ' </td>'; $html[] = ' </tr>'; } $html[] = ' </tbody>'; // Close the table. $html[] = '</table>'; 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 = $this->getDatabase(); // 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; } } src/Field/ConfigComponentsField.php 0000644 00000004353 15172734602 0013322 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Text Filters form field. * * @since 3.7.0 */ class ConfigComponentsField extends ListField { /** * 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 = $this->getDatabase(); $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 = Factory::getLanguage(); foreach ($items as &$item) { // Load language $extension = $item->value; if (is_file(JPATH_ADMINISTRATOR . '/components/' . $extension . '/config.xml')) { $source = JPATH_ADMINISTRATOR . '/components/' . $extension; $lang->load("$extension.sys", JPATH_ADMINISTRATOR) || $lang->load("$extension.sys", $source); // Translate component name $item->text = Text::_($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; } } src/Model/ComponentModel.php 0000644 00000016122 15172734602 0012040 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Model; use Joomla\CMS\Access\Access; use Joomla\CMS\Access\Rules; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\Path; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\FormModel; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Table; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Model for component configuration * * @since 3.2 */ class ComponentModel extends FormModel { /** * 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 = Factory::getApplication()->getInput(); // Set the component (option) we are dealing with. $component = $input->get('component'); $this->state->set('component.option', $component); // Set an alternative path for the configuration file. if ($path = $input->getString('path')) { $path = Path::clean(JPATH_SITE . '/' . $path); Path::check($path); $this->state->set('component.path', $path); } } /** * 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 = [], $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. Form::addFormPath($path); } else { // Add the search path for the admin component config.xml file. Form::addFormPath(JPATH_ADMINISTRATOR . '/components/' . $option); } // Get the form. $form = $this->loadForm( 'com_config.component', 'config', ['control' => 'jform', 'load_data' => $loadData], false, '/config' ); if (empty($form)) { return false; } $lang = Factory::getLanguage(); $lang->load($option, JPATH_BASE) || $lang->load($option, JPATH_BASE . "/components/$option"); return $form; } /** * Method to get the data that should be injected in the form. * * @return array The default data is an empty array. * * @since 4.0.0 */ protected function loadFormData() { $option = $this->getState()->get('component.option'); // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState('com_config.edit.component.' . $option . '.data', []); if (empty($data)) { return $this->getComponent()->getParams()->toArray(); } return $data; } /** * 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 = Factory::getLanguage(); $lang->load($option, JPATH_BASE) || $lang->load($option, JPATH_BASE . "/components/$option"); $result = ComponentHelper::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 = Table::getInstance('extension'); $context = $this->option . '.' . $this->name; PluginHelper::importPlugin('extension'); // Check super user group. if (isset($data['params']) && !$this->getCurrentUser()->authorise('core.admin')) { $form = $this->getForm([], 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 && Access::checkGroup($data['params'][$field->fieldname], 'core.admin') ) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); } } } } // Save the rules. if (isset($data['params']) && isset($data['params']['rules'])) { if (!$this->getCurrentUser()->authorise('core.admin', $data['option'])) { throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); } $rules = new Rules($data['params']['rules']); $asset = Table::getInstance('asset'); if (!$asset->loadByName($data['option'])) { $root = Table::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 = Factory::getApplication()->triggerEvent('onExtensionBeforeSave', [$context, $table, false]); // Store the data. if (in_array(false, $result, true) || !$table->store()) { throw new \RuntimeException($table->getError()); } Factory::getApplication()->triggerEvent('onExtensionAfterSave', [$context, $table, false]); // Clean the component cache. $this->cleanCache('_system'); return true; } } src/Model/ApplicationModel.php 0000644 00000140534 15172734602 0012346 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Model; use Joomla\CMS\Access\Access; use Joomla\CMS\Access\Rules; use Joomla\CMS\Cache\Exception\CacheConnectingException; use Joomla\CMS\Cache\Exception\UnsupportedCacheException; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\Folder; use Joomla\CMS\Filesystem\Path; use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\Http\HttpFactory; use Joomla\CMS\Language\Text; use Joomla\CMS\Log\Log; use Joomla\CMS\Mail\Exception\MailDisabledException; use Joomla\CMS\Mail\MailerFactoryAwareInterface; use Joomla\CMS\Mail\MailerFactoryAwareTrait; use Joomla\CMS\Mail\MailTemplate; use Joomla\CMS\MVC\Model\FormModel; use Joomla\CMS\Table\Asset; use Joomla\CMS\Table\Table; use Joomla\CMS\Uri\Uri; use Joomla\CMS\User\UserHelper; use Joomla\Database\DatabaseDriver; use Joomla\Database\ParameterType; use Joomla\Filesystem\File; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; use PHPMailer\PHPMailer\Exception as phpMailerException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Model for the global configuration * * @since 3.2 */ class ApplicationModel extends FormModel implements MailerFactoryAwareInterface { use MailerFactoryAwareTrait; /** * Array of protected password fields from the configuration.php * * @var array * @since 3.9.23 */ private $protectedConfigurationFields = ['password', 'secret', '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 = [], $loadData = true) { // Get the form. $form = $this->loadForm('com_config.application', 'application', ['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'] = $this->getDatabase()->getName(); // Prime the asset_id for the rules. $data['asset_id'] = 1; // Get the text filter data $params = ComponentHelper::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 = ComponentHelper::getParams('com_content'); $data['filters'] = ArrayHelper::fromObject($contentParams->get('filters')); } // Check for data in the session. $temp = Factory::getApplication()->getUserState('com_config.config.global.data'); // Merge in the session data. if (!empty($temp)) { // $temp can sometimes be an object, and we need it to be an array if (is_object($temp)) { $temp = ArrayHelper::fromObject($temp); } $data = array_merge($temp, $data); } // Correct error_reporting value, since we removed "development", the "maximum" should be set instead // @TODO: This can be removed in 5.0 if (!empty($data['error_reporting']) && $data['error_reporting'] === 'development') { $data['error_reporting'] = 'maximum'; } return $data; } /** * Method to validate the db connection properties. * * @param array $data An array containing all global config data. * * @return array|boolean Array with the validated global config data or boolean false on a validation failure. * * @since 4.0.0 */ public function validateDbConnection($data) { // Validate database connection encryption options if ((int) $data['dbencryption'] === 0) { // Reset unused options if (!empty($data['dbsslkey'])) { $data['dbsslkey'] = ''; } if (!empty($data['dbsslcert'])) { $data['dbsslcert'] = ''; } if ((bool) $data['dbsslverifyservercert'] === true) { $data['dbsslverifyservercert'] = false; } if (!empty($data['dbsslca'])) { $data['dbsslca'] = ''; } if (!empty($data['dbsslcipher'])) { $data['dbsslcipher'] = ''; } } else { // Check localhost if (strtolower($data['host']) === 'localhost') { Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_DATABASE_ENCRYPTION_LOCALHOST'), 'error'); return false; } // Check CA file and folder depending on database type if server certificate verification if ((bool) $data['dbsslverifyservercert'] === true) { if (empty($data['dbsslca'])) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_EMPTY', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CA_LABEL') ), 'error' ); return false; } if (!is_file(Path::clean($data['dbsslca']))) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_BAD', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CA_LABEL') ), 'error' ); return false; } } else { // Reset unused option if (!empty($data['dbsslca'])) { $data['dbsslca'] = ''; } } // Check key and certificate if two-way encryption if ((int) $data['dbencryption'] === 2) { if (empty($data['dbsslkey'])) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_EMPTY', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_KEY_LABEL') ), 'error' ); return false; } if (!is_file(Path::clean($data['dbsslkey']))) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_BAD', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_KEY_LABEL') ), 'error' ); return false; } if (empty($data['dbsslcert'])) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_EMPTY', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CERT_LABEL') ), 'error' ); return false; } if (!is_file(Path::clean($data['dbsslcert']))) { Factory::getApplication()->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_DATABASE_ENCRYPTION_FILE_FIELD_BAD', Text::_('COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CERT_LABEL') ), 'error' ); return false; } } else { // Reset unused options if (!empty($data['dbsslkey'])) { $data['dbsslkey'] = ''; } if (!empty($data['dbsslcert'])) { $data['dbsslcert'] = ''; } } } 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 = Factory::getApplication(); // Try to load the values from the configuration file foreach ($this->protectedConfigurationFields as $fieldKey) { if (!isset($data[$fieldKey])) { $data[$fieldKey] = $app->get($fieldKey, ''); } } // Check that we aren't setting wrong database configuration $options = [ 'driver' => $data['dbtype'], 'host' => $data['host'], 'user' => $data['user'], 'password' => $data['password'], 'database' => $data['db'], 'prefix' => $data['dbprefix'], ]; if ((int) $data['dbencryption'] !== 0) { $options['ssl'] = [ 'enable' => true, 'verify_server_cert' => (bool) $data['dbsslverifyservercert'], ]; foreach (['cipher', 'ca', 'key', 'cert'] as $value) { $confVal = trim($data['dbssl' . $value]); if ($confVal !== '') { $options['ssl'][$value] = $confVal; } } } try { $revisedDbo = DatabaseDriver::getInstance($options); $revisedDbo->getVersion(); } catch (\Exception $e) { $app->enqueueMessage(Text::sprintf('COM_CONFIG_ERROR_DATABASE_NOT_AVAILABLE', $e->getCode(), $e->getMessage()), 'error'); return false; } if ((int) $data['dbencryption'] !== 0 && empty($revisedDbo->getConnectionEncryption())) { if ($revisedDbo->isConnectionEncryptionSupported()) { Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_DATABASE_ENCRYPTION_CONN_NOT_ENCRYPT'), 'error'); } else { Factory::getApplication()->enqueueMessage(Text::_('COM_CONFIG_ERROR_DATABASE_ENCRYPTION_SRV_NOT_SUPPORTS'), 'error'); } return false; } // Check if we can set the Force SSL option if ((int) $data['force_ssl'] !== 0 && (int) $data['force_ssl'] !== (int) $app->get('force_ssl', '0')) { try { // Make an HTTPS request to check if the site is available in HTTPS. $host = Uri::getInstance()->getHost(); $options = new 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', [ CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_PROXY => null, CURLOPT_PROXYUSERPWD => null, ] ); $response = HttpFactory::getHttp($options)->get('https://' . $host . Uri::root(true) . '/', ['Host' => $host], 10); // If available in HTTPS check also the status code. if (!in_array($response->code, [200, 503, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 401], true)) { throw new \RuntimeException(Text::_('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(Text::sprintf('COM_CONFIG_ERROR_SSL_NOT_AVAILABLE', $e->getMessage()), 'warning'); } } // Save the rules if (isset($data['rules'])) { $rules = new Rules($data['rules']); // Check that we aren't removing our Super User permission // Need to get groups from database, since they might have changed $myGroups = Access::getGroupsByUser($this->getCurrentUser()->get('id')); $myRules = $rules->getData(); $hasSuperAdmin = $myRules['core.admin']->allow($myGroups); if (!$hasSuperAdmin) { $app->enqueueMessage(Text::_('COM_CONFIG_ERROR_REMOVING_SUPER_ADMIN'), 'error'); return false; } $asset = Table::getInstance('asset'); if ($asset->loadByName('root.1')) { $asset->rules = (string) $rules; if (!$asset->check() || !$asset->store()) { $app->enqueueMessage($asset->getError(), 'error'); return false; } } else { $app->enqueueMessage(Text::_('COM_CONFIG_ERROR_ROOT_ASSET_NOT_FOUND'), 'error'); return false; } unset($data['rules']); } // Save the text filters if (isset($data['filters'])) { $registry = new Registry(['filters' => $data['filters']]); $extension = Table::getInstance('extension'); // Get extension_id $extensionId = $extension->find(['name' => 'com_config']); if ($extension->load((int) $extensionId)) { $extension->params = (string) $registry; if (!$extension->check() || !$extension->store()) { $app->enqueueMessage($extension->getError(), 'error'); return false; } } else { $app->enqueueMessage(Text::_('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'] = OutputFilter::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') { $db = $this->getDatabase(); $query = $db->getQuery(true) ->delete($db->quoteName('#__session')) ->where($db->quoteName('time') . ' < ' . (time() - 1)); $db->setQuery($query); $db->execute(); } // Purge the database session table if we are disabling session metadata if ($prev['session_metadata'] == 1 && $data['session_metadata'] == 0) { try { // If we are are using the session handler, purge the extra columns, otherwise truncate the whole session table if ($data['session_handler'] === 'database') { $revisedDbo->setQuery( $revisedDbo->getQuery(true) ->update('#__session') ->set( [ $revisedDbo->quoteName('client_id') . ' = 0', $revisedDbo->quoteName('guest') . ' = NULL', $revisedDbo->quoteName('userid') . ' = NULL', $revisedDbo->quoteName('username') . ' = NULL', ] ) )->execute(); } else { $revisedDbo->truncateTable('#__session'); } } catch (\RuntimeException $e) { /* * The database API logs errors on failures so we don't need to add any error handling mechanisms here. * Also, this data won't be added or checked anymore once the configuration is saved, so it'll purge itself * through normal garbage collection anyway or if not using the database handler someone can purge the * table on their own. Either way, carry on Soldier! */ } } // Ensure custom session file path exists or try to create it if changed if (!empty($data['session_filesystem_path'])) { $currentPath = $prev['session_filesystem_path'] ?? null; if ($currentPath) { $currentPath = Path::clean($currentPath); } $data['session_filesystem_path'] = Path::clean($data['session_filesystem_path']); if ($currentPath !== $data['session_filesystem_path']) { if (!Folder::exists($data['session_filesystem_path']) && !Folder::create($data['session_filesystem_path'])) { try { Log::add( Text::sprintf( 'COM_CONFIG_ERROR_CUSTOM_SESSION_FILESYSTEM_PATH_NOTWRITABLE_USING_DEFAULT', $data['session_filesystem_path'] ), Log::WARNING, 'jerror' ); } catch (\RuntimeException $logException) { $app->enqueueMessage( Text::sprintf( 'COM_CONFIG_ERROR_CUSTOM_SESSION_FILESYSTEM_PATH_NOTWRITABLE_USING_DEFAULT', $data['session_filesystem_path'] ), 'warning' ); } $data['session_filesystem_path'] = $currentPath; } } } // Set the shared session configuration if (isset($data['shared_session'])) { $currentShared = $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'] = UserHelper::genRandomPassword(16); } // Has the user disabled shared sessions? if ($data['shared_session'] == 0 && $currentShared == 1) { // Remove the session name value unset($data['session_name']); } } // Set the shared session configuration if (isset($data['shared_session'])) { $currentShared = $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'] = UserHelper::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_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_CACHE && @opendir(JPATH_CACHE) != false) { try { Log::add( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_CACHE_PATH_NOTWRITABLE_USING_DEFAULT', $path, JPATH_CACHE), Log::WARNING, 'jerror' ); } catch (\RuntimeException $logException) { $app->enqueueMessage( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_CACHE_PATH_NOTWRITABLE_USING_DEFAULT', $path, JPATH_CACHE), 'warning' ); } $path = JPATH_CACHE; $error = false; $data['cache_path'] = ''; } if ($error) { try { Log::add(Text::sprintf('COM_CONFIG_ERROR_CACHE_PATH_NOTWRITABLE', $path), Log::WARNING, 'jerror'); } catch (\RuntimeException $exception) { $app->enqueueMessage(Text::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 { Factory::getCache()->clean(); } catch (CacheConnectingException $exception) { try { Log::add(Text::_('COM_CONFIG_ERROR_CACHE_CONNECTION_FAILED'), Log::WARNING, 'jerror'); } catch (\RuntimeException $logException) { $app->enqueueMessage(Text::_('COM_CONFIG_ERROR_CACHE_CONNECTION_FAILED'), 'warning'); } } catch (UnsupportedCacheException $exception) { try { Log::add(Text::_('COM_CONFIG_ERROR_CACHE_DRIVER_UNSUPPORTED'), Log::WARNING, 'jerror'); } catch (\RuntimeException $logException) { $app->enqueueMessage(Text::_('COM_CONFIG_ERROR_CACHE_DRIVER_UNSUPPORTED'), 'warning'); } } } /* * Look for a custom tmp_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 */ $defaultTmpPath = JPATH_ROOT . '/tmp'; if (!empty($data['tmp_path'])) { $path = $data['tmp_path']; } elseif (!empty($prev['tmp_path'])) { $path = $prev['tmp_path']; } else { $path = $defaultTmpPath; } $path = Path::clean($path); // Give a warning if the tmp-folder is not valid or not writable if (!is_dir($path) || !is_writable($path)) { $error = true; // If a custom path is in use, try using the system default tmp path if ($path !== $defaultTmpPath && is_dir($defaultTmpPath) && is_writable($defaultTmpPath)) { try { Log::add( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_TEMP_PATH_NOTWRITABLE_USING_DEFAULT', $path, $defaultTmpPath), Log::WARNING, 'jerror' ); } catch (\RuntimeException $logException) { $app->enqueueMessage( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_TEMP_PATH_NOTWRITABLE_USING_DEFAULT', $path, $defaultTmpPath), 'warning' ); } $error = false; $data['tmp_path'] = $defaultTmpPath; } if ($error) { try { Log::add(Text::sprintf('COM_CONFIG_ERROR_TMP_PATH_NOTWRITABLE', $path), Log::WARNING, 'jerror'); } catch (\RuntimeException $exception) { $app->enqueueMessage(Text::sprintf('COM_CONFIG_ERROR_TMP_PATH_NOTWRITABLE', $path), 'warning'); } } } /* * Look for a custom log_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 */ $defaultLogPath = JPATH_ADMINISTRATOR . '/logs'; if (!empty($data['log_path'])) { $path = $data['log_path']; } elseif (!empty($prev['log_path'])) { $path = $prev['log_path']; } else { $path = $defaultLogPath; } $path = Path::clean($path); // Give a warning if the log-folder is not valid or not writable if (!is_dir($path) || !is_writable($path)) { $error = true; // If a custom path is in use, try using the system default log path if ($path !== $defaultLogPath && is_dir($defaultLogPath) && is_writable($defaultLogPath)) { try { Log::add( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_LOG_PATH_NOTWRITABLE_USING_DEFAULT', $path, $defaultLogPath), Log::WARNING, 'jerror' ); } catch (\RuntimeException $logException) { $app->enqueueMessage( Text::sprintf('COM_CONFIG_ERROR_CUSTOM_LOG_PATH_NOTWRITABLE_USING_DEFAULT', $path, $defaultLogPath), 'warning' ); } $error = false; $data['log_path'] = $defaultLogPath; } if ($error) { try { Log::add(Text::sprintf('COM_CONFIG_ERROR_LOG_PATH_NOTWRITABLE', $path), Log::WARNING, 'jerror'); } catch (\RuntimeException $exception) { $app->enqueueMessage(Text::sprintf('COM_CONFIG_ERROR_LOG_PATH_NOTWRITABLE', $path), 'warning'); } } } // Create the new configuration object. $config = new Registry($data); // Overwrite webservices cors settings $app->set('cors', $data['cors']); $app->set('cors_allow_origin', $data['cors_allow_origin']); $app->set('cors_allow_headers', $data['cors_allow_headers']); $app->set('cors_allow_methods', $data['cors_allow_methods']); // Clear cache of com_config component. $this->cleanCache('_system'); $result = $app->triggerEvent('onApplicationBeforeSave', [$config]); // Store the data. if (in_array(false, $result, true)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING')); } // Write the configuration file. $result = $this->writeConfigFile($config); // Trigger the after save event. $app->triggerEvent('onApplicationAfterSave', [$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() { $app = Factory::getApplication(); // 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 = $app->triggerEvent('onApplicationBeforeSave', [$config]); // Store the data. if (in_array(false, $result, true)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_UNKNOWN_BEFORE_SAVING')); } // Write the configuration file. $result = $this->writeConfigFile($config); // Trigger the after save event. $app->triggerEvent('onApplicationAfterSave', [$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) { // Set the configuration file path. $file = JPATH_CONFIGURATION . '/configuration.php'; $app = Factory::getApplication(); // Attempt to make the file writeable. if (Path::isOwner($file) && !Path::setPermissions($file, '0644')) { $app->enqueueMessage(Text::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'notice'); } // Attempt to write the configuration file as a PHP class named JConfig. $configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]); if (!File::write($file, $configuration)) { throw new \RuntimeException(Text::_('COM_CONFIG_ERROR_WRITE_FAILED')); } // Attempt to make the file unwriteable. if (Path::isOwner($file) && !Path::setPermissions($file, '0444')) { $app->enqueueMessage(Text::_('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|bool A list of result data or false on failure. * * @since 3.5 */ public function storePermissions($permission = null) { $app = Factory::getApplication(); $input = $app->getInput(); $user = $this->getCurrentUser(); if (is_null($permission)) { // Get data from input. $permission = [ 'component' => $input->json->get('comp'), 'action' => $input->json->get('action'), 'rule' => $input->json->get('rule'), 'value' => $input->json->get('value'), 'title' => $input->json->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(Text::_('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(Text::_('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 = Access::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 = Access::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(Text::_('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(Text::_('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(Text::_('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(Text::_('JLIB_USER_ERROR_CANNOT_DEMOTE_SELF'), 'error'); return false; } try { /** @var Asset $asset */ $asset = Table::getInstance('asset'); $result = $asset->loadByName($permission['component']); if ($result === false) { $data = [$permission['action'] => [$permission['rule'] => $permission['value']]]; $rules = new Rules($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. /** @var Asset $parentAsset */ $parentAsset = Table::getInstance('Asset'); if (strpos($asset->name, '.') !== false) { $assetParts = explode('.', $asset->name); $parentAsset->loadByName($assetParts[0]); $parentAssetId = $parentAsset->id; } else { $parentAssetId = $parentAsset->getRootId(); } /** * @todo: 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']] = []; } // Check if we already have a rule entry. if (!isset($temp[$permission['action']][$permission['rule']])) { $temp[$permission['action']][$permission['rule']] = []; } // 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(Text::_('JLIB_UNKNOWN'), 'error'); return false; } } catch (\Exception $e) { $app->enqueueMessage($e->getMessage(), 'error'); return false; } // All checks done. $result = [ 'text' => '', 'class' => '', 'result' => true, ]; // Show the current effective calculated permission considering current group, path and cascade. try { // The database instance $db = $this->getDatabase(); // Get the asset id by the name of the component. $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__assets')) ->where($db->quoteName('name') . ' = :component') ->bind(':component', $permission['component']); $db->setQuery($query); $assetId = (int) $db->loadResult(); // Fetch the parent asset id. $parentAssetId = null; /** * @todo: 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 a child 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($db->quoteName('parent_id')) ->from($db->quoteName('#__assets')) ->where($db->quoteName('id') . ' = :assetid') ->bind(':assetid', $assetId, ParameterType::INTEGER); $db->setQuery($query); $parentAssetId = (int) $db->loadResult(); } // Get the group parent id of the current group. $rule = (int) $permission['rule']; $query->clear() ->select($db->quoteName('parent_id')) ->from($db->quoteName('#__usergroups')) ->where($db->quoteName('id') . ' = :rule') ->bind(':rule', $rule, ParameterType::INTEGER); $db->setQuery($query); $parentGroupId = (int) $db->loadResult(); // Count the number of child groups of the current group. $query->clear() ->select('COUNT(' . $db->quoteName('id') . ')') ->from($db->quoteName('#__usergroups')) ->where($db->quoteName('parent_id') . ' = :rule') ->bind(':rule', $rule, ParameterType::INTEGER); $db->setQuery($query); $totalChildGroups = (int) $db->loadResult(); } catch (\Exception $e) { $app->enqueueMessage($e->getMessage(), 'error'); return false; } // Clear access statistics. Access::clearStatics(); // After current group permission is changed we need to check again if the group has Super User permissions. $isSuperUserGroupAfter = Access::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 = Access::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 = Access::checkGroup($permission['rule'], $permission['action'], $assetId); if (!empty($parentAssetId)) { $inheritedGroupParentAssetRule = Access::checkGroup($permission['rule'], $permission['action'], $parentAssetId); } else { $inheritedGroupParentAssetRule = null; } $inheritedParentGroupRule = !empty($parentGroupId) ? Access::checkGroup($parentGroupId, $permission['action'], $assetId) : null; // Current group is a Super User group, so calculated setting is "Allowed (Super User)". if ($isSuperUserGroupAfter) { $result['class'] = 'badge bg-success'; $result['text'] = '<span class="icon-lock icon-white" aria-hidden="true"></span>' . Text::_('JLIB_RULES_ALLOWED_ADMIN'); } else { // Not super user. // 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'] = 'badge bg-danger'; $result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED_INHERITED'); } else { // If recursive calculated setting is "Allowed". Calculated permission is "Allowed (Inherited)". $result['class'] = 'badge bg-success'; $result['text'] = Text::_('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'] = 'badge bg-danger'; $result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED'); } elseif ($assetRule === true) { // If there is an explicit permission is "Allowed". Calculated permission is "Allowed". $result['class'] = 'badge bg-success'; $result['text'] = Text::_('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'] = 'badge bg-danger'; $result['text'] = Text::_('JLIB_RULES_NOT_ALLOWED_DEFAULT'); } elseif ($inheritedGroupParentAssetRule === false || $inheritedParentGroupRule === false) { /** * 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)". */ $result['class'] = 'badge bg-danger'; $result['text'] = '<span class="icon-lock icon-white" aria-hidden="true"></span>' . Text::_('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(Text::_('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(Text::_('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 */ public function sendTestMail() { // Set the new values to test with the current settings $app = Factory::getApplication(); $user = $this->getCurrentUser(); $input = $app->getInput()->json; $smtppass = $input->get('smtppass', null, 'RAW'); $config = new Registry(); $config->set('smtpauth', $input->get('smtpauth')); $config->set('smtpuser', $input->get('smtpuser', '', 'STRING')); $config->set('smtphost', $input->get('smtphost')); $config->set('smtpsecure', $input->get('smtpsecure')); $config->set('smtpport', $input->get('smtpport')); $config->set('mailfrom', $input->get('mailfrom', '', 'STRING')); $config->set('fromname', $input->get('fromname', '', 'STRING')); $config->set('mailer', $input->get('mailer')); $config->set('mailonline', $input->get('mailonline')); // Use smtppass only if it was submitted if ($smtppass !== null) { $config->set('smtppass', $smtppass); } $mail = $this->getMailerFactory()->createMailer($config); // Prepare email and try to send it $mailer = new MailTemplate('com_config.test_mail', $user->getParam('language', $app->get('language')), $mail); $mailer->addTemplateData( [ // Replace the occurrences of "@" and "|" in the site name 'sitename' => str_replace(['@', '|'], '', $app->get('sitename')), 'method' => Text::_('COM_CONFIG_SENDMAIL_METHOD_' . strtoupper($mail->Mailer)), ] ); $mailer->addRecipient($app->get('mailfrom'), $app->get('fromname')); try { $mailSent = $mailer->send(); } catch (MailDisabledException | phpMailerException $e) { $app->enqueueMessage($e->getMessage(), 'error'); return false; } if ($mailSent === true) { $methodName = Text::_('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(Text::sprintf('COM_CONFIG_SENDMAIL_SUCCESS_FALLBACK', $app->get('mailfrom'), $methodName), 'warning'); } else { $app->enqueueMessage(Text::sprintf('COM_CONFIG_SENDMAIL_SUCCESS', $app->get('mailfrom'), $methodName), 'message'); } return true; } $app->enqueueMessage(Text::_('COM_CONFIG_SENDMAIL_ERROR'), 'error'); return false; } } index.html 0000604 00000000037 15172734602 0006544 0 ustar 00 <!DOCTYPE html><title></title> forms/application.xml 0000644 00000071644 15172734602 0010742 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <form> <config> <inlinehelp button="show"/> </config> <fieldset name="cache" label="COM_CONFIG_CACHE_SETTINGS_LABEL"> <field name="caching" type="list" label="COM_CONFIG_FIELD_CACHE_LABEL" default="2" filter="integer" validate="options" > <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> <field name="cache_handler" type="cachehandler" label="COM_CONFIG_FIELD_CACHE_HANDLER_LABEL" default="" filter="word" showon="caching:1,2" /> <field name="cache_platformprefix" type="radio" layout="joomla.form.field.radio.switcher" default="0" label="COM_CONFIG_FIELD_CACHE_PLATFORMPREFIX_LABEL" filter="boolean" showon="caching:1,2" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="cachetime" type="number" min="1" default="15" label="COM_CONFIG_FIELD_CACHE_TIME_LABEL" required="true" filter="integer" validate="number" showon="caching:1,2" /> <field name="cache_path" type="text" label="COM_CONFIG_FIELD_CACHE_PATH_LABEL" filter="path" showon="cache_handler:file[AND]caching:1,2" /> <field name="memcached_persist" type="radio" label="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_LABEL" layout="joomla.form.field.radio.switcher" default="1" showon="cache_handler:memcached[AND]caching:1,2" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="memcached_compress" type="radio" label="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_LABEL" layout="joomla.form.field.radio.switcher" default="0" showon="cache_handler:memcached[AND]caching:1,2" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="memcached_server_host" type="text" label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL" default="localhost" showon="cache_handler:memcached[AND]caching:1,2" filter="string" /> <field name="memcached_server_port" type="number" label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL" showon="cache_handler:memcached[AND]caching:1,2" min="1" max="65535" default="11211" filter="integer" validate="number" /> <field name="redis_persist" type="radio" label="COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" showon="cache_handler:redis[AND]caching:1,2" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="redis_server_host" type="text" label="COM_CONFIG_FIELD_REDIS_HOST_LABEL" default="localhost" filter="string" showon="cache_handler:redis[AND]caching:1,2" /> <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[AND]caching:1,2" min="1" max="65535" default="6379" filter="integer" validate="number" /> <field name="redis_server_auth" type="password" label="COM_CONFIG_FIELD_REDIS_AUTH_LABEL" filter="raw" showon="cache_handler:redis[AND]caching:1,2" autocomplete="off" hint="***************" lock="true" /> <field name="redis_server_db" type="number" label="COM_CONFIG_FIELD_REDIS_DB_LABEL" default="0" filter="integer" showon="cache_handler:redis[AND]caching:1,2" /> </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,postgresql" filter="string" /> <field name="host" type="text" label="COM_CONFIG_FIELD_DATABASE_HOST_LABEL" required="true" filter="string" /> <field name="user" type="text" label="COM_CONFIG_FIELD_DATABASE_USERNAME_LABEL" required="true" filter="string" /> <field name="password" type="password" label="COM_CONFIG_FIELD_DATABASE_PASSWORD_LABEL" description="COM_CONFIG_FIELD_DATABASE_PASSWORD_DESC" filter="raw" autocomplete="off" lock="true" /> <field name="db" type="text" label="COM_CONFIG_FIELD_DATABASE_NAME_LABEL" required="true" filter="string" /> <field name="dbprefix" type="text" label="COM_CONFIG_FIELD_DATABASE_PREFIX_LABEL" default="jos_" filter="string" /> <field name="dbencryption" type="list" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_MODE_LABEL" default="0" filter="integer" validate="options" > <option value="0">COM_CONFIG_FIELD_DATABASE_ENCRYPTION_MODE_VALUE_NONE</option> <option value="1">COM_CONFIG_FIELD_DATABASE_ENCRYPTION_MODE_VALUE_ONE_WAY</option> <option value="2">COM_CONFIG_FIELD_DATABASE_ENCRYPTION_MODE_VALUE_TWO_WAY</option> </field> <field name="dbsslkey" type="text" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_KEY_LABEL" filter="path" showon="dbencryption:2" /> <field name="dbsslcert" type="text" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CERT_LABEL" filter="path" showon="dbencryption:2" /> <field name="dbsslverifyservercert" type="radio" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_VERIFY_SERVER_CERT_LABEL" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" showon="dbencryption:1,2" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="dbsslca" type="text" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CA_LABEL" filter="path" showon="dbencryption:1,2[AND]dbsslverifyservercert:1" /> <field name="dbsslcipher" type="text" label="COM_CONFIG_FIELD_DATABASE_ENCRYPTION_CIPHER_LABEL" filter="string" showon="dbtype:mysql,mysqli[AND]dbencryption:2" /> </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" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="debug_lang" type="radio" label="COM_CONFIG_FIELD_DEBUG_LANG_LABEL" description="COM_CONFIG_FIELD_DEBUG_LANG_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</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" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" 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="webservices" label="CONFIG_WEBSERVICES_SETTINGS_LABEL"> <field name="cors" type="radio" label="COM_CONFIG_FIELD_WEBSERVICES_CORS_OFF_LABEL" description="COM_CONFIG_FIELD_WEBSERVICES_CORS_OFF_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="cors_allow_origin" type="text" label="Access-Control-Allow-Origin" description="COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_ORIGIN_DESC" translate_label="false" default="*" showon="cors:1" /> <field name="cors_allow_headers" type="text" label="Access-Control-Allow-Headers" description="COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_HEADERS_DESC" translate_label="false" default="Content-Type,X-Joomla-Token" showon="cors:1" /> <field name="cors_allow_methods" type="text" label="Access-Control-Allow-Methods" description="COM_CONFIG_FIELD_WEBSERVICES_CORS_ALLOW_METHODS_DESC" translate_label="false" showon="cors:1" /> </fieldset> <fieldset name="proxy" label="CONFIG_PROXY_SETTINGS_LABEL"> <field name="behind_loadbalancer" type="radio" label="COM_CONFIG_FIELD_LOADBALANCER_ENABLE_LABEL" description="COM_CONFIG_FIELD_LOADBALANCER_ENABLE_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="proxy_enable" type="radio" label="COM_CONFIG_FIELD_PROXY_ENABLE_LABEL" description="COM_CONFIG_FIELD_PROXY_ENABLE_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</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" /> <field name="proxy_port" type="number" label="COM_CONFIG_FIELD_PROXY_PORT_LABEL" showon="proxy_enable:1" min="1" max="65535" hint="8080" validate="number" filter="integer" /> <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" /> <field name="proxy_pass" type="password" label="COM_CONFIG_FIELD_PROXY_PASSWORD_LABEL" filter="raw" showon="proxy_enable:1" autocomplete="off" 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" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="massmailoff" type="radio" label="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_LABEL" description="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" showon="mailonline:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="mailfrom" type="email" label="COM_CONFIG_FIELD_MAIL_FROM_EMAIL_LABEL" filter="string" validate="email" showon="mailonline:1" /> <field name="fromname" type="text" label="COM_CONFIG_FIELD_MAIL_FROM_NAME_LABEL" filter="string" showon="mailonline:1" /> <field name="replyto" type="email" label="COM_CONFIG_FIELD_MAIL_REPLY_TO_EMAIL_LABEL" filter="string" validate="email" showon="mailonline:1" /> <field name="replytoname" type="text" label="COM_CONFIG_FIELD_MAIL_REPLY_TO_NAME_LABEL" filter="string" showon="mailonline:1" /> <field name="mailer" type="list" label="COM_CONFIG_FIELD_MAIL_MAILER_LABEL" default="mail" filter="word" showon="mailonline:1" validate="options" > <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" default="/usr/sbin/sendmail" showon="mailonline:1[AND]mailer:sendmail" filter="string" /> <field name="smtphost" type="text" label="COM_CONFIG_FIELD_MAIL_SMTP_HOST_LABEL" default="localhost" showon="mailonline:1[AND]mailer:smtp" filter="string" /> <field name="smtpport" type="number" label="COM_CONFIG_FIELD_MAIL_SMTP_PORT_LABEL" showon="mailonline:1[AND]mailer:smtp" min="1" max="65535" default="25" hint="25" validate="number" filter="integer" /> <field name="smtpsecure" type="list" label="COM_CONFIG_FIELD_MAIL_SMTP_SECURE_LABEL" default="none" showon="mailonline:1[AND]mailer:smtp" filter="word" validate="options" > <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" layout="joomla.form.field.radio.switcher" label="COM_CONFIG_FIELD_MAIL_SMTP_AUTH_LABEL" default="0" showon="mailonline:1[AND]mailer:smtp" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="smtpuser" type="text" label="COM_CONFIG_FIELD_MAIL_SMTP_USERNAME_LABEL" showon="mailonline:1[AND]mailer:smtp[AND]smtpauth:1" filter="string" autocomplete="off" /> <field name="smtppass" type="password" label="COM_CONFIG_FIELD_MAIL_SMTP_PASSWORD_LABEL" showon="mailonline:1[AND]mailer:smtp[AND]smtpauth:1" filter="raw" autocomplete="off" lock="true" /> </fieldset> <fieldset name="metadata" label="COM_CONFIG_METADATA_SETTINGS"> <field name="MetaDesc" type="textarea" label="COM_CONFIG_FIELD_METADESC_LABEL" filter="string" cols="60" rows="3" maxlength="160" charcounter="true" /> <field name="robots" type="list" label="JFIELD_METADATA_ROBOTS_LABEL" default="" validate="options" > <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" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" > <option value="0">JHIDE</option> <option value="1">JSHOW</option> </field> <field name="MetaVersion" type="radio" label="COM_CONFIG_FIELD_METAVERSION_LABEL" description="COM_CONFIG_FIELD_METAVERSION_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JHIDE</option> <option value="1">JSHOW</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" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="sef_rewrite" type="radio" label="COM_CONFIG_FIELD_SEF_REWRITE_LABEL" description="COM_CONFIG_FIELD_SEF_REWRITE_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" showon="sef:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="sef_note" type="note" label="COM_CONFIG_FIELD_SEF_REWRITE_NOTE" heading="p" class="small" showon="sef:1[AND]sef_rewrite:1" /> <field name="sef_suffix" type="radio" label="COM_CONFIG_FIELD_SEF_SUFFIX_LABEL" description="COM_CONFIG_FIELD_SEF_SUFFIX_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" showon="sef:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="unicodeslugs" type="radio" label="COM_CONFIG_FIELD_UNICODESLUGS_LABEL" description="COM_CONFIG_FIELD_UNICODESLUGS_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" showon="sef:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="sitename_pagetitles" type="list" label="COM_CONFIG_FIELD_SITENAME_PAGETITLES_LABEL" default="0" filter="integer" validate="options" > <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" /> <field name="gzip" type="radio" label="COM_CONFIG_FIELD_GZIP_COMPRESSION_LABEL" description="COM_CONFIG_FIELD_GZIP_COMPRESSION_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</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" validate="options" > <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> </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" validate="options" > <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" default="filesystem" label="COM_CONFIG_FIELD_SESSION_HANDLER_LABEL" filter="word" /> <field name="session_filesystem_path" type="text" default="" label="COM_CONFIG_FIELD_FILESYSTEM_PATH_LABEL" description="COM_CONFIG_FIELD_FILESYSTEM_PATH_DESC" filter="path" showon="session_handler:filesystem" /> <field name="session_memcached_server_host" type="text" label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL" default="localhost" filter="string" showon="session_handler:memcached" /> <field name="session_memcached_server_port" type="number" label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL" showon="session_handler:memcached" min="1" max="65535" default="11211" validate="number" filter="integer" /> <field name="session_redis_persist" type="radio" label="COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL" layout="joomla.form.field.radio.switcher" default="1" filter="integer" showon="session_handler:redis" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="session_redis_server_host" type="text" label="COM_CONFIG_FIELD_REDIS_HOST_LABEL" default="localhost" filter="string" showon="session_handler:redis" /> <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" /> <field name="session_redis_server_auth" type="password" label="COM_CONFIG_FIELD_REDIS_AUTH_LABEL" filter="raw" showon="session_handler:redis" autocomplete="off" lock="true" /> <field name="session_redis_server_db" type="number" label="COM_CONFIG_FIELD_REDIS_DB_LABEL" default="0" filter="integer" showon="session_handler:redis" /> <field name="lifetime" type="number" label="COM_CONFIG_FIELD_SESSION_TIME_LABEL" min="1" max="16383" default="15" filter="integer" validate="number" /> <field name="shared_session" type="radio" label="COM_CONFIG_FIELD_SHARED_SESSION_LABEL" description="COM_CONFIG_FIELD_SHARED_SESSION_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="session_metadata" type="radio" layout="joomla.form.field.radio.switcher" default="1" label="COM_CONFIG_FIELD_SESSION_METADATA_LABEL" description="COM_CONFIG_FIELD_SESSION_METADATA_DESC" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="session_metadata_for_guest" type="radio" label="COM_CONFIG_FIELD_SESSION_METADATA_GUEST_LABEL" description="COM_CONFIG_FIELD_SESSION_METADATA_GUEST_DESC" layout="joomla.form.field.radio.switcher" default="1" filter="boolean" showon="session_metadata:1" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="site" label="CONFIG_SITE_SETTINGS_LABEL"> <field name="sitename" type="text" label="COM_CONFIG_FIELD_SITE_NAME_LABEL" required="true" filter="string" /> <field name="offline" type="radio" label="COM_CONFIG_FIELD_SITE_OFFLINE_LABEL" layout="joomla.form.field.radio.switcher" default="0" filter="boolean" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="display_offline_message" type="list" label="COM_CONFIG_FIELD_SITE_DISPLAY_MESSAGE_LABEL" default="1" filter="integer" showon="offline:1" validate="options" > <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" filter="safehtml" cols="60" rows="2" showon="offline:1[AND]display_offline_message:1" /> <field name="offline_image" type="media" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" label="COM_CONFIG_FIELD_OFFLINE_IMAGE_LABEL" showon="offline:1" /> <field name="frontediting" type="list" label="COM_CONFIG_FRONTEDITING_LABEL" description="COM_CONFIG_FRONTEDITING_DESC" default="1" filter="integer" validate="options" > <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="UINT" validate="options" /> <field name="list_limit" type="list" label="COM_CONFIG_FIELD_DEFAULT_LIST_LIMIT_LABEL" default="20" filter="integer" validate="options" > <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" validate="options" > <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" default="none" filter="word" validate="options" > <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="logging" label="CONFIG_LOGGING_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" /> <field name="log_everything" type="radio" label="COM_CONFIG_FIELD_LOG_EVERYTHING_LABEL" description="COM_CONFIG_FIELD_LOG_EVERYTHING_DESC" layout="joomla.form.field.radio.switcher" default="0" filter="integer" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="log_deprecated" type="radio" label="COM_CONFIG_FIELD_LOG_DEPRECATED_LABEL" layout="joomla.form.field.radio.switcher" default="0" filter="integer" > <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="logging_custom" label="CONFIG_LOGGING_CUSTOM_SETTINGS_LABEL"> <field name="log_priorities" type="list" label="COM_CONFIG_FIELD_LOG_PRIORITIES_LABEL" multiple="true" layout="joomla.form.field.list-fancy-select" default="all" validate="options" > <option value="all">COM_CONFIG_FIELD_LOG_PRIORITIES_ALL</option> <option value="emergency">COM_CONFIG_FIELD_LOG_PRIORITIES_EMERGENCY</option> <option value="alert">COM_CONFIG_FIELD_LOG_PRIORITIES_ALERT</option> <option value="critical">COM_CONFIG_FIELD_LOG_PRIORITIES_CRITICAL</option> <option value="error">COM_CONFIG_FIELD_LOG_PRIORITIES_ERROR</option> <option value="warning">COM_CONFIG_FIELD_LOG_PRIORITIES_WARNING</option> <option value="notice">COM_CONFIG_FIELD_LOG_PRIORITIES_NOTICE</option> <option value="info">COM_CONFIG_FIELD_LOG_PRIORITIES_INFO</option> <option value="debug">COM_CONFIG_FIELD_LOG_PRIORITIES_DEBUG</option> </field> <field name="log_categories" type="text" label="COM_CONFIG_FIELD_LOG_CATEGORIES_LABEL" description="COM_CONFIG_FIELD_LOG_CATEGORIES_DESC" default="" /> <field name="log_category_mode" type="radio" label="COM_CONFIG_FIELD_LOG_CATEGORY_MODE_LABEL" layout="joomla.form.field.radio.switcher" default="0" filter="integer" > <option value="0">COM_CONFIG_FIELD_LOG_CATEGORY_MODE_INCLUDE</option> <option value="1">COM_CONFIG_FIELD_LOG_CATEGORY_MODE_EXCLUDE</option> </field> </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" /> <field name="cookie_path" type="text" label="COM_CONFIG_FIELD_COOKIE_PATH_LABEL" filter="string" /> </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" /> <action name="core.login.admin" title="JACTION_LOGIN_ADMIN" /> <action name="core.login.api" title="JACTION_LOGIN_API" /> <action name="core.login.offline" title="JACTION_LOGIN_OFFLINE" /> <action name="core.admin" title="JACTION_ADMIN_GLOBAL" /> <action name="core.options" title="JACTION_OPTIONS" /> <action name="core.manage" title="JACTION_MANAGE" /> <action name="core.create" title="JACTION_CREATE" /> <action name="core.delete" title="JACTION_DELETE" /> <action name="core.edit" title="JACTION_EDIT" /> <action name="core.edit.state" title="JACTION_EDITSTATE" /> <action name="core.edit.own" title="JACTION_EDITOWN" /> <action name="core.edit.value" title="JACTION_EDITVALUE" /> </field> </fieldset> <fieldset addfieldprefix="Joomla\Component\Config\Administrator\Field" 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>
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings