r35977 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35976‎ | r35977 | r35978 >
Date:18:33, 6 June 2008
Author:demon
Status:old
Tags:
Comment:
Breaks rangeblocks. Keeping out of trunk until we can figure out why.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBlockip.php
@@ -32,10 +32,8 @@
3333 } else if ( $wgRequest->wasPosted() && 'submit' == $action &&
3434 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
3535 $ipb->doSubmit();
36 - } else if ( $ipb->AlreadyBlocked ) {
37 - $ipb->showForm( wfMsg('ipb_already_blocked', $ipb->BlockAddress ) );
3836 } else {
39 - $ipb->showForm('');
 37+ $ipb->showForm( '' );
4038 }
4139 }
4240
@@ -49,32 +47,10 @@
5048 # var $BlockEmail;
5149
5250 function IPBlockForm( $par ) {
53 - global $wgRequest, $wgUser, $wgLang;
 51+ global $wgRequest, $wgUser;
5452
5553 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
5654 $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) ) {
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 -
7955 $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
8056 $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
8157 $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
@@ -93,7 +69,7 @@
9470 }
9571
9672 function showForm( $err ) {
97 - global $wgOut, $wgUser, $wgSysopUserBans, $wgRequest;
 73+ global $wgOut, $wgUser, $wgSysopUserBans;
9874
9975 $wgOut->setPagetitle( wfMsg( 'blockip' ) );
10076 $wgOut->addWikiMsg( 'blockiptext' );
@@ -110,10 +86,8 @@
11187
11288 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
11389
114 - if ( $wgRequest->wasPosted() ) {
115 - $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
116 - }
11790 if ( "" != $err ) {
 91+ $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
11892 $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) );
11993 }
12094
@@ -384,10 +358,7 @@
385359 if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
386360
387361 if ( !$block->insert() ) {
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();
 362+ return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
392363 }
393364
394365 wfRunHooks('BlockIpComplete', array($block, $wgUser));
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2360,9 +2360,7 @@
23612361 'block-log-flags-noemail' => 'e-mail blocked',
23622362 'range_block_disabled' => 'The sysop ability to create range blocks is disabled.',
23632363 'ipb_expiry_invalid' => 'Expiry time invalid.',
2364 -'ipb_already_blocked' => 'Caution: "$1" is already blocked.
2365 -You can modify the block settings by using this form.',
2366 -'ipb_modifying_block' => 'Modifying existing block:',
 2364+'ipb_already_blocked' => '"$1" is already blocked',
23672365 'ipb_cant_unblock' => 'Error: Block ID $1 not found. It may have been unblocked already.',
23682366 'ipb_blocked_as_range' => 'Error: The IP $1 is not blocked directly and cannot be unblocked.
23692367 It is, however, blocked as part of the range $2, which can be unblocked.',
Index: trunk/phase3/RELEASE-NOTES
@@ -338,7 +338,6 @@
339339 * (bug 14385) "Move subpages" option no longer tries to move to invalid titles
340340 * (bug 14386) Fix subpage namespace oddity when moving a talk page
341341 * (bug 11771) Signup form now not shown if in read-only mode.
342 -* (bug 10080) Users can now modify an existing block without unblocking first.
343342 * (bug 12859) $wgRateLimitsExcludedGroups has been deprecated in favor of
344343 $wgGroupPermissions[]['noratelimit'].
345344 * (Bug 13828) Split parameter $1 of MediaWiki:Missingarticle into $1 (=title)

Status & tagging log