Use canonical URLs (introduced in r94995) in the OpenSearch discovery thingy
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 14:39:37 +0000 (14:39 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 14:39:37 +0000 (14:39 +0000)
includes/search/SearchEngine.php
opensearch_desc.php

index fe37279..40b992d 100644 (file)
@@ -472,7 +472,7 @@ class SearchEngine {
         * @return String
         */
        public static function getOpenSearchTemplate() {
-               global $wgOpenSearchTemplate, $wgServer;
+               global $wgOpenSearchTemplate, $wgCanonicalServer;
                if ( $wgOpenSearchTemplate ) {
                        return $wgOpenSearchTemplate;
                } else {
@@ -480,7 +480,7 @@ class SearchEngine {
                        if ( !$ns ) {
                                $ns = "0";
                        }
-                       return $wgServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
+                       return $wgCanonicalServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
                }
        }
 
index cc6c471..85ec580 100644 (file)
@@ -51,7 +51,7 @@ print Xml::element( 'Image',
                'height' => 16,
                'width' => 16,
                'type' => 'image/x-icon' ),
-       wfExpandUrl( $wgFavicon ) );
+       wfExpandUrl( $wgFavicon , PROTO_CURRENT ) );
 
 $urls = array();
 
@@ -62,7 +62,7 @@ $searchPage = SpecialPage::getTitleFor( 'Search' );
 $urls[] = array(
        'type' => 'text/html',
        'method' => 'get',
-       'template' => $searchPage->getFullURL( 'search={searchTerms}' ) );
+       'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );
 
 if( $wgEnableAPI ) {
        // JSON interface for search suggestions.
@@ -86,6 +86,6 @@ foreach( $urls as $attribs ) {
 // sends you to the domain root if you hit "enter" with an empty
 // search box.
 print Xml::element( 'moz:SearchForm', null,
-       $searchPage->getFullUrl() );
+       $searchPage->getCanonicalURL() );
 
 print '</OpenSearchDescription>';