[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_config 6 * 7 * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Config\Administrator\Controller; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\MVC\Controller\BaseController; 15 16 // phpcs:disable PSR1.Files.SideEffects 17 \defined('_JEXEC') or die; 18 // phpcs:enable PSR1.Files.SideEffects 19 20 /** 21 * Requests from the frontend 22 * 23 * @since 4.0.0 24 */ 25 class RequestController extends BaseController 26 { 27 /** 28 * Execute the controller. 29 * 30 * @return mixed A rendered view or false 31 * 32 * @since 3.2 33 */ 34 public function getJson() 35 { 36 $componentFolder = $this->input->getWord('option', 'com_config'); 37 38 if ($this->app->isClient('administrator')) { 39 $viewName = $this->input->getWord('view', 'application'); 40 } else { 41 $viewName = $this->input->getWord('view', 'config'); 42 } 43 44 // Register the layout paths for the view 45 $paths = new \SplPriorityQueue(); 46 47 if ($this->app->isClient('administrator')) { 48 $paths->insert(JPATH_ADMINISTRATOR . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 1); 49 } else { 50 $paths->insert(JPATH_BASE . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 1); 51 } 52 53 $model = new \Joomla\Component\Config\Administrator\Model\ApplicationModel(); 54 $component = $model->getState()->get('component.option'); 55 56 // Access check. 57 if ( 58 !$this->app->getIdentity()->authorise('core.admin', $component) 59 && !$this->app->getIdentity()->authorise('core.options', $component) 60 ) { 61 $this->app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'), 'error'); 62 63 return false; 64 } 65 66 try { 67 $data = $model->getData(); 68 $user = $this->app->getIdentity(); 69 } catch (\Exception $e) { 70 $this->app->enqueueMessage($e->getMessage(), 'error'); 71 72 return false; 73 } 74 75 $this->userIsSuperAdmin = $user->authorise('core.admin'); 76 77 // Required data 78 $requiredData = array( 79 'sitename' => null, 80 'offline' => null, 81 'access' => null, 82 'list_limit' => null, 83 'MetaDesc' => null, 84 'MetaRights' => null, 85 'sef' => null, 86 'sitename_pagetitles' => null, 87 'debug' => null, 88 'debug_lang' => null, 89 'error_reporting' => null, 90 'mailfrom' => null, 91 'fromname' => null 92 ); 93 94 $data = array_intersect_key($data, $requiredData); 95 96 return json_encode($data); 97 } 98 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |