Don't allow double logging of patrol events
[lhc/web/wiklou.git] / opensearch_desc.php
1 <?php
2
3 /**
4 * Generate an OpenSearch description file
5 */
6
7 require_once( dirname(__FILE__) . '/includes/WebStart.php' );
8 require_once( dirname(__FILE__) . '/languages/Names.php' );
9 $fullName = "$wgSitename ({$wgLanguageNames[$wgLanguageCode]})";
10 $shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) );
11 $siteName = htmlspecialchars( $fullName );
12
13
14 $favicon = htmlspecialchars( wfExpandUrl( $wgFavicon ) );
15
16 $title = SpecialPage::getTitleFor( 'Search' );
17 $template = $title->escapeFullURL( 'search={searchTerms}' );
18
19 $suggest = htmlspecialchars($wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}');
20
21
22 $response = $wgRequest->response();
23 $response->header( 'Content-type: application/opensearchdescription+xml' );
24
25 # Set an Expires header so that squid can cache it for a short time
26 # Short enough so that the sysadmin barely notices when $wgSitename is changed
27 $expiryTime = 600; # 10 minutes
28 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiryTime ) . ' GMT' );
29 $response->header( 'Cache-control: max-age=600' );
30
31 echo <<<EOT
32 <?xml version="1.0"?>
33 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
34 <ShortName>$shortName</ShortName>
35 <Description>$siteName</Description>
36 <Image height="16" width="16" type="image/x-icon">$favicon</Image>
37 <Url type="text/html" method="get" template="$template"/>
38 <Url type="application/x-suggestions+json" method="GET" template="$suggest"/>
39 </OpenSearchDescription>
40 EOT;
41
42
43 ?>