- md5
- be37846c930d7163a4f8079aa84d8cd2
- sha1
- c0886905ff5758774d22652d8f92fbe8bf61c5d7
- sha256
- 4147febf5ab9f5b56c1a8ebfd6ce299b4ae34b144f49ffd1c90e446fa87eb3c5
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
<?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;
/**
* 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();
$user = $this->app->getIdentity();
} catch (\Exception $e) {
$this->app->enqueueMessage($e->getMessage(), 'error');
return false;
}
$this->userIsSuperAdmin = $user->authorise('core.admin');
// Required data
$requiredData = array(
'sitename' => null,
'offline' => null,
'access' => null,
'list_limit' => null,
'MetaDesc' => null,
'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);
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.