From 2f49fc8f46b4d9d485b8f36d8c85ff11c5fab5c4 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 16 Dec 2008 08:51:56 +0000 Subject: [PATCH] * Add a 'change block' link to Special:IPBlockList und Special:Log --- RELEASE-NOTES | 1 + includes/LogEventsList.php | 20 ++++++++++++++------ includes/specials/SpecialIpblocklist.php | 23 ++++++++++++++++++----- languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 674f7c64ed..58f313faad 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -232,6 +232,7 @@ The following extensions are migrated into MediaWiki 1.14: * File objects returned by wfFindFile() are now cached by default * (bug 7492) Rights can now be assigned to specific IP addresses and ranges by using $wgAutopromote (new defines: APCOND_ISIP and APCOND_IPINRANGE) +* Add a 'change block' link to Special:IPBlockList und Special:Log === Bug fixes in 1.14 === diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 672dc33af0..71ee13a305 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -38,7 +38,7 @@ class LogEventsList { private function preCacheMessages() { // Precache various messages if( !isset( $this->message ) ) { - $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel hist'; + $messages = 'revertmerge protect_change unblocklink change-blocklink revertmove undeletelink revdel-restore rev-delundel hist'; foreach( explode( ' ', $messages ) as $msg ) { $this->message[$msg] = wfMsgExt( $msg, array( 'escape') ); } @@ -267,11 +267,19 @@ class LogEventsList { } else if( self::typeAction($row,array('delete','suppress'),'delete') && $wgUser->isAllowed( 'delete' ) ) { $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ), $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')'; - // Show unblock link - } else if( self::typeAction($row,array('block','suppress'),'block') && $wgUser->isAllowed( 'block' ) ) { - $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ), - $this->message['unblocklink'], - 'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')'; + // Show unblock/change block link + } else if( self::typeAction( $row, array( 'block', 'suppress' ), 'block' ) && $wgUser->isAllowed( 'block' ) ) { + $revert = '(' . + $this->skin->link( SpecialPage::getTitleFor( 'Ipblocklist' ), + $this->message['unblocklink'], + array(), + array( 'action' => 'unblock', 'ip' => urlencode( $row->log_title ) ), + 'known' ) + . ' ' . wfMsg( 'pipe-separator' ) . ' ' . + $this->skin->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $row->log_title ) ), + $this->message['change-blocklink'], + array(), array(), 'known' ) . + ')'; // Show change protection link } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) { $revert .= ' (' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'], diff --git a/includes/specials/SpecialIpblocklist.php b/includes/specials/SpecialIpblocklist.php index 5ddb8d0bbc..2f3c4bb002 100644 --- a/includes/specials/SpecialIpblocklist.php +++ b/includes/specials/SpecialIpblocklist.php @@ -374,7 +374,7 @@ class IPUnblockForm { $sk = $wgUser->getSkin(); if( is_null( $msg ) ) { $msg = array(); - $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink', + $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink', 'change-blocklink', 'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk' ); foreach( $keys as $key ) { $msg[$key] = wfMsgHtml( $key ); @@ -423,9 +423,22 @@ class IPUnblockForm { $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) ); $unblocklink = ''; - if ( $wgUser->isAllowed('block') ) { - $titleObj = SpecialPage::getTitleFor( "Ipblocklist" ); - $unblocklink = ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')'; + $changeblocklink = ''; + if ( $wgUser->isAllowed( 'block' ) ) { + $unblocklink = $sk->link( SpecialPage::getTitleFor( 'Ipblocklist' ), + $msg['unblocklink'], + array(), + array( 'action' => 'unblock', 'id' => urlencode( $block->mId ) ), + 'known' ); + + # Create changeblocklink for all blocks with exception of autoblocks + if( !$block->mAuto ) { + $changeblocklink = ' ' . wfMsg( 'pipe-separator' ) . ' ' . + $sk->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $block->mAddress ) ), + $msg['change-blocklink'], + array(), array(), 'known' ); + } + $toolLinks = "($unblocklink$changeblocklink)"; } $comment = $sk->commentBlock( $block->mReason ); @@ -435,7 +448,7 @@ class IPUnblockForm { $s = '' . $s . ''; wfProfileOut( __METHOD__ ); - return "
  • $s $unblocklink
  • \n"; + return "
  • $s $toolLinks
  • \n"; } } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index bfda7d19c7..7e815bdc25 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2616,6 +2616,7 @@ See [[Special:IPBlockList|IP block list]] to review blocks.', 'ipblocklist-no-results' => 'The requested IP address or username is not blocked.', 'blocklink' => 'block', 'unblocklink' => 'unblock', +'change-blocklink' => 'change block', 'contribslink' => 'contribs', 'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "$2"', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index a55041bcc4..79d4b40849 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1807,6 +1807,7 @@ $wgMessageStructure = array( 'ipblocklist-no-results', 'blocklink', 'unblocklink', + 'change-blocklink', 'contribslink', 'autoblocker', 'blocklogpage', -- 2.20.1