X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=opensearch_desc.php;h=82e74b2044221d16afc96515bc2a6ad2bcf37394;hb=dcc1d530fe26c025719482ed26fe58893af56d4b;hp=6aeacc4b4010bdf21a8746f4e24e2d77942f8221;hpb=ab6222084d56671d1c69cf10c2c5177c6d286473;p=lhc%2Fweb%2Fwiklou.git diff --git a/opensearch_desc.php b/opensearch_desc.php index 6aeacc4b40..82e74b2044 100644 --- a/opensearch_desc.php +++ b/opensearch_desc.php @@ -5,19 +5,34 @@ */ require_once( dirname(__FILE__) . '/includes/WebStart.php' ); -$shortName = htmlspecialchars( mb_substr( $wgSitename, 0, 16 ) ); -$siteName = htmlspecialchars( $wgSitename ); -$favicon = htmlspecialchars( $wgFavicon ); -$title = Title::makeTitle( NS_SPECIAL, 'Search' ); -$template = $title->getFullURL( 'search={searchTerms}' ); +require_once( dirname(__FILE__) . '/languages/Names.php' ); +$fullName = wfMsgForContent( 'opensearch-desc' ); +$shortName = htmlspecialchars( mb_substr( $fullName, 0, 24 ) ); +$siteName = htmlspecialchars( $fullName ); + + +$favicon = htmlspecialchars( wfExpandUrl( $wgFavicon ) ); + +$title = SpecialPage::getTitleFor( 'Search' ); +$template = $title->escapeFullURL( 'search={searchTerms}' ); + +$suggest = htmlspecialchars(SearchEngine::getOpenSearchTemplate() ); + $response = $wgRequest->response(); -$response->header( 'Content-type: application/opensearchdescription+xml' ); +if( $wgRequest->getVal( 'ctype' ) == 'application/xml' ) { + // Makes testing tweaks about a billion times easier + $ctype = 'application/xml'; +} else { + $ctype = 'application/opensearchdescription+xml'; +} +$response->header( "Content-type: $ctype" ); # Set an Expires header so that squid can cache it for a short time # Short enough so that the sysadmin barely notices when $wgSitename is changed -$expiryTime = 300; # 5 minutes +$expiryTime = 600; # 10 minutes $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiryTime ) . ' GMT' ); +$response->header( 'Cache-control: max-age=600' ); echo << @@ -26,7 +41,9 @@ echo <<$siteName $favicon + EOT; + ?>