Disable Special:Sitesettings, as it is far far far from working.
[lhc/web/wiklou.git] / includes / SearchEngine.php
index 6526de4..e1de0bb 100644 (file)
@@ -42,6 +42,7 @@ class SearchEngine {
         * If an exact title match can be find, or a very slightly close match,
         * return the title. If no match, returns NULL.
         *
+        * @static
         * @param string $term
         * @return Title
         * @access private
@@ -77,17 +78,20 @@ class SearchEngine {
                $title = Title::newFromText( $term );
 
                # Entering an IP address goes to the contributions page
-               if ( ( $title->getNameSpace() == NS_USER && User::isIP($title->getText() ) ) || User::isIP(trim($term)) ) {
-                       $t2 = Title::makeTitle( NS_SPECIAL, "Contributions/" . $title->getText() );
-                       return $t2;
+               if ( ( $title->getNamespace() == NS_USER && User::isIP($title->getText() ) )
+                       || User::isIP( trim( $term ) ) ) {
+                       return Title::makeTitle( NS_SPECIAL, "Contributions/" . $title->getDbkey() );
                }
 
 
                # 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;
-                       }
+               if ( $title->getNamespace() == NS_USER ) {
+                       return $title;
+               }
+               
+               # Quoted term? Try without the quotes...
+               if( preg_match( '/^"([^"]+)"$/', $term, $matches ) ) {
+                       return SearchEngine::getNearMatch( $matches[1] );
                }
                
                return NULL;