PageRenderTime 31ms CodeModel.GetById 3ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

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