SpecialSearch: Use Config instead of globals
authorKunal Mehta <legoktm@gmail.com>
Wed, 6 Aug 2014 14:51:25 +0000 (15:51 +0100)
committerHashar <hashar@free.fr>
Wed, 6 Aug 2014 15:40:44 +0000 (15:40 +0000)
Change-Id: I18b3ad47497e9bc82d38bc17225c8e0e9268ba83

includes/specials/SpecialSearch.php

index 1caed0b..26f67b1 100644 (file)
@@ -186,12 +186,11 @@ class SpecialSearch extends SpecialPage {
                # No match, generate an edit URL
                $title = Title::newFromText( $term );
                if ( !is_null( $title ) ) {
-                       global $wgGoToEdit;
                        wfRunHooks( 'SpecialSearchNogomatch', array( &$title ) );
                        wfDebugLog( 'nogomatch', $title->getFullText(), 'private' );
 
                        # If the feature is enabled, go straight to the edit page
-                       if ( $wgGoToEdit ) {
+                       if ( $this->getConfig()->get( 'GoToEdit' ) ) {
                                $this->getOutput()->redirect( $title->getFullURL( array( 'action' => 'edit' ) ) );
 
                                return;
@@ -204,7 +203,7 @@ class SpecialSearch extends SpecialPage {
         * @param string $term
         */
        public function showResults( $term ) {
-               global $wgDisableTextSearch, $wgSearchForwardUrl, $wgContLang, $wgScript;
+               global $wgContLang;
 
                $profile = new ProfileSection( __METHOD__ );
                $search = $this->getSearchEngine();
@@ -220,9 +219,10 @@ class SpecialSearch extends SpecialPage {
 
                $out = $this->getOutput();
 
-               if ( $wgDisableTextSearch ) {
-                       if ( $wgSearchForwardUrl ) {
-                               $url = str_replace( '$1', urlencode( $term ), $wgSearchForwardUrl );
+               if ( $this->getConfig()->get( 'DisableTextSearch' ) ) {
+                       $searchFowardUrl = $this->getConfig()->get( 'SearchForwardUrl' );
+                       if ( $searchFowardUrl ) {
+                               $url = str_replace( '$1', urlencode( $term ), $searchFowardUrl );
                                $out->redirect( $url );
                        } else {
                                $out->addHTML(
@@ -304,7 +304,7 @@ class SpecialSearch extends SpecialPage {
                                array(
                                        'id' => ( $this->profile === 'advanced' ? 'powersearch' : 'search' ),
                                        'method' => 'get',
-                                       'action' => $wgScript
+                                       'action' => wfScript(),
                                )
                        )
                );