/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

  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. defined('_JEXEC') or die;
  10. /**
  11. * Templates manager master display controller.
  12. *
  13. * @package Joomla.Administrator
  14. * @subpackage com_templates
  15. * @since 1.6
  16. */
  17. class TemplatesController extends JControllerLegacy
  18. {
  19. /**
  20. * @var string The default view.
  21. * @since 1.6
  22. */
  23. protected $default_view = 'styles';
  24. /**
  25. * Method to display a view.
  26. *
  27. * @param boolean If true, the view output will be cached
  28. * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  29. *
  30. * @return JController This object to support chaining.
  31. * @since 1.5
  32. */
  33. public function display($cachable = false, $urlparams = false)
  34. {
  35. $view = $this->input->get('view', 'styles');
  36. $layout = $this->input->get('layout', 'default');
  37. $id = $this->input->getInt('id');
  38. // Check for edit form.
  39. if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) {
  40. // Somehow the person just went to the form - we don't allow that.
  41. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
  42. $this->setMessage($this->getError(), 'error');
  43. $this->setRedirect(JRoute::_('index.php?option=com_templates&view=styles', false));
  44. return false;
  45. }
  46. parent::display();
  47. }
  48. }