From 354fbf19af5f1cea7956d67ca8fcee56b4a8b667 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Sat, 23 May 2009 00:05:40 +0000 Subject: [PATCH] Followup to r50744: Actually declare the method as public static, and use it in the API --- includes/api/ApiBlock.php | 4 ++-- includes/specials/SpecialBlockip.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index acfd39e2cf..9220d54731 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, $wgEnableUserEmail, $wgSysopEmailBans; + global $wgUser, $wgBlockAllowsUTEdit; $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'] && $wgEnableUserEmail && $wgSysopEmailBans && !$wgUser->isAllowed('blockemail')) + if($params['noemail'] && !IPBlockForm::canBlockEmail($wgUser) ) $this->dieUsageMsg(array('cantblock-email')); $form = new IPBlockForm(''); diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index 9d5dd296b4..58547a23ac 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -319,7 +319,7 @@ class IPBlockForm { * @param User $user The sysop wanting to make a block * @return boolean */ - protected function canBlockEmail( $user ) { + public static function canBlockEmail( $user ) { global $wgEnableUserEmail, $wgSysopEmailBans; return ($wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' )); } -- 2.20.1