* (bug 20478) Add a note to Special:Block when the IP is already globally blocked
authorRaimond Spekking <raymond@users.mediawiki.org>
Sat, 31 Oct 2009 09:35:29 +0000 (09:35 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Sat, 31 Oct 2009 09:35:29 +0000 (09:35 +0000)
Works for blocks by TorBlock too
ToDo: bug 20188 for blocked usernames by CentralAuth

RELEASE-NOTES
includes/specials/SpecialBlockip.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index ee5650b..c321126 100644 (file)
@@ -266,8 +266,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   contains the number of revisions in the history
 * $wgStylePath and $wgLogo are now set in the default LocalSettings.php file.
 * (bug 20186) Allow filtering history for revision deletion.
-* New hook getOtherBlockLogLink, called in Special:IPBlockList to show links
-  to block logs of other blocking extensions, i.e. GlobalBlocking
+* New hook getOtherBlockLogLink, called in Special:IPBlockList and Special:Block
+  to show links to block logs of other blocking extensions, i.e. GlobalBlocking
 * Added search capabilities to SQLite backend
 * rebuildtextindex.php maintenance script now supports databases other than
   MySQL
index 81bdb64..ff76353 100644 (file)
@@ -105,6 +105,9 @@ class IPBlockForm {
                        $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
                        $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) );
                } elseif( $this->BlockAddress ) {
+                       # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
+                       wfRunHooks( 'getOtherBlockLogLink', array( &$otherBlockedMsgs, $this->BlockAddress ) );
+
                        $userId = is_object( $user ) ? $user->getId() : 0;
                        $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
                        if( !is_null( $currentBlock ) && !$currentBlock->mAuto && # The block exists and isn't an autoblock
@@ -112,7 +115,6 @@ class IPBlockForm {
                                # or if it is, the range is what we're about to block
                                ( $currentBlock->mAddress == $this->BlockAddress ) )
                        ) {
-                               $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
                                $alreadyBlocked = true;
                                # Set the block form settings to the existing block
                                if( !$this->wasPosted ) {
@@ -132,6 +134,23 @@ class IPBlockForm {
                        }
                }
 
+               # Show other blocks from extensions, i.e. GlockBlocking and TorBlock
+               if( count( $otherBlockedMsgs ) ) {
+                       $wgOut->addHTML(
+                               Html::rawElement( 'h2', array(), wfMsgExt( 'ipb-otherblocks-header', 'parseinline',  count( $otherBlockedMsgs ) ) ) . "\n"
+                       );
+                       $list = '';
+                       foreach( $otherBlockedMsgs as $link ) {
+                               $list .= Html::rawElement( 'li', array(), $link ) . "\n";
+                       }
+                       $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-blockip-alreadyblocked' ), $list ) . "\n" );
+               }
+
+               # Username/IP is blocked already locally
+               if( $alreadyBlocked ) {
+                       $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
+               }
+
                $scBlockExpiryOptions = wfMsgForContent( 'ipboptions' );
 
                $showblockoptions = $scBlockExpiryOptions != '-';
index cc7c54d..01241da 100644 (file)
@@ -2938,6 +2938,7 @@ See the [[Special:IPBlockList|IP block list]] for the list of currently operatio
 'ipb-needreblock'                 => '== Already blocked ==
 $1 is already blocked.
 Do you want to change the settings?',
+'ipb-otherblocks-header'          => 'Other {{PLURAL:$1|block|blocks}}',
 '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.
index 0e6173d..dabbe26 100644 (file)
@@ -1967,6 +1967,7 @@ $wgMessageStructure = array(
                'ipb_hide_invalid',
                'ipb_already_blocked',
                'ipb-needreblock',
+               'ipb-otherblocks-header',
                'ipb_cant_unblock',
                'ipb_blocked_as_range',
                'ip_range_invalid',