- md5
- 63f17d2f68637308e96404edd53985ea
- sha1
- dfb25d71965df9d0a9ad5a1fc7c36dcd7602ef8f
- sha256
- d9c00f8dab19e00142230b9426fa8b129dbaae6e5b9f52438807ef1720687e63
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
<?php
/**
* @package Joomla.Administrator
* @subpackage com_templates
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/**
* Template styles list controller class.
*
* @since 1.6
*/
class TemplatesControllerStyles extends JControllerAdmin
{
/**
* Method to clone and existing template style.
*
* @return void
*/
public function duplicate()
{
// Check for request forgeries
$this->checkToken();
$pks = $this->input->post->get('cid', array(), 'array');
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_TEMPLATES_NO_TEMPLATE_SELECTED'));
}
$pks = ArrayHelper::toInteger($pks);
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(JText::_('COM_TEMPLATES_SUCCESS_DUPLICATED'));
}
catch (Exception $e)
{
JError::raiseWarning(500, $e->getMessage());
}
$this->setRedirect('index.php?option=com_templates&view=styles');
}
/**
* Proxy for getModel.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy
*
* @since 1.6
*/
public function getModel($name = 'Style', $prefix = 'TemplatesModel', $config = array())
{
return parent::getModel($name, $prefix, array('ignore_request' => true));
}
/**
* Method to set the home template for a client.
*
* @return void
*
* @since 1.6
*/
public function setDefault()
{
// Check for request forgeries
$this->checkToken();
$pks = $this->input->post->get('cid', array(), 'array');
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_TEMPLATES_NO_TEMPLATE_SELECTED'));
}
$pks = ArrayHelper::toInteger($pks);
// Pop off the first element.
$id = array_shift($pks);
$model = $this->getModel();
$model->setHome($id);
$this->setMessage(JText::_('COM_TEMPLATES_SUCCESS_HOME_SET'));
}
catch (Exception $e)
{
JError::raiseWarning(500, $e->getMessage());
}
$this->setRedirect('index.php?option=com_templates&view=styles');
}
/**
* Method to unset the default template for a client and for a language
*
* @return void
*
* @since 1.6
*/
public function unsetDefault()
{
// Check for request forgeries
$this->checkToken('request');
$pks = $this->input->get->get('cid', array(), 'array');
$pks = ArrayHelper::toInteger($pks);
try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_TEMPLATES_NO_TEMPLATE_SELECTED'));
}
// Pop off the first element.
$id = array_shift($pks);
$model = $this->getModel();
$model->unsetHome($id);
$this->setMessage(JText::_('COM_TEMPLATES_SUCCESS_HOME_UNSET'));
}
catch (Exception $e)
{
JError::raiseWarning(500, $e->getMessage());
}
$this->setRedirect('index.php?option=com_templates&view=styles');
}
}
The same content is in 9 releases, Joomla 3.9.0-beta to 3.9.1. See them all, or every version of this file.