Index: trunk/phase3/maintenance/archives/patch-ipb_emailban.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add row for email blocks -- |
| 3 | + |
| 4 | +ALTER TABLE /*$wgDBprefix*/ipblocks |
| 5 | + ADD ipb_block_email tinyint(1) NOT NULL default '0'; |
Property changes on: trunk/phase3/maintenance/archives/patch-ipb_emailban.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -76,6 +76,7 @@ |
77 | 77 | array( 'archive', 'ar_len', 'patch-ar_len.sql' ), |
78 | 78 | array( 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ), |
79 | 79 | array( 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ), |
| 80 | + array( 'ipblocks', 'ipb_block_email', 'patch-ipb_emailban.sql' ), |
80 | 81 | ); |
81 | 82 | |
82 | 83 | function rename_table( $from, $to, $patch ) { |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -622,6 +622,9 @@ |
623 | 623 | |
624 | 624 | -- Flag for entries hidden from users and Sysops |
625 | 625 | ipb_deleted bool NOT NULL default 0, |
| 626 | + |
| 627 | + -- Block prevents user from accessing Special:Emailuser |
| 628 | + ipb_block_email bool NOT NULL default 0, |
626 | 629 | |
627 | 630 | PRIMARY KEY ipb_id (ipb_id), |
628 | 631 | |
Index: trunk/phase3/includes/User.php |
— | — | @@ -2149,6 +2149,17 @@ |
2150 | 2150 | return $this->mBlock && $this->mBlock->mCreateAccount; |
2151 | 2151 | } |
2152 | 2152 | |
| 2153 | + /** |
| 2154 | + * Determine if the user is blocked from using Special:Emailuser. |
| 2155 | + * |
| 2156 | + * @public |
| 2157 | + * @return boolean |
| 2158 | + */ |
| 2159 | + function isBlockedFromEmailuser() { |
| 2160 | + $this->getBlockedStatus(); |
| 2161 | + return $this->mBlock && $this->mBlock->mBlockEmail; |
| 2162 | + } |
| 2163 | + |
2153 | 2164 | function isAllowedToCreateAccount() { |
2154 | 2165 | return $this->isAllowed( 'createaccount' ) && !$this->isBlockedFromCreateAccount(); |
2155 | 2166 | } |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | */ |
45 | 45 | class IPBlockForm { |
46 | 46 | var $BlockAddress, $BlockExpiry, $BlockReason; |
| 47 | +# var $BlockEmail; |
47 | 48 | |
48 | 49 | function IPBlockForm( $par ) { |
49 | 50 | global $wgRequest, $wgUser; |
— | — | @@ -60,6 +61,7 @@ |
61 | 62 | $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault ); |
62 | 63 | $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault ); |
63 | 64 | $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault ); |
| 65 | + $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false ); |
64 | 66 | # Re-check user's rights to hide names, very serious, defaults to 0 |
65 | 67 | $this->BlockHideName = ( $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0; |
66 | 68 | } |
— | — | @@ -238,12 +240,27 @@ |
239 | 241 | </tr> |
240 | 242 | "); |
241 | 243 | } |
| 244 | + |
| 245 | + global $wgSysopEmailBans; |
| 246 | + |
| 247 | + if ( $wgSysopEmailBans ) { |
| 248 | + $wgOut->addHTML(" |
| 249 | + <tr> |
| 250 | + <td> </td> |
| 251 | + <td> |
| 252 | + " . wfCheckLabel( wfMsgHtml( 'ipbemailban' ), |
| 253 | + 'wpEmailBan', 'wpEmailBan', $this->BlockEmail, |
| 254 | + array( 'tabindex' => '10' )) . " |
| 255 | + </td> |
| 256 | + </tr> |
| 257 | + "); |
| 258 | + } |
242 | 259 | $wgOut->addHTML(" |
243 | 260 | <tr> |
244 | 261 | <td style='padding-top: 1em'> </td> |
245 | 262 | <td style='padding-top: 1em'> |
246 | 263 | " . Xml::submitButton( wfMsg( 'ipbsubmit' ), |
247 | | - array( 'name' => 'wpBlock', 'tabindex' => '10' ) ) . " |
| 264 | + array( 'name' => 'wpBlock', 'tabindex' => '11' ) ) . " |
248 | 265 | </td> |
249 | 266 | </tr> |
250 | 267 | </table>" . |
— | — | @@ -356,10 +373,10 @@ |
357 | 374 | |
358 | 375 | # Create block |
359 | 376 | # Note: for a user block, ipb_address is only for display purposes |
360 | | - |
361 | 377 | $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(), |
362 | 378 | $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, |
363 | | - $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName); |
| 379 | + $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName, |
| 380 | + $this->BlockEmail); |
364 | 381 | |
365 | 382 | if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) { |
366 | 383 | |
— | — | @@ -420,6 +437,8 @@ |
421 | 438 | $flags[] = 'nocreate'; |
422 | 439 | if( !$this->BlockEnableAutoblock ) |
423 | 440 | $flags[] = 'noautoblock'; |
| 441 | + if ( $this->BlockEmail ) |
| 442 | + $flags[] = 'noemail'; |
424 | 443 | return implode( ',', $flags ); |
425 | 444 | } |
426 | 445 | |
Index: trunk/phase3/includes/SpecialEmailuser.php |
— | — | @@ -45,6 +45,13 @@ |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
| 49 | + if ( $wgUser->isBlockedFromEmailUser() ) { |
| 50 | + // User has been blocked from sending e-mail. Show the std blocked form. |
| 51 | + wfDebug( "User is blocked from sending e-mail.\n" ); |
| 52 | + $wgOut->blockedPage(); |
| 53 | + return; |
| 54 | + } |
| 55 | + |
49 | 56 | $f = new EmailUserForm( $nu ); |
50 | 57 | |
51 | 58 | if ( "success" == $action ) { |
Index: trunk/phase3/includes/SpecialIpblocklist.php |
— | — | @@ -265,7 +265,7 @@ |
266 | 266 | if( is_null( $msg ) ) { |
267 | 267 | $msg = array(); |
268 | 268 | $keys = array( 'infiniteblock', 'expiringblock', 'contribslink', 'unblocklink', |
269 | | - 'anononlyblock', 'createaccountblock', 'noautoblockblock' ); |
| 269 | + 'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock' ); |
270 | 270 | foreach( $keys as $key ) { |
271 | 271 | $msg[$key] = wfMsgHtml( $key ); |
272 | 272 | } |
— | — | @@ -306,6 +306,10 @@ |
307 | 307 | $properties[] = $msg['noautoblockblock']; |
308 | 308 | } |
309 | 309 | |
| 310 | + if ( $block->mBlockEmail && $block->mUser ) { |
| 311 | + $properties[] = $msg['emailblock']; |
| 312 | + } |
| 313 | + |
310 | 314 | $properties = implode( ', ', $properties ); |
311 | 315 | |
312 | 316 | $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) ); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -971,9 +971,10 @@ |
972 | 972 | |
973 | 973 | # Basic user rights and block settings |
974 | 974 | $wgSysopUserBans = true; # Allow sysops to ban logged-in users |
975 | | -$wgSysopRangeBans = true; # Allow sysops to ban IP ranges |
976 | | -$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire |
| 975 | +$wgSysopRangeBans = true; # Allow sysops to ban IP ranges |
| 976 | +$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire |
977 | 977 | $wgBlockAllowsUTEdit = false; # Blocks allow users to edit their own user talk page |
| 978 | +$wgSysopEmailBans = true; # Allow sysops to ban users from accessing Emailuser |
978 | 979 | |
979 | 980 | # Pages anonymous user may see as an array, e.g.: |
980 | 981 | # array ( "Main Page", "Special:Userlogin", "Wikipedia:Help"); |
Index: trunk/phase3/includes/Block.php |
— | — | @@ -15,7 +15,8 @@ |
16 | 16 | class Block |
17 | 17 | { |
18 | 18 | /* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry, |
19 | | - $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName; |
| 19 | + $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock, $mHideName, |
| 20 | + $mBlockEmail; |
20 | 21 | /* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster, $mByName; |
21 | 22 | |
22 | 23 | const EB_KEEP_EXPIRED = 1; |
— | — | @@ -24,7 +25,7 @@ |
25 | 26 | |
26 | 27 | function __construct( $address = '', $user = 0, $by = 0, $reason = '', |
27 | 28 | $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, |
28 | | - $hideName = 0 ) |
| 29 | + $hideName = 0, $blockEmail = 0 ) |
29 | 30 | { |
30 | 31 | $this->mId = 0; |
31 | 32 | # Expand valid IPv6 addresses |
— | — | @@ -40,7 +41,7 @@ |
41 | 42 | $this->mExpiry = self::decodeExpiry( $expiry ); |
42 | 43 | $this->mEnableAutoblock = $enableAutoblock; |
43 | 44 | $this->mHideName = $hideName; |
44 | | - |
| 45 | + $this->mBlockEmail = $blockEmail; |
45 | 46 | $this->mForUpdate = false; |
46 | 47 | $this->mFromMaster = false; |
47 | 48 | $this->mByName = false; |
— | — | @@ -76,7 +77,7 @@ |
77 | 78 | $this->mAddress = $this->mReason = $this->mTimestamp = ''; |
78 | 79 | $this->mId = $this->mAnonOnly = $this->mCreateAccount = |
79 | 80 | $this->mEnableAutoblock = $this->mAuto = $this->mUser = |
80 | | - $this->mBy = $this->mHideName = 0; |
| 81 | + $this->mBy = $this->mHideName = $this->mBlockEmail = 0; |
81 | 82 | $this->mByName = false; |
82 | 83 | } |
83 | 84 | |
— | — | @@ -262,6 +263,7 @@ |
263 | 264 | $this->mAnonOnly = $row->ipb_anon_only; |
264 | 265 | $this->mCreateAccount = $row->ipb_create_account; |
265 | 266 | $this->mEnableAutoblock = $row->ipb_enable_autoblock; |
| 267 | + $this->mBlockEmail = $row->ipb_block_email; |
266 | 268 | $this->mHideName = $row->ipb_deleted; |
267 | 269 | $this->mId = $row->ipb_id; |
268 | 270 | $this->mExpiry = self::decodeExpiry( $row->ipb_expiry ); |
— | — | @@ -371,6 +373,7 @@ |
372 | 374 | # Unset ipb_enable_autoblock for IP blocks, makes no sense |
373 | 375 | if ( !$this->mUser ) { |
374 | 376 | $this->mEnableAutoblock = 0; |
| 377 | + $this->mBlockEmail = 0; //Same goes for email... |
375 | 378 | } |
376 | 379 | |
377 | 380 | # Don't collide with expired blocks |
— | — | @@ -392,7 +395,8 @@ |
393 | 396 | 'ipb_expiry' => self::encodeExpiry( $this->mExpiry, $dbw ), |
394 | 397 | 'ipb_range_start' => $this->mRangeStart, |
395 | 398 | 'ipb_range_end' => $this->mRangeEnd, |
396 | | - 'ipb_deleted' => $this->mHideName |
| 399 | + 'ipb_deleted' => $this->mHideName, |
| 400 | + 'ipb_block_email' => $this->mBlockEmail |
397 | 401 | ), 'Block::insert', array( 'IGNORE' ) |
398 | 402 | ); |
399 | 403 | $affected = $dbw->affectedRows(); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -939,7 +939,8 @@ |
940 | 940 | |
941 | 941 | You can contact $1 or another [[{{MediaWiki:grouppage-sysop}}|administrator]] to discuss the block. |
942 | 942 | You cannot use the 'email this user' feature unless a valid email address is specified in your |
943 | | -[[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.", |
| 943 | +[[Special:Preferences|account preferences]] and you have not been blocked from using it. |
| 944 | +Your current IP address is $3, and the block ID is #$5. Please include either or both of these in any queries.", |
944 | 945 | 'autoblockedtext' => 'Your IP address has been automatically blocked because it was used by another user, who was blocked by $1. |
945 | 946 | The reason given is this: |
946 | 947 | |
— | — | @@ -950,7 +951,8 @@ |
951 | 952 | You may contact $1 or one of the other |
952 | 953 | [[{{MediaWiki:grouppage-sysop}}|administrators]] to discuss the block. |
953 | 954 | |
954 | | -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]]. |
| 955 | +Note that you may not use the "e-mail this user" feature unless you have a valid e-mail address |
| 956 | +registered in your [[Special:Preferences|user preferences]] and you have not been blocked from using it. |
955 | 957 | |
956 | 958 | Your block ID is $5. Please include this ID in any queries you make.', |
957 | 959 | 'blockedoriginalsource' => "The source of '''$1''' is shown below:", |
— | — | @@ -1967,6 +1969,7 @@ |
1968 | 1970 | ** Unacceptable username', |
1969 | 1971 | 'ipbanononly' => 'Block anonymous users only', |
1970 | 1972 | 'ipbcreateaccount' => 'Prevent account creation', |
| 1973 | +'ipbemailban' => 'Prevent user from sending e-mail', |
1971 | 1974 | 'ipbenableautoblock' => 'Automatically block the last IP address used by this user, and any subsequent IPs they try to edit from', |
1972 | 1975 | 'ipbsubmit' => 'Block this user', |
1973 | 1976 | 'ipbother' => 'Other time:', |
— | — | @@ -1998,6 +2001,7 @@ |
1999 | 2002 | 'anononlyblock' => 'anon. only', |
2000 | 2003 | 'noautoblockblock' => 'autoblock disabled', |
2001 | 2004 | 'createaccountblock' => 'account creation blocked', |
| 2005 | +'emailblock' => 'e-mail blocked', |
2002 | 2006 | 'ipblocklist-empty' => 'The blocklist is empty.', |
2003 | 2007 | 'ipblocklist-no-results' => 'The requested IP address or username is not blocked.', |
2004 | 2008 | 'blocklink' => 'block', |
— | — | @@ -2013,6 +2017,7 @@ |
2014 | 2018 | 'block-log-flags-anononly' => 'anonymous users only', |
2015 | 2019 | 'block-log-flags-nocreate' => 'account creation disabled', |
2016 | 2020 | 'block-log-flags-noautoblock' => 'autoblock disabled', |
| 2021 | +'block-log-flags-noemail' => 'e-mail blocked', |
2017 | 2022 | 'range_block_disabled' => 'The sysop ability to create range blocks is disabled.', |
2018 | 2023 | 'ipb_expiry_invalid' => 'Expiry time invalid.', |
2019 | 2024 | 'ipb_already_blocked' => '"$1" is already blocked', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -64,6 +64,9 @@ |
65 | 65 | * Show result of Special:Booksources in wiki content language always, it's |
66 | 66 | normally better maintained than the generic list from the standard message |
67 | 67 | files |
| 68 | +* (bug 7997) Added ability of sysops to block users from sending e-mail via |
| 69 | + Special:Emailuser. This can be disabled by setting $wgSysopEmailBans to |
| 70 | + false. |
68 | 71 | |
69 | 72 | == Bugfixes since 1.10 == |
70 | 73 | |