* Yummie ? : syntax.
[lhc/web/wiklou.git] / includes / SearchEngine.php
index d368086..a49f8e5 100644 (file)
@@ -4,7 +4,9 @@
  * @package MediaWiki
  */
 
-/** */
+/**
+ * @package MediaWiki
+ */
 class SearchEngine {
        var $limit = 10;
        var $offset = 0;
@@ -72,9 +74,17 @@ class SearchEngine {
                        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 );
+               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 ) {
                        return $title;
                }
                
@@ -118,7 +128,7 @@ class SearchEngine {
                global $wgContLang;
                $arr = array();
                foreach( $wgContLang->getNamespaces() as $ns => $name ) {
-                       if( $ns >= 0 ) {
+                       if( $ns >= NS_MAIN ) {
                                $arr[$ns] = $name;
                        }
                }
@@ -238,7 +248,9 @@ class SearchEngine {
        
 }
 
-/** */
+/**
+ * @package MediaWiki
+ */
 class SearchEngineDummy {
        function search( $term ) {
                return null;