Don't duplicate code, use wfAppendQuery
[lhc/web/wiklou.git] / includes / User.php
index 5661c01..f7d7880 100644 (file)
@@ -646,7 +646,9 @@ class User {
                        return false;
 
                # Clean up name according to title rules
-               $t = Title::newFromText( $name );
+               $t = ($validate === 'valid') ? 
+                       Title::newFromText( $name ) : Title::makeTitle( NS_USER, $name );
+               # Check for invalid titles
                if( is_null( $t ) ) {
                        return false;
                }
@@ -1034,6 +1036,7 @@ class User {
                
                $this->mBlockedby = 0;
                $this->mHideName = 0;
+               $this->mAllowUsertalk = 0;
                $ip = wfGetIP();
 
                if ($this->isAllowed( 'ipblock-exempt' ) ) {
@@ -1049,12 +1052,14 @@ class User {
                        $this->mBlockedby = $this->mBlock->mBy;
                        $this->mBlockreason = $this->mBlock->mReason;
                        $this->mHideName = $this->mBlock->mHideName;
+                       $this->mAllowUsertalk = $this->mBlock->mAllowUsertalk;
                        if ( $this->isLoggedIn() ) {
                                $this->spreadBlock();
                        }
                } else {
-                       $this->mBlock = null;
-                       wfDebug( __METHOD__.": No block.\n" );
+                       // Bug 13611: don't remove mBlock here, to allow account creation blocks to 
+                       // apply to users. Note that the existence of $this->mBlock is not used to 
+                       // check for edit blocks, $this->mBlockedby is instead.
                }
 
                # Proxy blocking
@@ -1263,7 +1268,7 @@ class User {
                wfDebug( __METHOD__.": asking isBlocked()\n" );
                $blocked = $this->isBlocked( $bFromSlave );
                # If a user's name is suppressed, they cannot make edits anywhere
-               if ( !$this->mHideName && $wgBlockAllowsUTEdit && $title->getText() === $this->getName() &&
+               if ( !$this->mHideName && $this->mAllowUsertalk && $title->getText() === $this->getName() &&
                  $title->getNamespace() == NS_USER_TALK ) {
                        $blocked = false;
                        wfDebug( __METHOD__.": self-talk page, ignoring any blocks\n" );