Handy shortcut: paste in an IP address and click go, redirects to the user contributi...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 29 Apr 2004 02:21:55 +0000 (02:21 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 29 Apr 2004 02:21:55 +0000 (02:21 +0000)
includes/SearchEngine.php

index e40a788..da22677 100644 (file)
@@ -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 );