5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2004 (c) Guillaume Smet / Open Wide
7 * http://fusionforge.org
9 * This file is part of FusionForge.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../env.inc.php');
28 require_once $gfcommon.'include/pre.php';
29 require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
30 require_once $gfwww.'search/include/SearchManager.class.php';
32 $group_id = getIntFromRequest('group_id');
33 $atid = getIntFromRequest('atid');
34 $forum_id = getIntFromRequest('forum_id');
35 $group_project_id = getIntFromRequest('group_project_id');
37 $words = getStringFromRequest('words');
38 $type_of_search = getStringFromRequest('type_of_search');
39 $exact = getStringFromRequest('exact', 1);
41 // Support for short aliases
44 $words = getStringFromRequest('q');
47 if (!$type_of_search) {
48 $type_of_search = getStringFromRequest('type');
50 if (!$type_of_search) {
51 $type_of_search = getStringFromRequest('t');
53 if (!$type_of_search) {
54 $type_of_search = SEARCH__TYPE_IS_SOFTWARE;
56 $words=htmlspecialchars($words);
58 $offset = getIntFromGet('offset');
60 $searchManager =& getSearchManager();
63 SEARCH__PARAMETER_GROUP_ID => $group_id,
64 SEARCH__PARAMETER_ARTIFACT_ID => $atid,
65 SEARCH__PARAMETER_FORUM_ID => $forum_id,
66 SEARCH__PARAMETER_GROUP_PROJECT_ID => $group_project_id
69 $searchManager->setParametersValues($parameters);
71 if (getStringFromRequest('rss')) {
72 $outputFormat = SEARCH__OUTPUT_RSS;
74 $outputFormat = SEARCH__OUTPUT_HTML;
77 $renderer = $searchManager->getSearchRenderer($type_of_search, $words, $offset, $exact, $outputFormat);
82 $HTML->header(array('title'=>_('Search')));
83 echo '<div class="error">'._('Error - Invalid search').'</div>';
85 $HTML->footer(array());