/administrator/components/com_banners/controller.php

https://bitbucket.org/eternaware/joomus · PHP · 63 lines · 27 code · 10 blank · 26 comment · 9 complexity · cfe0205f81a42f529af42ed5772c4f70 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_banners
  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. * Banners master display controller.
  12. *
  13. * @package Joomla.Administrator
  14. * @subpackage com_banners
  15. * @since 1.6
  16. */
  17. class BannersController extends JControllerLegacy
  18. {
  19. /**
  20. * Method to display a view.
  21. *
  22. * @param boolean If true, the view output will be cached
  23. * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  24. *
  25. * @return JController This object to support chaining.
  26. * @since 1.5
  27. */
  28. public function display($cachable = false, $urlparams = false)
  29. {
  30. require_once JPATH_COMPONENT.'/helpers/banners.php';
  31. BannersHelper::updateReset();
  32. $view = $this->input->get('view', 'banners');
  33. $layout = $this->input->get('layout', 'default');
  34. $id = $this->input->getInt('id');
  35. // Check for edit form.
  36. if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $id)) {
  37. // Somehow the person just went to the form - we don't allow that.
  38. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
  39. $this->setMessage($this->getError(), 'error');
  40. $this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners', false));
  41. return false;
  42. }
  43. elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $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_banners&view=clients', false));
  48. return false;
  49. }
  50. parent::display();
  51. return $this;
  52. }
  53. }