diff options
author | Brian Wolff <bawolff+wn@gmail.com> | 2019-02-17 11:45:06 +0000 |
---|---|---|
committer | Krinkle <krinklemail@gmail.com> | 2019-03-04 03:12:07 +0000 |
commit | 3c4be2f2a8f9104d539c15440a6a3e5fd5f3a85c (patch) | |
tree | c397ed0d0182f215c6959c4bbaccedd4add94a6d /includes/specials/SpecialSearch.php | |
parent | 67bd0c6be1ad3b4016524df6690205673b1a0a0b (diff) | |
download | mediawikicore-3c4be2f2a8f9104d539c15440a6a3e5fd5f3a85c.tar.gz mediawikicore-3c4be2f2a8f9104d539c15440a6a3e5fd5f3a85c.zip |
Various fixes for phan-taint-check
Bug: T216348
Change-Id: Id9e7a4704d62457cac9bd1ca6044dec76472e371
Diffstat (limited to 'includes/specials/SpecialSearch.php')
-rw-r--r-- | includes/specials/SpecialSearch.php | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index ec6c5b94c99b..e6d06329ad74 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -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; @@ -191,6 +177,31 @@ class SpecialSearch extends SpecialPage { } /** + * 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. * * @see tests/phpunit/includes/specials/SpecialSearchTest.php |