* Show result of Special:Booksources in wiki content language always, it's
normally better maintained than the generic list from the standard message
files
+* (bug 7997) Added ability of sysops to block users from sending e-mail via
+ Special:Emailuser. This can be disabled by setting $wgSysopEmailBans to
+ false.
== Bugfixes since 1.10 ==
class Block
{
/* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry,
- $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName;
+ $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName,
+ $mBlockEmail;
/* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster, $mByName;
const EB_KEEP_EXPIRED = 1;
function __construct( $address = '', $user = 0, $by = 0, $reason = '',
$timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
- $hideName = 0 )
+ $hideName = 0, $blockEmail = 0 )
{
$this->mId = 0;
# Expand valid IPv6 addresses
$this->mExpiry = self::decodeExpiry( $expiry );
$this->mEnableAutoblock = $enableAutoblock;
$this->mHideName = $hideName;
-
+ $this->mBlockEmail = $blockEmail;
$this->mForUpdate = false;
$this->mFromMaster = false;
$this->mByName = false;
$this->mAddress = $this->mReason = $this->mTimestamp = '';
$this->mId = $this->mAnonOnly = $this->mCreateAccount =
$this->mEnableAutoblock = $this->mAuto = $this->mUser =
- $this->mBy = $this->mHideName = 0;
+ $this->mBy = $this->mHideName = $this->mBlockEmail = 0;
$this->mByName = false;
}
$this->mAnonOnly = $row->ipb_anon_only;
$this->mCreateAccount = $row->ipb_create_account;
$this->mEnableAutoblock = $row->ipb_enable_autoblock;
+ $this->mBlockEmail = $row->ipb_block_email;
$this->mHideName = $row->ipb_deleted;
$this->mId = $row->ipb_id;
$this->mExpiry = self::decodeExpiry( $row->ipb_expiry );
# Unset ipb_enable_autoblock for IP blocks, makes no sense
if ( !$this->mUser ) {
$this->mEnableAutoblock = 0;
+ $this->mBlockEmail = 0; //Same goes for email...
}
# Don't collide with expired blocks
'ipb_expiry' => self::encodeExpiry( $this->mExpiry, $dbw ),
'ipb_range_start' => $this->mRangeStart,
'ipb_range_end' => $this->mRangeEnd,
- 'ipb_deleted' => $this->mHideName
+ 'ipb_deleted' => $this->mHideName,
+ 'ipb_block_email' => $this->mBlockEmail
), 'Block::insert', array( 'IGNORE' )
);
$affected = $dbw->affectedRows();
# Basic user rights and block settings
$wgSysopUserBans = true; # Allow sysops to ban logged-in users
-$wgSysopRangeBans = true; # Allow sysops to ban IP ranges
-$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
+$wgSysopRangeBans = true; # Allow sysops to ban IP ranges
+$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
$wgBlockAllowsUTEdit = false; # Blocks allow users to edit their own user talk page
+$wgSysopEmailBans = true; # Allow sysops to ban users from accessing Emailuser
# Pages anonymous user may see as an array, e.g.:
# array ( "Main Page", "Special:Userlogin", "Wikipedia:Help");
*/
class IPBlockForm {
var $BlockAddress, $BlockExpiry, $BlockReason;
+# var $BlockEmail;
function IPBlockForm( $par ) {
global $wgRequest, $wgUser;
$this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault );
$this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault );
$this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault );
+ $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', 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>
");
}
+
+ global $wgSysopEmailBans;
+
+ if ( $wgSysopEmailBans ) {
+ $wgOut->addHTML("
+ <tr>
+ <td> </td>
+ <td>
+ " . wfCheckLabel( wfMsgHtml( 'ipbemailban' ),
+ 'wpEmailBan', 'wpEmailBan', $this->BlockEmail,
+ array( 'tabindex' => '10' )) . "
+ </td>
+ </tr>
+ ");
+ }
$wgOut->addHTML("
<tr>
<td style='padding-top: 1em'> </td>
<td style='padding-top: 1em'>
" . Xml::submitButton( wfMsg( 'ipbsubmit' ),
- array( 'name' => 'wpBlock', 'tabindex' => '10' ) ) . "
+ array( 'name' => 'wpBlock', 'tabindex' => '11' ) ) . "
</td>
</tr>
</table>" .
# Create block
# Note: for a user block, ipb_address is only for display purposes
-
$block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
$reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
- $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName);
+ $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName,
+ $this->BlockEmail);
if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
$flags[] = 'nocreate';
if( !$this->BlockEnableAutoblock )
$flags[] = 'noautoblock';
+ if ( $this->BlockEmail )
+ $flags[] = 'noemail';
return implode( ',', $flags );
}
return;
}
+ if ( $wgUser->isBlockedFromEmailUser() ) {
+ // User has been blocked from sending e-mail. Show the std blocked form.
+ wfDebug( "User is blocked from sending e-mail.\n" );
+ $wgOut->blockedPage();
+ return;
+ }
+
$f = new EmailUserForm( $nu );
if ( "success" == $action ) {
if( is_null( $msg ) ) {
$msg = array();
$keys = array( 'infiniteblock', 'expiringblock', 'contribslink', 'unblocklink',
- 'anononlyblock', 'createaccountblock', 'noautoblockblock' );
+ 'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock' );
foreach( $keys as $key ) {
$msg[$key] = wfMsgHtml( $key );
}
$properties[] = $msg['noautoblockblock'];
}
+ if ( $block->mBlockEmail && $block->mUser ) {
+ $properties[] = $msg['emailblock'];
+ }
+
$properties = implode( ', ', $properties );
$line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) );
return $this->mBlock && $this->mBlock->mCreateAccount;
}
+ /**
+ * Determine if the user is blocked from using Special:Emailuser.
+ *
+ * @public
+ * @return boolean
+ */
+ function isBlockedFromEmailuser() {
+ $this->getBlockedStatus();
+ return $this->mBlock && $this->mBlock->mBlockEmail;
+ }
+
function isAllowedToCreateAccount() {
return $this->isAllowed( 'createaccount' ) && !$this->isBlockedFromCreateAccount();
}
You can contact $1 or another [[{{MediaWiki:grouppage-sysop}}|administrator]] to discuss the block.
You cannot use the 'email this user' feature unless a valid email address is specified in your
-[[Special:Preferences|account preferences]]. Your current IP address is $3, and the block ID is #$5. Please include either or both of these in any queries.",
+[[Special:Preferences|account preferences]] and you have not been blocked from using it.
+Your current IP address is $3, and the block ID is #$5. Please include either or both of these in any queries.",
'autoblockedtext' => 'Your IP address has been automatically blocked because it was used by another user, who was blocked by $1.
The reason given is this:
You may contact $1 or one of the other
[[{{MediaWiki:grouppage-sysop}}|administrators]] to discuss the block.
-Note that you may not use the "e-mail this user" feature unless you have a valid e-mail address registered in your [[Special:Preferences|user preferences]].
+Note that you may not use the "e-mail this user" feature unless you have a valid e-mail address
+registered in your [[Special:Preferences|user preferences]] and you have not been blocked from using it.
Your block ID is $5. Please include this ID in any queries you make.',
'blockedoriginalsource' => "The source of '''$1''' is shown below:",
** Unacceptable username',
'ipbanononly' => 'Block anonymous users only',
'ipbcreateaccount' => 'Prevent account creation',
+'ipbemailban' => 'Prevent user from sending e-mail',
'ipbenableautoblock' => 'Automatically block the last IP address used by this user, and any subsequent IPs they try to edit from',
'ipbsubmit' => 'Block this user',
'ipbother' => 'Other time:',
'anononlyblock' => 'anon. only',
'noautoblockblock' => 'autoblock disabled',
'createaccountblock' => 'account creation blocked',
+'emailblock' => 'e-mail blocked',
'ipblocklist-empty' => 'The blocklist is empty.',
'ipblocklist-no-results' => 'The requested IP address or username is not blocked.',
'blocklink' => 'block',
'block-log-flags-anononly' => 'anonymous users only',
'block-log-flags-nocreate' => 'account creation disabled',
'block-log-flags-noautoblock' => 'autoblock disabled',
+'block-log-flags-noemail' => 'e-mail blocked',
'range_block_disabled' => 'The sysop ability to create range blocks is disabled.',
'ipb_expiry_invalid' => 'Expiry time invalid.',
'ipb_already_blocked' => '"$1" is already blocked',
--- /dev/null
+-- Add row for email blocks --
+
+ALTER TABLE /*$wgDBprefix*/ipblocks
+ ADD ipb_block_email tinyint(1) NOT NULL default '0';
-- Flag for entries hidden from users and Sysops
ipb_deleted bool NOT NULL default 0,
+
+ -- Block prevents user from accessing Special:Emailuser
+ ipb_block_email bool NOT NULL default 0,
PRIMARY KEY ipb_id (ipb_id),
array( 'archive', 'ar_len', 'patch-ar_len.sql' ),
array( 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ),
array( 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ),
+ array( 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ),
);
function rename_table( $from, $to, $patch ) {