X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialSearch.php;h=26b86f9762cf75173023058b6374f8e3a4803dcd;hb=4f3fbda7235fb6f7c2e77d3fbc6492e26fde9ecc;hp=9690d45bc98a7924fa5c42fe25d31f64fca127ef;hpb=1c4dccbbbe097458814e018842facbe8c49b5d8a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 9690d45bc9..26b86f9762 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -100,6 +100,25 @@ class SpecialSearch extends SpecialPage { * @param string $par */ public function execute( $par ) { + $request = $this->getRequest(); + + // Fetch the search term + $search = str_replace( "\n", " ", $request->getText( 'search' ) ); + + // Historically search terms have been accepted not only in the search query + // parameter, but also as part of the primary url. This can have PII implications + // in releasing page view data. As such issue a 301 redirect to the correct + // URL. + if ( strlen( $par ) && !strlen( $search ) ) { + $query = $request->getValues(); + unset( $query['title'] ); + // Strip underscores from title parameter; most of the time we'll want + // text form here. But don't strip underscores from actual text params! + $query['search'] = str_replace( '_', ' ', $par ); + $this->getOutput()->redirect( $this->getPageTitle()->getFullURL( $query ), 301 ); + return; + } + $this->setHeaders(); $this->outputHeader(); $out = $this->getOutput(); @@ -110,15 +129,6 @@ class SpecialSearch extends SpecialPage { ] ); $this->addHelpLink( 'Help:Searching' ); - // Strip underscores from title parameter; most of the time we'll want - // text form here. But don't strip underscores from actual text params! - $titleParam = str_replace( '_', ' ', $par ); - - $request = $this->getRequest(); - - // Fetch the search term - $search = str_replace( "\n", " ", $request->getText( 'search', $titleParam ) ); - $this->load(); if ( !is_null( $request->getVal( 'nsRemember' ) ) ) { $this->saveNamespaces();