Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1618,6 +1618,7 @@ |
1619 | 1619 | 'ipb_expiry_invalid', |
1620 | 1620 | 'ipb_expiry_temp', |
1621 | 1621 | 'ipb_already_blocked', |
| 1622 | + 'ipb_tweak_block', |
1622 | 1623 | 'ipb_modifying_block', |
1623 | 1624 | 'ipb_cant_unblock', |
1624 | 1625 | 'ipb_blocked_as_range', |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -32,8 +32,10 @@ |
33 | 33 | } else if ( $wgRequest->wasPosted() && 'submit' == $action && |
34 | 34 | $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { |
35 | 35 | $ipb->doSubmit(); |
| 36 | + } else if ( $ipb->AlreadyBlocked ) { |
| 37 | + $ipb->showForm( wfMsg('ipb_tweak_block', $ipb->BlockAddress ) ); |
36 | 38 | } else { |
37 | | - $ipb->showForm( '' ); |
| 39 | + $ipb->showForm(''); |
38 | 40 | } |
39 | 41 | } |
40 | 42 | |
— | — | @@ -47,10 +49,32 @@ |
48 | 50 | # var $BlockEmail; |
49 | 51 | |
50 | 52 | function IPBlockForm( $par ) { |
51 | | - global $wgRequest, $wgUser; |
| 53 | + global $wgRequest, $wgUser, $wgLang; |
52 | 54 | |
53 | 55 | $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) ); |
54 | 56 | $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' ); |
| 57 | + $this->AlreadyBlocked = false; |
| 58 | + |
| 59 | + if( $this->BlockAddress && !$wgRequest->wasPosted() ){ |
| 60 | + $this->mBlock = new Block(); |
| 61 | + if( $this->mBlock->load($this->BlockAddress) && $this->BlockAddress == $this->mBlock->mAddress ) { |
| 62 | + $this->AlreadyBlocked = true; |
| 63 | + $this->BlockReason = wfMsgForContent( 'ipb_modifying_block' ); |
| 64 | + $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' ); |
| 65 | + $this->BlockExpiry = wfMsg('ipbotheroption'); |
| 66 | + $this->BlockOther = $wgLang->timeanddate( $this->mBlock->mExpiry ); |
| 67 | + $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', true ); |
| 68 | + $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', true ); |
| 69 | + $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', true ); |
| 70 | + $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false ); |
| 71 | + $this->BlockEmail = $this->mBlock->mBlockEmail; |
| 72 | + $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false ); |
| 73 | + # Re-check user's rights to hide names, very serious, defaults to 0 |
| 74 | + $this->BlockHideName = ( $this->mBlock->mHideName && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0; |
| 75 | + return true; |
| 76 | + } |
| 77 | + } |
| 78 | + |
55 | 79 | $this->BlockReason = $wgRequest->getText( 'wpBlockReason' ); |
56 | 80 | $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' ); |
57 | 81 | $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') ); |
— | — | @@ -69,7 +93,7 @@ |
70 | 94 | } |
71 | 95 | |
72 | 96 | function showForm( $err ) { |
73 | | - global $wgOut, $wgUser, $wgSysopUserBans; |
| 97 | + global $wgOut, $wgUser, $wgSysopUserBans, $wgRequest; |
74 | 98 | |
75 | 99 | $wgOut->setPagetitle( wfMsg( 'blockip' ) ); |
76 | 100 | $wgOut->addWikiMsg( 'blockiptext' ); |
— | — | @@ -86,8 +110,10 @@ |
87 | 111 | |
88 | 112 | $titleObj = SpecialPage::getTitleFor( 'Blockip' ); |
89 | 113 | |
| 114 | + if ( $wgRequest->wasPosted() ) { |
| 115 | + $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); |
| 116 | + } |
90 | 117 | if ( "" != $err ) { |
91 | | - $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); |
92 | 118 | $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) ); |
93 | 119 | } |
94 | 120 | |
— | — | @@ -363,7 +389,10 @@ |
364 | 390 | if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) { |
365 | 391 | |
366 | 392 | if ( !$block->insert() ) { |
367 | | - return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress)); |
| 393 | + // Block already exists. Silently delete the existing block and insert it again |
| 394 | + $oldblock = Block::newFromDB( $this->BlockAddress ); |
| 395 | + $oldblock->delete(); |
| 396 | + $block->insert(); |
368 | 397 | } |
369 | 398 | |
370 | 399 | wfRunHooks('BlockIpComplete', array($block, $wgUser)); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2363,6 +2363,9 @@ |
2364 | 2364 | 'ipb_expiry_invalid' => 'Expiry time invalid.', |
2365 | 2365 | 'ipb_expiry_temp' => 'Hidden username blocks should be permanent.', |
2366 | 2366 | 'ipb_already_blocked' => '"$1" is already blocked', |
| 2367 | +'ipb_modifying_block' => 'Modifying existing block:', |
| 2368 | +'ipb_tweak_block' => 'Caution: This user ($1) is already blocked. |
| 2369 | +You can use this form to change the block settings.', |
2367 | 2370 | 'ipb_cant_unblock' => 'Error: Block ID $1 not found. It may have been unblocked already.', |
2368 | 2371 | 'ipb_blocked_as_range' => 'Error: The IP $1 is not blocked directly and cannot be unblocked. |
2369 | 2372 | It is, however, blocked as part of the range $2, which can be unblocked.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -342,6 +342,7 @@ |
343 | 343 | * (bug 14385) "Move subpages" option no longer tries to move to invalid titles |
344 | 344 | * (bug 14386) Fix subpage namespace oddity when moving a talk page |
345 | 345 | * (bug 11771) Signup form now not shown if in read-only mode. |
| 346 | +* (bug 10080) Users can now modify an existing block without unblocking first. |
346 | 347 | * (bug 12859) $wgRateLimitsExcludedGroups has been deprecated in favor of |
347 | 348 | $wgGroupPermissions[]['noratelimit']. |
348 | 349 | * (Bug 13828) Split parameter $1 of MediaWiki:Missingarticle into $1 (=title) |