Index: trunk/phase3/includes/User.php |
— | — | @@ -1284,9 +1284,6 @@ |
1285 | 1285 | $this->mBlockreason = $this->mBlock->mReason; |
1286 | 1286 | $this->mHideName = $this->mBlock->mHideName; |
1287 | 1287 | $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' ); |
1288 | | - if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) { |
1289 | | - $this->spreadBlock(); |
1290 | | - } |
1291 | 1288 | } |
1292 | 1289 | |
1293 | 1290 | # Proxy blocking |
— | — | @@ -2940,22 +2937,35 @@ |
2941 | 2938 | } |
2942 | 2939 | |
2943 | 2940 | /** |
2944 | | - * If this (non-anonymous) user is blocked, block any IP address |
2945 | | - * they've successfully logged in from. |
| 2941 | + * If this user is logged-in and blocked, |
| 2942 | + * block any IP address they've successfully logged in from. |
| 2943 | + * @return bool A block was spread |
2946 | 2944 | */ |
2947 | | - public function spreadBlock() { |
| 2945 | + public function spreadAnyEditBlock() { |
| 2946 | + if ( $this->isLoggedIn() && $this->isBlocked() ) { |
| 2947 | + return $this->spreadBlock(); |
| 2948 | + } |
| 2949 | + return false; |
| 2950 | + } |
| 2951 | + |
| 2952 | + /** |
| 2953 | + * If this (non-anonymous) user is blocked, |
| 2954 | + * block the IP address they've successfully logged in from. |
| 2955 | + * @return bool A block was spread |
| 2956 | + */ |
| 2957 | + protected function spreadBlock() { |
2948 | 2958 | wfDebug( __METHOD__ . "()\n" ); |
2949 | 2959 | $this->load(); |
2950 | 2960 | if ( $this->mId == 0 ) { |
2951 | | - return; |
| 2961 | + return false; |
2952 | 2962 | } |
2953 | 2963 | |
2954 | 2964 | $userblock = Block::newFromTarget( $this->getName() ); |
2955 | 2965 | if ( !$userblock ) { |
2956 | | - return; |
| 2966 | + return false; |
2957 | 2967 | } |
2958 | 2968 | |
2959 | | - $userblock->doAutoblock( $this->getRequest()->getIP() ); |
| 2969 | + return (bool)$userblock->doAutoblock( $this->getRequest()->getIP() ); |
2960 | 2970 | } |
2961 | 2971 | |
2962 | 2972 | /** |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -405,6 +405,9 @@ |
406 | 406 | |
407 | 407 | $permErrors = $this->getEditPermissionErrors(); |
408 | 408 | if ( $permErrors ) { |
| 409 | + // Auto-block user's IP if the account was "hard" blocked |
| 410 | + $wgUser->spreadAnyEditBlock(); |
| 411 | + |
409 | 412 | wfDebug( __METHOD__ . ": User can't edit\n" ); |
410 | 413 | $content = $this->getContent( null ); |
411 | 414 | $content = $content === '' ? null : $content; |
Index: trunk/phase3/includes/specials/SpecialMovepage.php |
— | — | @@ -72,6 +72,8 @@ |
73 | 73 | # Check rights |
74 | 74 | $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user ); |
75 | 75 | if( !empty( $permErrors ) ) { |
| 76 | + // Auto-block user's IP if the account was "hard" blocked |
| 77 | + $user->spreadAnyEditBlock(); |
76 | 78 | $this->getOutput()->showPermissionsErrorPage( $permErrors ); |
77 | 79 | return; |
78 | 80 | } |