Fixing bug 30973. Strip off subpages when determining the username who the current...
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 19 Sep 2011 11:49:22 +0000 (11:49 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 19 Sep 2011 11:49:22 +0000 (11:49 +0000)
includes/Title.php

index 418740d..c5c2d65 100644 (file)
@@ -639,9 +639,17 @@ class Title {
                        }
                }
 
+               // Strip off subpages
+               $pagename = $this->getText();
+               if ( strpos( $pagename, '/' ) !== false ) {
+                       list( $username , ) = explode( '/', $pagename, 2 );
+               } else {
+                       $username = $pagename;
+               }
+
                if ( $wgContLang->needsGenderDistinction() &&
                                MWNamespace::hasGenderDistinction( $this->mNamespace ) ) {
-                       $gender = GenderCache::singleton()->getGenderOf( $this->getText(), __METHOD__ );
+                       $gender = GenderCache::singleton()->getGenderOf( $username, __METHOD__ );
                        return $wgContLang->getGenderNsText( $this->mNamespace, $gender );
                }