'Go' button, if an IP address is entered the search engine first checks if an
article by that name exists, otherwise it goes to the user contributions list
of that search engine ( this would catch en.wp.org/wiki/127.0.0.1 ), also,
entering a valid username with the current namespace-3 + : prefix will go to
the users page, regardless of whether it contains any text or not.
return $title;
}
+ $title = Title::newFromText( $term );
+
# Entering an IP address goes to the contributions page
- if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $term ) ) {
- $title = Title::makeTitle( NS_SPECIAL, "Contributions/" . $term );
- return $title;
+ if ( ( $title->getNameSpace() == NS_USER && User::isIP($title->getText() ) )
+ || User::isIP( trim( $term ) ) ) {
+ $t2 = Title::makeTitle( NS_SPECIAL, "Contributions/" . $title->getText() );
+ return $t2;
}
+
+
+ # Entering a user goes to the user page whether it's there or not
+ if ( $title->getNameSpace() == NS_USER ) {
+ if (User::idFromName($title->getText())) {
+ return $title;
+ }
+ }
return NULL;
}