# Re-check user's rights to hide names, very serious, defaults to 0
$this->BlockHideName = ( $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0;
$this->BlockAllowUsertalk = ( $wgRequest->getBool( 'wpAllowUsertalk', $byDefault ) && $wgBlockAllowsUTEdit );
+ $this->BlockReblock = $wgRequest->getBool( 'wpChangeBlock', false );
}
function showForm( $err ) {
$mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' );
$titleObj = SpecialPage::getTitleFor( 'Blockip' );
-
- if ( "" != $err ) {
+
+ $alreadyBlocked = false;
+ if ( $err && $err[0] != 'ipb_already_blocked' ) {
+ $key = array_shift($err);
+ $msg = wfMsgReal($key, $err);
$wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
- $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) );
+ $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) );
+ } elseif ( $this->BlockAddress ) {
+ $currentBlock = Block::newFromDB( $this->BlockAddress );
+ if ( !is_null($currentBlock) && !$currentBlock->mAuto && !($currentBlock->mRangeStart && $currentBlock->mAddress != $this->BlockAddress) ) {
+ $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
+ $alreadyBlocked = true;
+ }
}
$scBlockExpiryOptions = wfMsgForContent( 'ipboptions' );
</tr>"
);
}
+ if ( $alreadyBlocked ) {
+ $wgOut->addHTML("
+ <tr id='wpChangeBlockRow'>
+ <td> </td>
+ <td class='mw-input'>" .
+ Xml::checkLabel( wfMsg( 'ipb-change-block' ),
+ 'wpChangeBlock', 'wpChangeBlock', $this->BlockReblock,
+ array( 'tabindex' => '13' ) ) . "
+ </td>
+ </tr>"
+ );
+ }
$wgOut->addHTML("
<tr>
if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
if ( !$block->insert() ) {
- return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
+ if ( !$this->BlockReblock ) {
+ return array( 'ipb_already_blocked' );
+ } else {
+ # This returns direct blocks before autoblocks/rangeblocks, since we should be sure the user is blocked by now it should work for our purposes
+ $currentBlock = Block::newFromDB( $this->BlockAddress );
+ $currentBlock->delete();
+ $block->insert();
+ $log_action = 'reblock';
+ }
+ } else {
+ $log_action = 'block';
}
-
wfRunHooks('BlockIpComplete', array($block, $wgUser));
if ( $this->BlockWatchUser ) {
# Make log entry, if the name is hidden, put it in the oversight log
$log_type = ($this->BlockHideName) ? 'suppress' : 'block';
$log = new LogPage( $log_type );
- $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
+ $log->addEntry( $log_action, Title::makeTitle( NS_USER, $this->BlockAddress ),
$reasonstr, $logParams );
# Report to the user
urlencode( $this->BlockAddress ) ) );
return;
}
- $key = array_shift($retval);
- $this->showForm(wfMsgReal($key, $retval));
+ $this->showForm( $retval );
}
function showSuccess() {
'ipbhidename' => 'Hide username from the block log, active block list and user list',
'ipbwatchuser' => "Watch this user's user and talk pages",
'ipballowusertalk' => 'Allow this user to edit own talk page while blocked',
+'ipb-change-block' => 'Re-block the user with these settings',
'badipaddress' => 'Invalid IP address',
'blockipsuccesssub' => 'Block succeeded',
'blockipsuccesstext' => '[[Special:Contributions/$1|$1]] has been blocked.<br />
'blocklogpage' => 'Block log',
'blocklog-fulllog' => 'Full block log',
'blocklogentry' => 'blocked [[$1]] with an expiry time of $2 $3',
+'reblock-logentry' => 'changed block settings for [[$1]] with an expiry time of $2 $3',
'blocklogtext' => 'This is a log of user blocking and unblocking actions.
Automatically blocked IP addresses are not listed.
See the [[Special:IPBlockList|IP block list]] for the list of currently operational bans and blocks.',
'ipb_expiry_invalid' => 'Expiry time invalid.',
'ipb_expiry_temp' => 'Hidden username blocks must be permanent.',
'ipb_already_blocked' => '"$1" is already blocked',
+'ipb-needreblock' => '== Already blocked ==
+$1 is already blocked. Do you want to change the 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.