(bug 18549) Make Special:Blockip (and api action=block) respect $wgEnableUserEmail...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 15 May 2009 17:08:38 +0000 (17:08 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 15 May 2009 17:08:38 +0000 (17:08 +0000)
RELEASE-NOTES
includes/api/ApiBlock.php
includes/specials/SpecialBlockip.php

index 88c4f75..2da583e 100644 (file)
@@ -120,6 +120,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 18716) Removed redundant class in Modern skin CSS for category links and
   tweaked spacing.
 * (bug 18656) Use proper directory separators in wfMkdirParents()
+* (bug 18549) Make Special:Blockip respect $wgEnableUserEmail and $wgSysopEmailBans
 
 == API changes in 1.16 ==
 
@@ -144,6 +145,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 18730) Add version information to action=paraminfo output
 * (bug 18743) Add ucprop=size to list=usercontribs
 * (bug 18749) Add generator flag to action=paraminfo output
+* Make action=block respect $wgEnableUserEmail and $wgSysopEmailBans 
 
 === Languages updated in 1.16 ===
 
index fc77f2a..acfd39e 100644 (file)
@@ -49,7 +49,7 @@ class ApiBlock extends ApiBase {
         * of success. If it fails, the result will specify the nature of the error.
         */
        public function execute() {
-               global $wgUser, $wgBlockAllowsUTEdit;
+               global $wgUser, $wgBlockAllowsUTEdit, $wgEnableUserEmail, $wgSysopEmailBans;
                $params = $this->extractRequestParams();
 
                if($params['gettoken'])
@@ -69,7 +69,7 @@ class ApiBlock extends ApiBase {
                        $this->dieUsageMsg(array('cantblock'));
                if($params['hidename'] && !$wgUser->isAllowed('hideuser'))
                        $this->dieUsageMsg(array('canthide'));
-               if($params['noemail'] && !$wgUser->isAllowed('blockemail'))
+               if($params['noemail'] && $wgEnableUserEmail && $wgSysopEmailBans && !$wgUser->isAllowed('blockemail'))
                        $this->dieUsageMsg(array('cantblock-email'));
 
                $form = new IPBlockForm('');
index 8608480..5c15fee 100644 (file)
@@ -46,7 +46,7 @@ class IPBlockForm {
        const HIDEUSER_CONTRIBLIMIT = 1000;
 
        public function __construct( $par ) {
-               global $wgRequest, $wgUser, $wgBlockAllowsUTEdit;
+               global $wgRequest, $wgUser, $wgBlockAllowsUTEdit, $wgSysopEmailBans, $wgEnableUserEmail;
 
                $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
                $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' );
@@ -61,7 +61,10 @@ class IPBlockForm {
                $this->BlockAnonOnly = $wgRequest->getBool( 'wpAnonOnly', $byDefault );
                $this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', $byDefault );
                $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', $byDefault );
-               $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false );
+               $this->BlockEmail = false;
+               if( $wgEnableUserEmail && $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
+                       $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;
@@ -230,8 +233,8 @@ class IPBlockForm {
                        </tr>"
                );
 
-               global $wgSysopEmailBans, $wgBlockAllowsUTEdit;
-               if( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
+               global $wgSysopEmailBans, $wgBlockAllowsUTEdit, $wgEnableUserEmail;
+               if( $wgEnableUserEmail && $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) {
                        $wgOut->addHTML("
                                <tr id='wpEnableEmailBan'>
                                        <td>&nbsp;</td>