Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -47,10 +47,32 @@ |
48 | 48 | # var $BlockEmail; |
49 | 49 | |
50 | 50 | function IPBlockForm( $par ) { |
51 | | - global $wgRequest, $wgUser; |
| 51 | + global $wgRequest, $wgUser, $wgLang; |
52 | 52 | |
53 | 53 | $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) ); |
54 | 54 | $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' ); |
| 55 | + $this->AlreadyBlocked = false; |
| 56 | + |
| 57 | + if( $this->BlockAddress && !$wgRequest->wasPosted() ){ |
| 58 | + $this->mBlock = new Block(); |
| 59 | + if( $this->mBlock->load($this->BlockAddress) ) { |
| 60 | + $this->AlreadyBlocked = true; |
| 61 | + $this->BlockReason = wfMsgForContent( 'ipb_modifying_block' ); |
| 62 | + $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' ); |
| 63 | + $this->BlockExpiry = wfMsg('ipbotheroption'); |
| 64 | + $this->BlockOther = $wgLang->timeanddate( $this->mBlock->mExpiry ); |
| 65 | + $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', true ); |
| 66 | + $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', true ); |
| 67 | + $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', true ); |
| 68 | + $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false ); |
| 69 | + $this->BlockEmail = $this->mBlock->mBlockEmail; |
| 70 | + $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false ); |
| 71 | + # Re-check user's rights to hide names, very serious, defaults to 0 |
| 72 | + $this->BlockHideName = ( $this->mBlock->mHideName && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0; |
| 73 | + return true; |
| 74 | + } |
| 75 | + } |
| 76 | + |
55 | 77 | $this->BlockReason = $wgRequest->getText( 'wpBlockReason' ); |
56 | 78 | $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' ); |
57 | 79 | $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') ); |
— | — | @@ -111,6 +133,10 @@ |
112 | 134 | wfMsgForContent( 'ipbreasonotherlist' ), '', 'wpBlockDropDown', 4 ); |
113 | 135 | |
114 | 136 | global $wgStylePath, $wgStyleVersion; |
| 137 | + if( $this->AlreadyBlocked ) { |
| 138 | + $wgOut->addHTML( Xml::element( 'p', array ( 'class' => 'error' ), |
| 139 | + wfMsg( 'ipb_already_blocked', $this->BlockAddress ) ) ); |
| 140 | + } |
115 | 141 | $wgOut->addHTML( |
116 | 142 | Xml::tags( 'script', array( 'type' => 'text/javascript', 'src' => "$wgStylePath/common/block.js?$wgStyleVersion" ), '' ) . |
117 | 143 | Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( "action=submit" ), 'id' => 'blockip' ) ) . |
— | — | @@ -358,7 +384,10 @@ |
359 | 385 | if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) { |
360 | 386 | |
361 | 387 | if ( !$block->insert() ) { |
362 | | - return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress)); |
| 388 | + // Block already exists. Silently delete the existing block and insert it again |
| 389 | + $oldblock = Block::newFromDB( $this->BlockAddress ); |
| 390 | + $oldblock->delete(); |
| 391 | + $block->insert(); |
363 | 392 | } |
364 | 393 | |
365 | 394 | wfRunHooks('BlockIpComplete', array($block, $wgUser)); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2356,7 +2356,8 @@ |
2357 | 2357 | 'block-log-flags-noemail' => 'e-mail blocked', |
2358 | 2358 | 'range_block_disabled' => 'The sysop ability to create range blocks is disabled.', |
2359 | 2359 | 'ipb_expiry_invalid' => 'Expiry time invalid.', |
2360 | | -'ipb_already_blocked' => '"$1" is already blocked', |
| 2360 | +'ipb_already_blocked' => 'Caution: "$1" is alrady blocked. You can modify the block settings by using this form.', |
| 2361 | +'ipb_modifying_block' => 'Modifying existing block:', |
2361 | 2362 | 'ipb_cant_unblock' => 'Error: Block ID $1 not found. It may have been unblocked already.', |
2362 | 2363 | 'ipb_blocked_as_range' => 'Error: The IP $1 is not blocked directly and cannot be unblocked. |
2363 | 2364 | It is, however, blocked as part of the range $2, which can be unblocked.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -334,6 +334,7 @@ |
335 | 335 | * (bug 14385) "Move subpages" option no longer tries to move to invalid titles |
336 | 336 | * (bug 14386) Fix subpage namespace oddity when moving a talk page |
337 | 337 | * (bug 11771) Signup form now not shown if in read-only mode. |
| 338 | +* (bug 10080) Users can now modify an existing block without unblocking first. |
338 | 339 | |
339 | 340 | === API changes in 1.13 === |
340 | 341 | |