Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/controller.tar
Назад
base.php 0000644 00000005161 15117022376 0006176 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Controller * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; use Joomla\Application\AbstractApplication; /** * Joomla Platform Base Controller Class * * @since 3.0.0 * @deprecated 4.0 Use the default MVC library */ abstract class JControllerBase implements JController { /** * The application object. * * @var AbstractApplication * @since 3.0.0 */ protected $app; /** * The input object. * * @var JInput * @since 3.0.0 */ protected $input; /** * Instantiate the controller. * * @param JInput $input The input object. * @param AbstractApplication $app The application object. * * @since 3.0.0 */ public function __construct(JInput $input = null, AbstractApplication $app = null) { // Setup dependencies. $this->app = isset($app) ? $app : $this->loadApplication(); $this->input = isset($input) ? $input : $this->loadInput(); } /** * Get the application object. * * @return AbstractApplication The application object. * * @since 3.0.0 */ public function getApplication() { return $this->app; } /** * Get the input object. * * @return JInput The input object. * * @since 3.0.0 */ public function getInput() { return $this->input; } /** * Serialize the controller. * * @return string The serialized controller. * * @since 3.0.0 */ public function serialize() { return serialize($this->input); } /** * Unserialize the controller. * * @param string $input The serialized controller. * * @return JController Supports chaining. * * @since 3.0.0 * @throws UnexpectedValueException if input is not the right class. */ public function unserialize($input) { // Setup dependencies. $this->app = $this->loadApplication(); // Unserialize the input. $this->input = unserialize($input); if (!($this->input instanceof JInput)) { throw new UnexpectedValueException(sprintf('%s::unserialize would not accept a `%s`.', get_class($this), gettype($this->input))); } return $this; } /** * Load the application object. * * @return AbstractApplication The application object. * * @since 3.0.0 */ protected function loadApplication() { return JFactory::getApplication(); } /** * Load the input object. * * @return JInput The input object. * * @since 3.0.0 */ protected function loadInput() { return $this->app->input; } } controller.php 0000644 00000002251 15117022376 0007444 0 ustar 00 <?php /** * @package Joomla.Platform * @subpackage Controller * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; use Joomla\Application\AbstractApplication; /** * Joomla Platform Controller Interface * * @since 3.0.0 * @deprecated 4.0 Use the default MVC library */ interface JController extends Serializable { /** * Execute the controller. * * @return boolean True if controller finished execution, false if the controller did not * finish execution. A controller might return false if some precondition for * the controller to run has not been satisfied. * * @since 3.0.0 * @throws LogicException * @throws RuntimeException */ public function execute(); /** * Get the application object. * * @return AbstractApplication The application object. * * @since 3.0.0 */ public function getApplication(); /** * Get the input object. * * @return JInput The input object. * * @since 3.0.0 */ public function getInput(); } cancel.php 0000644 00000001316 15120136071 0006477 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Cancel Controller * * @since 3.2 */ class ConfigControllerCancel extends JControllerBase { /** * Application object - Redeclared for proper typehinting * * @var JApplicationCms * @since 3.2 */ protected $app; /** * Method to handle cancel * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Redirect back to home(base) page $this->app->redirect(JUri::base()); } } canceladmin.php 0000644 00000002736 15120136071 0007517 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Cancel Controller for Admin * * @since 3.2 */ class ConfigControllerCanceladmin extends ConfigControllerCancel { /** * The context for storing internal data, e.g. record. * * @var string * @since 3.2 */ protected $context; /** * The URL option for the component. * * @var string * @since 3.2 */ protected $option; /** * URL for redirection. * * @var string * @since 3.2 * @note Replaces _redirect. */ protected $redirect; /** * Method to handle admin cancel * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Check for request forgeries. if (!JSession::checkToken()) { $this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE')); $this->app->redirect('index.php'); } if (empty($this->context)) { $this->context = $this->option . '.edit' . $this->context; } // Redirect. $this->app->setUserState($this->context . '.data', null); if (!empty($this->redirect)) { // Don't redirect to an external URL. if (!JUri::isInternal($this->redirect)) { $this->redirect = JUri::base(); } $this->app->redirect($this->redirect); } else { parent::execute(); } } } cmsbase.php 0000644 00000002110 15120136071 0006660 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Base Display Controller * * @since 3.2 */ class ConfigControllerCmsbase extends JControllerBase { /** * Prefix for the view and model classes * * @var string * @since 3.2 */ public $prefix; /** * Execute the controller. * * @return mixed A rendered view or true * * @since 3.2 */ public function execute() { // Check for request forgeries if (!JSession::checkToken()) { $this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE')); $this->app->redirect('index.php'); } // Get the application $this->app = $this->getApplication(); $this->app->redirect('index.php?option=' . $this->input->get('option')); $this->componentFolder = $this->input->getWord('option', 'com_content'); $this->viewName = $this->input->getWord('view'); return $this; } } config/display.php 0000644 00000004452 15120136071 0010170 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Display Controller for global configuration * * @since 3.2 */ class ConfigControllerConfigDisplay extends ConfigControllerDisplay { /** * Method to display global configuration. * * @return boolean True on success, false on failure. * * @since 3.2 */ public function execute() { // Get the application $app = $this->getApplication(); // Get the document object. $document = JFactory::getDocument(); $viewName = $this->input->getWord('view', 'config'); $viewFormat = $document->getType(); $layoutName = $this->input->getWord('layout', 'default'); // Access backend com_config JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR . '/components/com_config'); $displayClass = new ConfigControllerApplicationDisplay; // Set backend required params $document->setType('json'); $app->input->set('view', 'application'); // Execute backend controller $serviceData = json_decode($displayClass->execute(), true); // Reset params back after requesting from service $document->setType('html'); $app->input->set('view', $viewName); // Register the layout paths for the view $paths = new SplPriorityQueue; $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal'); $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat); $modelClass = 'ConfigModel' . ucfirst($viewName); if (class_exists($viewClass)) { if ($viewName !== 'close') { $model = new $modelClass; // Access check. if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) { return; } } $view = new $viewClass($model, $paths); $view->setLayout($layoutName); // Push document object into the view. $view->document = $document; // Load form and bind data $form = $model->getForm(); if ($form) { $form->bind($serviceData); } // Set form and data to the view $view->form = &$form; $view->data = &$serviceData; // Render view. echo $view->render(); } return true; } } config/save.php 0000644 00000005634 15120136071 0007464 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Save Controller for global configuration * * @since 3.2 */ class ConfigControllerConfigSave extends JControllerBase { /** * Application object - Redeclared for proper typehinting * * @var JApplicationCms * @since 3.2 */ protected $app; /** * Method to save global configuration. * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Check for request forgeries. if (!JSession::checkToken()) { $this->app->enqueueMessage(JText::_('JINVALID_TOKEN_NOTICE')); $this->app->redirect('index.php'); } // Check if the user is authorized to do this. if (!JFactory::getUser()->authorise('core.admin')) { $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); $this->app->redirect('index.php'); } // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); $model = new ConfigModelConfig; $form = $model->getForm(); $data = $this->input->post->get('jform', array(), 'array'); // Validate the posted data. $return = $model->validate($form, $data); // Check for validation errors. if ($return === false) { /* * The validate method enqueued all messages for us, so we just need to redirect back. */ // Save the data in the session. $this->app->setUserState('com_config.config.global.data', $data); // Redirect back to the edit screen. $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false)); } // Attempt to save the configuration. $data = $return; // Access backend com_config JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config'); $saveClass = new ConfigControllerApplicationSave; // Get a document object $document = JFactory::getDocument(); // Set backend required params $document->setType('json'); // Execute backend controller $return = $saveClass->execute(); // Reset params back after requesting from service $document->setType('html'); // Check the return value. if ($return === false) { /* * The save method enqueued all messages for us, so we just need to redirect back. */ // Save the data in the session. $this->app->setUserState('com_config.config.global.data', $data); // Save failed, go back to the screen and display a notice. $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false)); } // Redirect back to com_config display $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS')); $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false)); return true; } } display.php 0000644 00000005314 15120136071 0006721 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Base Display Controller * * @since 3.2 */ class ConfigControllerDisplay extends JControllerBase { /** * Application object - Redeclared for proper typehinting * * @var JApplicationCms * @since 3.2 */ protected $app; /** * Prefix for the view and model classes * * @var string * @since 3.2 */ public $prefix = 'Config'; /** * Execute the controller. * * @return mixed A rendered view or true * * @since 3.2 */ public function execute() { // Get the document object. $document = JFactory::getDocument(); $componentFolder = $this->input->getWord('option', 'com_config'); if ($this->app->isClient('administrator')) { $viewName = $this->input->getWord('view', 'application'); } else { $viewName = $this->input->getWord('view', 'config'); } $viewFormat = $document->getType(); $layoutName = $this->input->getWord('layout', 'default'); // Register the layout paths for the view $paths = new SplPriorityQueue; if ($this->app->isClient('administrator')) { $paths->insert(JPATH_ADMINISTRATOR . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 1); } else { $paths->insert(JPATH_BASE . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 1); } $viewClass = $this->prefix . 'View' . ucfirst($viewName) . ucfirst($viewFormat); $modelClass = $this->prefix . 'Model' . ucfirst($viewName); if (class_exists($viewClass)) { $model = new $modelClass; $component = $model->getState()->get('component.option'); // Make sure com_joomlaupdate and com_privacy can only be accessed by SuperUser if (in_array(strtolower($component), array('com_joomlaupdate', 'com_privacy')) && !JFactory::getUser()->authorise('core.admin')) { $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return; } // Access check. if (!JFactory::getUser()->authorise('core.admin', $component) && !JFactory::getUser()->authorise('core.options', $component)) { $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return; } $view = new $viewClass($model, $paths); $view->setLayout($layoutName); // Push document object into the view. $view->document = $document; // Reply for service requests if ($viewFormat === 'json') { $this->app->allowCache(false); return $view->render(); } // Render view. echo $view->render(); } return true; } } helper.php 0000644 00000005106 15120136071 0006532 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Helper class for controllers * * @since 3.2 */ class ConfigControllerHelper { /** * Method to parse a controller from a url * Defaults to the base controllers and passes an array of options. * $options[0] is the location of the controller which defaults to the core libraries (referenced as 'j' * and then the named folder within the component entry point file. * $options[1] is the name of the controller file, * $options[2] is the name of the folder found in the component controller folder for controllers * not prefixed with Config. * Additional options maybe added to parameterize the controller. * * @param JApplicationBase $app An application object * * @return JController A JController object * * @since 3.2 */ public function parseController($app) { $tasks = array(); if ($task = $app->input->get('task')) { // Toolbar expects old style but we are using new style // Remove when toolbar can handle either directly if (strpos($task, '/') !== false) { $tasks = explode('/', $task); } else { $tasks = explode('.', $task); } } elseif ($controllerTask = $app->input->get('controller')) { // Temporary solution if (strpos($controllerTask, '/') !== false) { $tasks = explode('/', $controllerTask); } else { $tasks = explode('.', $controllerTask); } } if (empty($tasks[0]) || $tasks[0] === 'Config') { $location = 'Config'; } else { $location = ucfirst(strtolower($tasks[0])); } if (empty($tasks[1])) { $activity = 'Display'; } else { $activity = ucfirst(strtolower($tasks[1])); } $view = ''; if (!empty($tasks[2])) { $view = ucfirst(strtolower($tasks[2])); } // Some special handling for com_config administrator $option = $app->input->get('option'); if ($option === 'com_config' && $app->isClient('administrator')) { $component = $app->input->get('component'); if (!empty($component)) { $view = 'Component'; } elseif ($option === 'com_config') { $view = 'Application'; } } $controllerName = $location . 'Controller' . $view . $activity; if (!class_exists($controllerName)) { return false; } $controller = new $controllerName; $controller->options = array(); $controller->options = $tasks; return $controller; } } modules/cancel.php 0000644 00000003242 15120136071 0010147 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Cancel Controller for module editing * * @package Joomla.Site * @subpackage com_config * @since 3.2 */ class ConfigControllerModulesCancel extends ConfigControllerCanceladmin { /** * Method to cancel module editing. * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Check if the user is authorized to do this. $user = JFactory::getUser(); if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $this->input->get('id'))) { $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); $this->app->redirect('index.php'); } $this->context = 'com_config.config.global'; // Get returnUri $returnUri = $this->input->post->get('return', null, 'base64'); if (!empty($returnUri)) { $this->redirect = base64_decode(urldecode($returnUri)); } else { $this->redirect = JUri::base(); } $id = $this->input->getInt('id'); // Access backend com_module JLoader::register('ModulesControllerModule', JPATH_ADMINISTRATOR . '/components/com_modules/controllers/module.php'); JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR . '/components/com_modules/views/module/view.json.php'); JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR . '/components/com_modules/models/module.php'); $cancelClass = new ModulesControllerModule; $cancelClass->cancel($id); parent::execute(); } } modules/display.php 0000644 00000006154 15120136071 0010374 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Display Controller for module editing * * @package Joomla.Site * @subpackage com_config * @since 3.2 */ class ConfigControllerModulesDisplay extends ConfigControllerDisplay { /** * Method to display module editing. * * @return boolean True on success, false on failure. * * @since 3.2 */ public function execute() { // Get the application $app = $this->getApplication(); // Get the document object. $document = JFactory::getDocument(); $viewName = $this->input->getWord('view', 'modules'); $viewFormat = $document->getType(); $layoutName = $this->input->getWord('layout', 'default'); $returnUri = $this->input->get->get('return', null, 'base64'); // Construct redirect URI if (!empty($returnUri)) { $redirect = base64_decode(urldecode($returnUri)); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = JUri::base(); } } else { $redirect = JUri::base(); } // Access backend com_module JLoader::register('ModulesController', JPATH_ADMINISTRATOR . '/components/com_modules/controller.php'); JLoader::register('ModulesViewModule', JPATH_ADMINISTRATOR . '/components/com_modules/views/module/view.json.php'); JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR . '/components/com_modules/models/module.php'); $displayClass = new ModulesController; // Get the parameters of the module with Id $document->setType('json'); // Execute backend controller if (!($serviceData = json_decode($displayClass->display(), true))) { $app->redirect($redirect); } // Reset params back after requesting from service $document->setType('html'); $app->input->set('view', $viewName); // Register the layout paths for the view $paths = new SplPriorityQueue; $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal'); $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat); $modelClass = 'ConfigModel' . ucfirst($viewName); if (class_exists($viewClass)) { $model = new $modelClass; // Access check. $user = JFactory::getUser(); if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $serviceData['id'])) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $app->redirect($redirect); } // Need to add module name to the state of model $model->getState()->set('module.name', $serviceData['module']); $view = new $viewClass($model, $paths); $view->setLayout($layoutName); // Push document object into the view. $view->document = $document; // Load form and bind data $form = $model->getForm(); if ($form) { $form->bind($serviceData); } // Set form and data to the view $view->form = &$form; $view->item = &$serviceData; // Render view. echo $view->render(); } return true; } } modules/save.php 0000644 00000006232 15120136072 0007663 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Save Controller for module editing * * @package Joomla.Site * @subpackage com_config * @since 3.2 */ class ConfigControllerModulesSave extends JControllerBase { /** * Method to save module editing. * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Check for request forgeries. if (!JSession::checkToken()) { $this->app->enqueueMessage(JText::_('JINVALID_TOKEN')); $this->app->redirect('index.php'); } // Check if the user is authorized to do this. $user = JFactory::getUser(); if (!$user->authorise('module.edit.frontend', 'com_modules.module.' . $this->input->get('id'))) { $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $this->app->redirect('index.php'); } // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); // Get submitted module id $moduleId = '&id=' . $this->input->get('id'); // Get returnUri $returnUri = $this->input->post->get('return', null, 'base64'); $redirect = ''; if (!empty($returnUri)) { $redirect = '&return=' . $returnUri; } // Access backend com_modules to be done JLoader::register('ModulesControllerModule', JPATH_ADMINISTRATOR . '/components/com_modules/controllers/module.php'); JLoader::register('ModulesModelModule', JPATH_ADMINISTRATOR . '/components/com_modules/models/module.php'); $controllerClass = new ModulesControllerModule; // Get a document object $document = JFactory::getDocument(); // Set backend required params $document->setType('json'); // Execute backend controller $return = $controllerClass->save(); // Reset params back after requesting from service $document->setType('html'); // Check the return value. if ($return === false) { // Save the data in the session. $data = $this->input->post->get('jform', array(), 'array'); $this->app->setUserState('com_config.modules.global.data', $data); // Save failed, go back to the screen and display a notice. $this->app->enqueueMessage(JText::_('JERROR_SAVE_FAILED')); $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules' . $moduleId . $redirect, false)); } // Redirect back to com_config display $this->app->enqueueMessage(JText::_('COM_CONFIG_MODULES_SAVE_SUCCESS')); // Set the redirect based on the task. switch ($this->options[3]) { case 'apply': $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.modules' . $moduleId . $redirect, false)); break; case 'save': default: if (!empty($returnUri)) { $redirect = base64_decode(urldecode($returnUri)); // Don't redirect to an external URL. if (!JUri::isInternal($redirect)) { $redirect = JUri::base(); } } else { $redirect = JUri::base(); } $this->app->redirect($redirect); break; } } } templates/display.php 0000644 00000005117 15120136072 0010721 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Display Controller for global configuration * * @since 3.2 */ class ConfigControllerTemplatesDisplay extends ConfigControllerDisplay { /** * Method to display global configuration. * * @return boolean True on success, false on failure. * * @since 3.2 */ public function execute() { // Get the application $app = $this->getApplication(); // Get the document object. $document = JFactory::getDocument(); $viewName = $this->input->getWord('view', 'templates'); $viewFormat = $document->getType(); $layoutName = $this->input->getWord('layout', 'default'); // Access backend com_config JLoader::register('TemplatesController', JPATH_ADMINISTRATOR . '/components/com_templates/controller.php'); JLoader::register('TemplatesViewStyle', JPATH_ADMINISTRATOR . '/components/com_templates/views/style/view.json.php'); JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR . '/components/com_templates/models/style.php'); $displayClass = new TemplatesController; // Set backend required params $document->setType('json'); $this->input->set('id', $app->getTemplate(true)->id); // Execute backend controller $serviceData = json_decode($displayClass->display(), true); // Reset params back after requesting from service $document->setType('html'); $this->input->set('view', $viewName); // Register the layout paths for the view $paths = new SplPriorityQueue; $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal'); $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat); $modelClass = 'ConfigModel' . ucfirst($viewName); if (class_exists($viewClass)) { if ($viewName !== 'close') { $model = new $modelClass; // Access check. if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return; } } $view = new $viewClass($model, $paths); $view->setLayout($layoutName); // Push document object into the view. $view->document = $document; // Load form and bind data $form = $model->getForm(); if ($form) { $form->bind($serviceData); } // Set form and data to the view $view->form = &$form; // Render view. echo $view->render(); } return true; } } templates/save.php 0000644 00000004670 15120136072 0010215 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_config * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Save Controller for global configuration * * @since 3.2 */ class ConfigControllerTemplatesSave extends JControllerBase { /** * Method to save global configuration. * * @return boolean True on success. * * @since 3.2 */ public function execute() { // Check for request forgeries. if (!JSession::checkToken()) { JFactory::getApplication()->redirect('index.php', JText::_('JINVALID_TOKEN')); } // Check if the user is authorized to do this. if (!JFactory::getUser()->authorise('core.admin')) { JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR')); return; } // Set FTP credentials, if given. JClientHelper::setCredentialsFromRequest('ftp'); $app = JFactory::getApplication(); // Access backend com_templates JLoader::register('TemplatesControllerStyle', JPATH_ADMINISTRATOR . '/components/com_templates/controllers/style.php'); JLoader::register('TemplatesModelStyle', JPATH_ADMINISTRATOR . '/components/com_templates/models/style.php'); JLoader::register('TemplatesTableStyle', JPATH_ADMINISTRATOR . '/components/com_templates/tables/style.php'); $controllerClass = new TemplatesControllerStyle; // Get a document object $document = JFactory::getDocument(); // Set backend required params $document->setType('json'); $this->input->set('id', $app->getTemplate(true)->id); // Execute backend controller $return = $controllerClass->save(); // Reset params back after requesting from service $document->setType('html'); // Check the return value. if ($return === false) { // Save the data in the session. $app->setUserState('com_config.config.global.data', $data); // Save failed, go back to the screen and display a notice. $message = JText::sprintf('JERROR_SAVE_FAILED'); $app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates', false), $message, 'error'); return false; } // Set the success message. $message = JText::_('COM_CONFIG_SAVE_SUCCESS'); // Redirect back to com_config display $app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.templates', false), $message); return true; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.1 |
proxy
|
phpinfo
|
Настройка