From: Tim Starling Date: Thu, 29 Apr 2004 02:21:55 +0000 (+0000) Subject: Handy shortcut: paste in an IP address and click go, redirects to the user contributi... X-Git-Tag: 1.3.0beta1~203 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=7c98afbdb7aee4212b3166ab8bf19706b53830cd;p=lhc%2Fweb%2Fwiklou.git Handy shortcut: paste in an IP address and click go, redirects to the user contributions page --- 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 );