Handle multiple warnings correctly in ApiBase::setWarning(). Calling this function...
[lhc/web/wiklou.git] / includes / SpecialEmailuser.php
index 274325f..2395822 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /**
- *
- * @addtogroup SpecialPage
+ * @file
+ * @ingroup SpecialPage
  */
 
 /**
@@ -13,8 +13,13 @@ function wfSpecialEmailuser( $par ) {
        $target = isset($par) ? $par : $wgRequest->getVal( 'target' );  
        $error = EmailUserForm::getPermissionsError( $target );
        if ( $error ) {
-               $wgOut->showErrorPage( $error[0], $error[1] );
-               return;
+               if ( $error[0] === "blockedemailuser" ) {
+                       $wgOut->blockedPage();
+                       return;
+               } else {
+                       $wgOut->showErrorPage( $error[0], $error[1] );
+                       return;
+               }
        }
 
        $form = EmailUserForm::newFromURL( $target,
@@ -51,7 +56,7 @@ function wfSpecialEmailuser( $par ) {
 
 /**
  * Implements the Special:Emailuser web interface, and invokes userMailer for sending the email message.
- * @addtogroup SpecialPage
+ * @ingroup SpecialPage
  */
 class EmailUserForm {
 
@@ -220,6 +225,11 @@ class EmailUserForm {
                        wfDebug( "User can't send.\n" );
                        return array( "mailnologin", "mailnologintext" );
                }
+               
+               if( $wgUser->isBlockedFromEmailuser() ) {
+                       wfDebug( "User is blocked from sending e-mail.\n" );
+                       return array( "blockedemailuser", "" );
+               }
        
                if ( "" == $target ) {
                        wfDebug( "Target is empty.\n" );