From 024e20a117dd03ad6081d71de7014e48ba5bd525 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 15 May 2009 17:08:38 +0000 Subject: [PATCH] (bug 18549) Make Special:Blockip (and api action=block) respect $wgEnableUserEmail and $wgSysopEmailBans --- RELEASE-NOTES | 2 ++ includes/api/ApiBlock.php | 4 ++-- includes/specials/SpecialBlockip.php | 11 +++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 88c4f7570f..2da583e3a2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index fc77f2a057..acfd39e2cf 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -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(''); diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index 860848099a..5c15fee2ed 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -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 { " ); - global $wgSysopEmailBans, $wgBlockAllowsUTEdit; - if( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) { + global $wgSysopEmailBans, $wgBlockAllowsUTEdit, $wgEnableUserEmail; + if( $wgEnableUserEmail && $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) { $wgOut->addHTML("   -- 2.20.1