From 54a60c9f09830c8d4cf1ac3eb6253ab6af6a7447 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 1 Feb 2005 07:53:28 +0000 Subject: [PATCH] Reverting patch for now: * It hard-codes the English string "user", and doesn't allow localized user namespaces. * Title::makeTitle doesn't perform validity checks as it's meant mainly for data pulled from the database which has been previously screened. Use Title::makeTitleSafe(). * The ereg_replace is a bit odd. Trimming of stray whitespace from the search term should be done at the top end in SpecialSearch.php, not down there. --- includes/SearchEngine.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index f802aebaf8..2e83974c8f 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -47,9 +47,6 @@ class SearchEngine { * @access private */ function getNearMatch( $term ) { - # Eliminate Blanks at start - $term = ereg_replace('[[:blank:]]*', '', $term); - # Exact match? No need to look further. $title = Title::newFromText( $term ); if ( $title->getNamespace() == NS_SPECIAL || 0 != $title->getArticleID() ) { @@ -78,18 +75,10 @@ class SearchEngine { } # Entering an IP address goes to the contributions page - if ( preg_match( '/^(user:)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', strtolower($term) ) ) { + 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; } - - # Entering a user goes to the user page whether it's there or not - if ( preg_match( '/^user:/', strtolower($term) ) ) { - if (User::idFromName($term)) { - $title = Title::newFromURL( $term ); - return $title; - } - } return NULL; } -- 2.20.1