Various fixes for phan-taint-check
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index d904ad1..e6d0632 100644 (file)
@@ -167,21 +167,7 @@ class SpecialSearch extends SpecialPage {
                                $url = str_replace( '$1', urlencode( $term ), $searchForwardUrl );
                                $out->redirect( $url );
                        } else {
-                               $out->addHTML(
-                                       "<fieldset>" .
-                                               "<legend>" .
-                                                       $this->msg( 'search-external' )->escaped() .
-                                               "</legend>" .
-                                               "<p class='mw-searchdisabled'>" .
-                                                       $this->msg( 'searchdisabled' )->escaped() .
-                                               "</p>" .
-                                               $this->msg( 'googlesearch' )->rawParams(
-                                                       htmlspecialchars( $term ),
-                                                       'UTF-8',
-                                                       $this->msg( 'searchbutton' )->escaped()
-                                               )->text() .
-                                       "</fieldset>"
-                               );
+                               $this->showGoogleSearch( $term );
                        }
 
                        return;
@@ -190,6 +176,31 @@ class SpecialSearch extends SpecialPage {
                $this->showResults( $term );
        }
 
+       /**
+        * Output a google search form if search is disabled
+        *
+        * @param string $term Search term
+        * @todo FIXME Maybe we should get rid of this raw html message at some future time
+        * @suppress SecurityCheck-XSS
+        */
+       private function showGoogleSearch( $term ) {
+               $this->getOutput()->addHTML(
+                       "<fieldset>" .
+                               "<legend>" .
+                                       $this->msg( 'search-external' )->escaped() .
+                               "</legend>" .
+                               "<p class='mw-searchdisabled'>" .
+                                       $this->msg( 'searchdisabled' )->escaped() .
+                               "</p>" .
+                               $this->msg( 'googlesearch' )->rawParams(
+                                       htmlspecialchars( $term ),
+                                       'UTF-8',
+                                       $this->msg( 'searchbutton' )->escaped()
+                               )->text() .
+                       "</fieldset>"
+               );
+       }
+
        /**
         * Set up basic search parameters from the request and user settings.
         *
@@ -212,13 +223,13 @@ class SpecialSearch extends SpecialPage {
 
                # Extract manually requested namespaces
                $nslist = $this->powerSearch( $request );
-               if ( !count( $nslist ) ) {
+               if ( $nslist === [] ) {
                        # Fallback to user preference
                        $nslist = $this->searchConfig->userNamespaces( $user );
                }
 
                $profile = null;
-               if ( !count( $nslist ) ) {
+               if ( $nslist === [] ) {
                        $profile = 'default';
                }