forked from mantisbt/mantisbt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser_search_plugin.php
65 lines (56 loc) · 2.5 KB
/
browser_search_plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
# MantisBT - A PHP based bugtracking system
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* Browser Search Functionality - outputs opensearchdescription xml
*
* @package MantisBT
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - [email protected]
* @copyright Copyright 2002 MantisBT Team - [email protected]
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses config_api.php
* @uses gpc_api.php
*/
# Prevent output of HTML in the content if errors occur
define( 'DISABLE_INLINE_ERROR_REPORTING', true );
require_once( 'core.php' );
require_api( 'config_api.php' );
require_api( 'gpc_api.php' );
$f_type = strtolower( gpc_get_string( 'type', 'text' ) );
$t_path = config_get_global( 'path' );
$t_title = config_get( 'search_title' );
$t_icon = $t_path . config_get( 'favicon_image' );
$t_searchform = $t_path . 'view_all_bug_page.php';
# Localized ShortName and Description elements
$t_shortname = sprintf( lang_get( "opensearch_{$f_type}_short" ), $t_title );
$t_description = sprintf( lang_get( "opensearch_{$f_type}_description" ), $t_title );
if( $f_type == 'id' ) {
$t_url = $t_path . 'view.php?id={searchTerms}';
} else {
$t_url = $t_path . 'view_all_set.php?type=' . FILTER_ACTION_PARSE_NEW . '&temporary=y&handler_id=[all]&search={searchTerms}';
}
header( 'Content-Type: application/opensearchdescription+xml' );
echo '<?xml version="1.0" encoding="UTF-8" ?>';
?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName><?php echo $t_shortname; ?></ShortName>
<Description><?php echo $t_description; ?></Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon"><?php echo $t_icon; ?></Image>
<Url type="text/html" method="GET" template="<?php echo $t_url; ?>"></Url>';
<moz:SearchForm><?php echo $t_searchform; ?></moz:SearchForm>
</OpenSearchDescription>