Followup to r50744: Actually declare the method as public static, and use it in the API
authorChad Horohoe <demon@users.mediawiki.org>
Sat, 23 May 2009 00:05:40 +0000 (00:05 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sat, 23 May 2009 00:05:40 +0000 (00:05 +0000)
includes/api/ApiBlock.php
includes/specials/SpecialBlockip.php

index acfd39e..9220d54 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, $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('');
index 9d5dd29..58547a2 100644 (file)
@@ -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' ));
        }