* @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();
] );
$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();
if ( $textMatches && !$textStatus ) {
// output appropriate heading
if ( $numTextMatches > 0 && $numTitleMatches > 0 ) {
- $out->addHTML( '<div class="visualClear"></div>' );
+ $out->addHTML( '<div class="mw-search-visualclear"></div>' );
// if no title matches the heading is redundant
$out->wrapWikiMsg( "==$1==\n", 'textmatches' );
}
$textMatches->free();
}
- $out->addHTML( '<div class="visualClear"></div>' );
+ $out->addHTML( '<div class="mw-search-visualclear"></div>' );
if ( $prevnext ) {
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
protected function interwikiHeader( $interwiki, $interwikiResult ) {
// TODO: we need to figure out how to name wikis correctly
$wikiMsg = $this->msg( 'search-interwiki-results-' . $interwiki )->parse();
- return "<p class=\"mw-search-interwiki-header\">\n$wikiMsg</p>";
+ return "<p class=\"mw-search-interwiki-header mw-search-visualclear\">\n$wikiMsg</p>";
}
/**
* @return string
*/
protected function searchProfileTabs( $term ) {
- $out = Html::element( 'div', [ 'class' => 'visualClear' ] ) .
+ $out = Html::element( 'div', [ 'class' => 'mw-search-visualclear' ] ) .
Xml::openElement( 'div', [ 'class' => 'mw-search-profile-tabs' ] );
$bareterm = $term;
'autofocus' => trim( $term ) === '',
'value' => $term,
'dataLocation' => 'content',
+ 'infusable' => true,
] );
$layout = new OOUI\ActionFieldLayout( $searchWidget, new OOUI\ButtonInputWidget( [