Source for file controller.php
Documentation is available at controller.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Search Component Controller
* Method to display a view.
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
* @return JController This object to support chaining.
public function display($cachable =
false, $urlparams =
false)
$this->input->set('view', 'search'); // force it to be the search view
return parent::display($cachable, $urlparams);
// slashes cause errors, <> get stripped anyway later on. # causes problems.
$badchars =
array('#', '>', '<', '\\');
$searchword =
trim(str_replace($badchars, '', $this->input->getString('searchword', null, 'post')));
// if searchword enclosed in double quotes, strip quotes and do exact match
if (substr($searchword, 0, 1) ==
'"' &&
substr($searchword, -
1) ==
'"')
$post['searchword'] =
substr($searchword, 1, -
1);
$this->input->set('searchphrase', 'exact');
$post['searchword'] =
$searchword;
$post['ordering'] =
$this->input->getWord('ordering', null, 'post');
$post['searchphrase'] =
$this->input->getWord('searchphrase', 'all', 'post');
$post['limit'] =
$this->input->getUInt('limit', null, 'post');
if ($post['limit'] ===
null)
$areas =
$this->input->post->get('areas', null, 'array');
foreach ($areas as $area)
// set Itemid id for links from menu
$items =
$menu->getItems('link', 'index.php?option=com_search&view=search');
$post['Itemid'] =
$items[0]->id;
} elseif ($this->input->getInt('Itemid') >
0) { //use Itemid from requesting page only if there is no existing menu
$post['Itemid'] =
$this->input->getInt('Itemid');
$uri->setVar('option', 'com_search');
$this->setRedirect(JRoute::_('index.php'.
$uri->toString(array('query', 'fragment')), false));
Documentation generated on Tue, 19 Nov 2013 14:57:24 +0100 by phpDocumentor 1.4.3