Revert r36076, r36109, r36110 -- just doesn't work right. Sometimes removes blocks...
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 9 Jun 2008 23:16:34 +0000 (23:16 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 9 Jun 2008 23:16:34 +0000 (23:16 +0000)
RELEASE-NOTES
includes/SpecialBlockip.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 7c65969..5daa2bc 100644 (file)
@@ -342,7 +342,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 14385) "Move subpages" option no longer tries to move to invalid titles
 * (bug 14386) Fix subpage namespace oddity when moving a talk page
 * (bug 11771) Signup form now not shown if in read-only mode.
-* (bug 10080) Users can now modify an existing block without unblocking first.
 * (bug 12859) $wgRateLimitsExcludedGroups has been deprecated in favor of
   $wgGroupPermissions[]['noratelimit']. 
 * (Bug 13828) Split parameter $1 of MediaWiki:Missingarticle into $1 (=title)
index 495ee74..5ea25ca 100644 (file)
@@ -32,10 +32,8 @@ function wfSpecialBlockip( $par ) {
        } else if ( $wgRequest->wasPosted() && 'submit' == $action &&
                $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
                $ipb->doSubmit();
-       } else if ( $ipb->AlreadyBlocked ) {
-               $ipb->showForm( wfMsg('ipb_tweak_block', $ipb->BlockAddress ) );
        } else {
-               $ipb->showForm('');
+               $ipb->showForm( '' );
        }
 }
 
@@ -49,32 +47,10 @@ class IPBlockForm {
 #      var $BlockEmail;
 
        function IPBlockForm( $par ) {
-               global $wgRequest, $wgUser, $wgLang;
+               global $wgRequest, $wgUser;
 
                $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
                $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' );
-               $this->AlreadyBlocked = false;
-
-               if( $this->BlockAddress && !$wgRequest->wasPosted() ){
-                       $this->mBlock = new Block();
-                       if( $this->mBlock->load($this->BlockAddress) && $this->BlockAddress == $this->mBlock->mAddress ) {
-                               $this->AlreadyBlocked = true;
-                               $this->BlockReason = wfMsgForContent( 'ipb_modifying_block' );
-                               $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
-                               $this->BlockExpiry = wfMsg('ipbotheroption');
-                               $this->BlockOther = $wgLang->timeanddate( $this->mBlock->mExpiry );
-                               $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', true );
-                               $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', true );
-                               $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', true );
-                               $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false );
-                               $this->BlockEmail = $this->mBlock->mBlockEmail;
-                               $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false );
-                               # Re-check user's rights to hide names, very serious, defaults to 0
-                               $this->BlockHideName = ( $this->mBlock->mHideName && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0;
-                               return true;
-                       }
-               }
-               
                $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
                $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
                $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
@@ -93,7 +69,7 @@ class IPBlockForm {
        }
 
        function showForm( $err ) {
-               global $wgOut, $wgUser, $wgSysopUserBans, $wgRequest;
+               global $wgOut, $wgUser, $wgSysopUserBans;
 
                $wgOut->setPagetitle( wfMsg( 'blockip' ) );
                $wgOut->addWikiMsg( 'blockiptext' );
@@ -110,10 +86,8 @@ class IPBlockForm {
 
                $titleObj = SpecialPage::getTitleFor( 'Blockip' );
 
-               if ( $wgRequest->wasPosted() ) {
-                       $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
-               }
                if ( "" != $err ) {
+                       $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
                        $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) );
                }
 
@@ -388,11 +362,9 @@ class IPBlockForm {
 
                if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
 
-                       if ( $oldblock = Block::newFromDB( $this->BlockAddress ) && $oldblock->mAddress == $this->BlockAddress  ) {
-                               $oldblock->delete(); // Block already exists. Silently delete it
+                       if ( !$block->insert() ) {
+                               return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
                        }
-                       $block->insert();
-
 
                        wfRunHooks('BlockIpComplete', array($block, $wgUser));
 
index 55fc753..840bf48 100644 (file)
@@ -2363,9 +2363,6 @@ See the [[Special:Ipblocklist|IP block list]] for the list of currently operatio
 'ipb_expiry_invalid'          => 'Expiry time invalid.',
 'ipb_expiry_temp'             => 'Hidden username blocks should be permanent.',
 'ipb_already_blocked'         => '"$1" is already blocked',
-'ipb_modifying_block'         => 'Modifying existing block:',
-'ipb_tweak_block'             => 'Caution: This user ($1) is already blocked.
-You can use this form to change the block settings.',
 'ipb_cant_unblock'            => 'Error: Block ID $1 not found. It may have been unblocked already.',
 'ipb_blocked_as_range'        => 'Error: The IP $1 is not blocked directly and cannot be unblocked.
 It is, however, blocked as part of the range $2, which can be unblocked.',
index 1c5107f..99fd0e6 100644 (file)
@@ -1618,6 +1618,7 @@ $wgMessageStructure = array(
                'ipb_expiry_invalid',
                'ipb_expiry_temp',
                'ipb_already_blocked',
+               'ipb_tweak_block',
                'ipb_modifying_block',
                'ipb_tweak_block',
                'ipb_cant_unblock',