/**
* Constructor for Special:Blockip page
*
- * @addtogroup SpecialPage
+ * @file
+ * @ingroup SpecialPage
*/
/**
/**
* Form object for the Special:Blockip page.
*
- * @addtogroup SpecialPage
+ * @ingroup SpecialPage
*/
class IPBlockForm {
var $BlockAddress, $BlockExpiry, $BlockReason;
$this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault );
$this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault );
$this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false );
+ $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false );
# Re-check user's rights to hide names, very serious, defaults to 0
$this->BlockHideName = ( $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0;
}
</tr>"
);
}
+
+ # Watchlist their user page?
+ $wgOut->addHTML("
+ <tr id='wpEnableWatchUser'>
+ <td> </td>
+ <td class='mw-input'>" .
+ Xml::checkLabel( wfMsg( 'ipbwatchuser' ),
+ 'wpWatchUser', 'wpWatchUser', $this->BlockWatchUser,
+ array( 'tabindex' => '11' ) ) . "
+ </td>
+ </tr>"
+ );
$wgOut->addHTML("
<tr>
<td style='padding-top: 1em'> </td>
<td class='mw-submit' style='padding-top: 1em'>" .
Xml::submitButton( wfMsg( 'ipbsubmit' ),
- array( 'name' => 'wpBlock', 'tabindex' => '11' ) ) . "
+ array( 'name' => 'wpBlock', 'tabindex' => '12' ) ) . "
</td>
</tr>" .
Xml::closeElement( 'table' ) .
$this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
$this->BlockEmail);
- if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
- if ( !$block->insert( $dbw ) ) {
- $dbw->rollback(); // this could be commit as well; zero rows either way
+ if ( $this->BlockWatchUser ) {
+ $wgUser->addWatch ( Title::makeTitle( NS_USER, $this->BlockAddress ) );
+ }
+
+ if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
+
+ if ( !$block->insert() ) {
return array('ipb_already_blocked', htmlspecialchars($this->BlockAddress));
}
+ wfRunHooks('BlockIpComplete', array($block, $wgUser));
+
# Prepare log parameters
$logParams = array();
$logParams[] = $expirestr;
# 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 );
- $ok = $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
- $reasonstr, $logParams, $dbw );
- # Make sure logging got through
- if( !$ok ) {
- $dbw->rollback();
- return array('databaseerror');
- }
- $dbw->commit();
- wfRunHooks('BlockIpComplete', array($block, $wgUser));
+ $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
+ $reasonstr, $logParams );
+
# Report to the user
return array();
- } else {
- return array('hookaborted');
}
+ else
+ return array('hookaborted');
}
/**