/administrator/components/com_config/controller.php

https://bitbucket.org/eternaware/joomus · PHP · 69 lines · 25 code · 10 blank · 34 comment · 4 complexity · e47c6fd5f5ad92c264cb95c03f1ee38f MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_config
  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. * Config Component Controller
  12. *
  13. * @package Joomla.Administrator
  14. * @subpackage com_config
  15. * @since 1.5
  16. */
  17. class ConfigController extends JControllerLegacy
  18. {
  19. /**
  20. * @var string The default view.
  21. * @since 1.6
  22. */
  23. protected $default_view = 'application';
  24. /**
  25. * Method to display the 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. // Get the document object.
  36. $document = JFactory::getDocument();
  37. // Set the default view name and format from the Request.
  38. $vName = $this->input->get('view', 'application');
  39. $vFormat = $document->getType();
  40. $lName = $this->input->get('layout', 'default');
  41. // Get and render the view.
  42. if ($view = $this->getView($vName, $vFormat)) {
  43. if ($vName != 'close') {
  44. // Get the model for the view.
  45. $model = $this->getModel($vName);
  46. // Access check.
  47. if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) {
  48. return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
  49. }
  50. // Push the model into the view (as default).
  51. $view->setModel($model, true);
  52. }
  53. $view->setLayout($lName);
  54. // Push document object into the view.
  55. $view->document = $document;
  56. $view->display();
  57. }
  58. }
  59. }