Cleanup for r27897:
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 29 Nov 2007 07:01:30 +0000 (07:01 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 29 Nov 2007 07:01:30 +0000 (07:01 +0000)
* Title::getBaseText is misleading as this function returns the subpage of a subsubpage instead of the root page
  (maybe my fault by misinterpreting "Get the base name, i.e. the leftmost parts before the /"
* Fixes an issue for the (rare?) case that subpages are disabled for user (talk) namespace

includes/EditPage.php

index 45c4ad9..c7d9445 100644 (file)
@@ -628,11 +628,13 @@ class EditPage {
 
                # Show a warning message when someone creates/edits a user (talk) page but the user does not exists
                if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) {
-                       $id = User::idFromName( $this->mTitle->getBaseText() );
-                       $ip = User::isIP( $this->mTitle->getBaseText() );
+                       $parts = explode( '/', $this->mTitle->getText(), 2 );
+                       $username = $parts[0];
+                       $id = User::idFromName( $username );
+                       $ip = User::isIP( $username );
 
                        if ( $id == 0 && !$ip ) {
-                               $wgOut->addWikiText( '<div class="mw-userpage-userdoesnotexist error">' . wfMsg( 'userpage-userdoesnotexist', $this->mTitle->getBaseText() ) . '</div>' );
+                               $wgOut->addWikiText( '<div class="mw-userpage-userdoesnotexist error">' . wfMsg( 'userpage-userdoesnotexist', $username ) . '</div>' );
                        }
                }