*/
function wfSpecialIpblocklist() {
global $wgUser, $wgOut, $wgRequest;
-
+
$ip = $wgRequest->getVal( 'wpUnblockAddress', $wgRequest->getVal( 'ip' ) );
$reason = $wgRequest->getText( 'wpUnblockReason' );
$action = $wgRequest->getText( 'action' );
-
+
$ipu = new IPUnblockForm( $ip, $reason );
if ( "success" == $action ) {
*/
class IPUnblockForm {
var $ip, $reason;
-
+
function IPUnblockForm( $ip, $reason ) {
$this->ip = $ip;
$this->reason = $reason;
}
-
+
function showForm( $err ) {
global $wgOut, $wgUser, $wgSysopUserBans;
$wgOut->addWikitext( "<span class='error'>{$err}</span>\n" );
}
$token = htmlspecialchars( $wgUser->editToken() );
-
+
$wgOut->addHTML( "
<form id=\"unblockip\" method=\"post\" action=\"{$action}\">
<table border='0'>
</form>\n" );
}
-
+
function doSubmit() {
global $wgOut, $wgUser;
function showList( $msg ) {
global $wgOut;
-
+
$wgOut->setPagetitle( wfMsg( "ipblocklist" ) );
if ( "" != $msg ) {
$wgOut->setSubtitle( $msg );
global $wgRequest;
list( $this->limit, $this->offset ) = $wgRequest->getLimitOffset();
$this->counter = 0;
-
+
$paging = '<p>' . wfViewPrevNext( $this->offset, $this->limit,
Title::makeTitle( NS_SPECIAL, 'Ipblocklist' ),
'ip=' . urlencode( $this->ip ) ) . "</p>\n";
$wgOut->addHTML( $paging );
-
+
$search = $this->searchForm();
$wgOut->addHTML( $search );
-
+
$wgOut->addHTML( "<ul>" );
if( !Block::enumBlocks( array( &$this, "addRow" ), 0 ) ) {
// FIXME hack to solve #bug 1487
$wgOut->addHTML( "</ul>\n" );
$wgOut->addHTML( $paging );
}
-
+
function searchForm() {
global $wgTitle;
return
*/
function addRow( $block, $tag ) {
global $wgOut, $wgUser, $wgLang;
-
+
if( $this->ip != '' ) {
if( $block->mAuto ) {
if( stristr( $block->mId, $this->ip ) == false ) {
}
}
}
-
+
// Loading blocks is fast; displaying them is slow.
// Quick hack for paging.
$this->counter++;
if( $this->counter - $this->offset > $this->limit ) {
return;
}
-
+
$fname = 'IPUnblockForm-addRow';
wfProfileIn( $fname );
-
+
static $sk=null, $msg=null;
-
+
if( is_null( $sk ) )
$sk = $wgUser->getSkin();
if( is_null( $msg ) ) {
$msg[$key] = wfMsgHtml( $key );
}
$msg['blocklistline'] = wfMsg( 'blocklistline' );
+ $msg['contribslink'] = wfMsg( 'contribslink' );
}
-
- # Hide addresses blocked by User::spreadBlocks, for privacy
- $addr = $block->mAuto ? "#{$block->mId}" : $block->mAddress;
-
- $name = $block->getByName();
- $ulink = $sk->makeKnownLinkObj( Title::makeTitle( NS_USER, $name ), $name );
- $formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
+
+
+ # Prepare links to the blocker's user and talk pages
+ $blocker_name = $block->getByName();
+ $blocker = $sk->MakeKnownLinkObj( Title::makeTitle( NS_USER, $blocker_name ), $blocker_name );
+ $blocker .= ' (' . $sk->makeKnownLinkObj( Title::makeTitle( NS_USER_TALK, $blocker_name ), $wgLang->getNsText( NS_TALK ) ) . ')';
+
+ # Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
+ if( $block->mAuto ) {
+ $target = '#' . $block->mID; # Hide the IP addresses of auto-blocks; privacy
+ } else {
+ $target = $sk->makeKnownLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
+ $target .= ' (' . $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Contributions' ), $msg['contribslink'], 'target=' . $block->mAddress ) . ')';
+ }
+
+ # Prep the address for the unblock link, masking autoblocks as before
+ $addr = $block->mAuto ? '#' . $block->mID : $block->mAddress;
+ $formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
+
if ( $block->mExpiry === "" ) {
$formattedExpiry = $msg['infiniteblock'];
} else {
$formattedExpiry = wfMsgReplaceArgs( $msg['expiringblock'],
array( $wgLang->timeanddate( $block->mExpiry, true ) ) );
}
-
- $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $ulink, $addr, $formattedExpiry ) );
-
+
+ $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $formattedExpiry ) );
+
$wgOut->addHTML( "<li>{$line}" );
-
- if ( !$block->mAuto ) {
- $titleObj = Title::makeTitle( NS_SPECIAL, "Contributions" );
- $wgOut->addHTML( ' (' . $sk->makeKnownLinkObj($titleObj, $msg['contribslink'], "target={$block->mAddress}") . ')' );
- }
-
+
if ( $wgUser->isAllowed('block') ) {
$titleObj = Title::makeTitle( NS_SPECIAL, "Ipblocklist" );
$wgOut->addHTML( ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&ip=' . urlencode( $addr ) ) . ')' );