PageRenderTime 39ms CodeModel.GetById 35ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/administrator/components/com_templates/controller.php

https://bitbucket.org/eternaware/joomus
PHP | 54 lines | 19 code | 6 blank | 29 comment | 5 complexity | 164433a8d4d5a315503b2027a1314e33 MD5 | raw file
Possible License(s): LGPL-2.1
 1<?php
 2/**
 3 * @package     Joomla.Administrator
 4 * @subpackage  com_templates
 5 *
 6 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 8 */
 9
10defined('_JEXEC') or die;
11
12/**
13 * Templates manager master display controller.
14 *
15 * @package     Joomla.Administrator
16 * @subpackage  com_templates
17 * @since       1.6
18 */
19class TemplatesController extends JControllerLegacy
20{
21	/**
22	 * @var		string	The default view.
23	 * @since	1.6
24	 */
25	protected $default_view = 'styles';
26
27	/**
28	 * Method to display a view.
29	 *
30	 * @param	boolean			If true, the view output will be cached
31	 * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
32	 *
33	 * @return	JController		This object to support chaining.
34	 * @since	1.5
35	 */
36	public function display($cachable = false, $urlparams = false)
37	{
38		$view   = $this->input->get('view', 'styles');
39		$layout = $this->input->get('layout', 'default');
40		$id     = $this->input->getInt('id');
41
42		// Check for edit form.
43		if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) {
44			// Somehow the person just went to the form - we don't allow that.
45			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
46			$this->setMessage($this->getError(), 'error');
47			$this->setRedirect(JRoute::_('index.php?option=com_templates&view=styles', false));
48
49			return false;
50		}
51
52		parent::display();
53	}
54}