From 7c98afbdb7aee4212b3166ab8bf19706b53830cd Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 29 Apr 2004 02:21:55 +0000 Subject: [PATCH] Handy shortcut: paste in an IP address and click go, redirects to the user contributions page --- includes/SearchEngine.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index e40a788ad1..da2267701f 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -428,9 +428,16 @@ class SearchEngine { global $wgDisableTextSearch; $fname = "SearchEngine::goResult"; - $search = $wgRequest->getText( "search" ); + $search = trim( $wgRequest->getText( "search" ) ); - # First try to go to page as entered. + # Entering an IP address goes to the contributions page + if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { + $title = Title::makeTitle( NS_SPECIAL, "Contributions" ); + $wgOut->redirect( $title->getFullUrl( "target=$search" ) ); + return; + } + + # Try to go to page as entered. # $t = Title::newFromText( $search ); -- 2.20.1