- md5
- 86def76057bc879e303d259c7f43e5ab
- sha1
- f8f4c7b7f366923d054a0be0a0af9a3c3dd44209
- sha256
- d7d7863f4d8ebc3d042f45b9c9d3f19d0bda7cc4fda22ea17e6ba7ea1f44bfb3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
<?php
/**
* @package Joomla.Site
* @subpackage com_config
*
* @copyright Copyright (C) 2005 - 2017 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('template')->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;
}
}
The same content is in 34 releases, Joomla 3.7.0-alpha2 to 3.8.3. See them all, or every version of this file.