/administrator/components/com_finder/controller.php

https://bitbucket.org/eternaware/joomus · PHP · 60 lines · 22 code · 8 blank · 30 comment · 5 complexity · bc285fe89d80fbb3e2645ec2f056d0e1 MD5 · raw file

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