Index: branches/wmf/1.18wmf1/includes/User.php |
— | — | @@ -1274,9 +1274,6 @@ |
1275 | 1275 | $this->mBlockreason = $this->mBlock->mReason; |
1276 | 1276 | $this->mHideName = $this->mBlock->mHideName; |
1277 | 1277 | $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' ); |
1278 | | - if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) { |
1279 | | - $this->spreadBlock(); |
1280 | | - } |
1281 | 1278 | } |
1282 | 1279 | |
1283 | 1280 | # Proxy blocking |
— | — | @@ -2906,22 +2903,35 @@ |
2907 | 2904 | } |
2908 | 2905 | |
2909 | 2906 | /** |
2910 | | - * If this (non-anonymous) user is blocked, block any IP address |
2911 | | - * they've successfully logged in from. |
| 2907 | + * If this user is logged-in and blocked, |
| 2908 | + * block any IP address they've successfully logged in from. |
| 2909 | + * @return bool A block was spread |
2912 | 2910 | */ |
2913 | | - public function spreadBlock() { |
| 2911 | + public function spreadAnyEditBlock() { |
| 2912 | + if ( $this->isLoggedIn() && $this->isBlocked() ) { |
| 2913 | + return $this->spreadBlock(); |
| 2914 | + } |
| 2915 | + return false; |
| 2916 | + } |
| 2917 | + |
| 2918 | + /** |
| 2919 | + * If this (non-anonymous) user is blocked, |
| 2920 | + * block the IP address they've successfully logged in from. |
| 2921 | + * @return bool A block was spread |
| 2922 | + */ |
| 2923 | + protected function spreadBlock() { |
2914 | 2924 | wfDebug( __METHOD__ . "()\n" ); |
2915 | 2925 | $this->load(); |
2916 | 2926 | if ( $this->mId == 0 ) { |
2917 | | - return; |
| 2927 | + return false; |
2918 | 2928 | } |
2919 | 2929 | |
2920 | 2930 | $userblock = Block::newFromTarget( $this->getName() ); |
2921 | 2931 | if ( !$userblock ) { |
2922 | | - return; |
| 2932 | + return false; |
2923 | 2933 | } |
2924 | 2934 | |
2925 | | - $userblock->doAutoblock( wfGetIP() ); |
| 2935 | + return (bool)$userblock->doAutoblock( $this->getRequest()->getIP() ); |
2926 | 2936 | } |
2927 | 2937 | |
2928 | 2938 | /** |
Index: branches/wmf/1.18wmf1/includes/EditPage.php |
— | — | @@ -402,6 +402,9 @@ |
403 | 403 | |
404 | 404 | $permErrors = $this->getEditPermissionErrors(); |
405 | 405 | if ( $permErrors ) { |
| 406 | + // Auto-block user's IP if the account was "hard" blocked |
| 407 | + $wgUser->spreadAnyEditBlock(); |
| 408 | + |
406 | 409 | wfDebug( __METHOD__ . ": User can't edit\n" ); |
407 | 410 | $content = $this->getContent( null ); |
408 | 411 | $content = $content === '' ? null : $content; |
— | — | @@ -934,6 +937,8 @@ |
935 | 938 | return $status; |
936 | 939 | } |
937 | 940 | if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) { |
| 941 | + // Auto-block user's IP if the account was "hard" blocked |
| 942 | + $wgUser->spreadAnyEditBlock(); |
938 | 943 | # Check block state against master, thus 'false'. |
939 | 944 | $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER ); |
940 | 945 | wfProfileOut( __METHOD__ . '-checks' ); |
Index: branches/wmf/1.18wmf1/includes/Title.php |
— | — | @@ -3139,8 +3139,11 @@ |
3140 | 3140 | * @return Mixed true on success, getUserPermissionsErrors()-like array on failure |
3141 | 3141 | */ |
3142 | 3142 | public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) { |
| 3143 | + global $wgUser; |
3143 | 3144 | $err = $this->isValidMoveOperation( $nt, $auth, $reason ); |
3144 | 3145 | if ( is_array( $err ) ) { |
| 3146 | + // Auto-block user's IP if the account was "hard" blocked |
| 3147 | + $wgUser->spreadAnyEditBlock(); |
3145 | 3148 | return $err; |
3146 | 3149 | } |
3147 | 3150 | |
Index: branches/wmf/1.18wmf1/includes/specials/SpecialMovepage.php |
— | — | @@ -74,7 +74,9 @@ |
75 | 75 | # Check rights |
76 | 76 | $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $wgUser ); |
77 | 77 | if( !empty( $permErrors ) ) { |
78 | | - $wgOut->showPermissionsErrorPage( $permErrors ); |
| 78 | + // Auto-block user's IP if the account was "hard" blocked |
| 79 | + $user->spreadAnyEditBlock(); |
| 80 | + $this->getOutput()->showPermissionsErrorPage( $permErrors ); |
79 | 81 | return; |
80 | 82 | } |
81 | 83 | |