Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -2073,6 +2073,7 @@ |
2074 | 2074 | 'badipaddress', |
2075 | 2075 | 'blockipsuccesssub', |
2076 | 2076 | 'blockipsuccesstext', |
| 2077 | + 'ipb-blockingself', |
2077 | 2078 | 'ipb-edit-dropdown', |
2078 | 2079 | 'ipb-unblock-addr', |
2079 | 2080 | 'ipb-unblock', |
Index: trunk/phase3/includes/specials/SpecialBlock.php |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' ); |
223 | 223 | } |
224 | 224 | $fields['Reason']['default'] = $block->mReason; |
225 | | - $fields['AlreadyBlocked']['default'] = true; |
| 225 | + $fields['AlreadyBlocked']['default'] = htmlspecialchars( $block->getTarget() ); |
226 | 226 | |
227 | 227 | if( $block->mExpiry == 'infinity' ) { |
228 | 228 | $fields['Expiry']['default'] = 'indefinite'; |
— | — | @@ -486,11 +486,23 @@ |
487 | 487 | $user = $target; |
488 | 488 | $target = $user->getName(); |
489 | 489 | $userId = $user->getId(); |
| 490 | + |
| 491 | + # Give admins a heads-up before they go and block themselves. Much messier |
| 492 | + # to do this for IPs, but it's pretty unlikely they'd ever get the 'block' |
| 493 | + # permission anyway, although the code does allow for it |
| 494 | + if( $target == $wgUser->getName() |
| 495 | + && $data['AlreadyBlocked'] != htmlspecialchars( $wgUser->getName() ) ) |
| 496 | + { |
| 497 | + return array( 'ipb-blockingself' ); |
| 498 | + } |
| 499 | + |
490 | 500 | } elseif( $type == Block::TYPE_RANGE ){ |
491 | 501 | $userId = 0; |
| 502 | + |
492 | 503 | } elseif( $type == Block::TYPE_IP ){ |
493 | 504 | $target = $target->getName(); |
494 | 505 | $userId = 0; |
| 506 | + |
495 | 507 | } else { |
496 | 508 | # This should have been caught in the form field validation |
497 | 509 | return array( 'badipaddress' ); |
— | — | @@ -556,7 +568,7 @@ |
557 | 569 | $status = $block->insert(); |
558 | 570 | if( !$status ) { |
559 | 571 | # Show form unless the user is already aware of this... |
560 | | - if( !$data['AlreadyBlocked'] ) { |
| 572 | + if( $data['AlreadyBlocked'] != htmlspecialchars( $block->getTarget() ) ) { |
561 | 573 | return array( array( 'ipb_already_blocked', $block->getTarget() ) ); |
562 | 574 | # Otherwise, try to update the block... |
563 | 575 | } else { |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -3060,6 +3060,7 @@ |
3061 | 3061 | 'blockipsuccesssub' => 'Block succeeded', |
3062 | 3062 | 'blockipsuccesstext' => '[[Special:Contributions/$1|$1]] has been blocked.<br /> |
3063 | 3063 | See [[Special:IPBlockList|IP block list]] to review blocks.', |
| 3064 | +'ipb-blockingself' => 'You are about to block yourself! Are you sure you want to do that?', |
3064 | 3065 | 'ipb-edit-dropdown' => 'Edit block reasons', |
3065 | 3066 | 'ipb-unblock-addr' => 'Unblock $1', |
3066 | 3067 | 'ipb-unblock' => 'Unblock a username or IP address', |