X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEmailuser.php;h=30eb38d04aea20057ec7630c680c9a76ebd34204;hb=e31c9986a17f036ec89e2ef3f04519026e42ebf3;hp=249be7f17fa9a658005262d5276d3f8116830005;hpb=04a8781b3ea494cd7944e104863b3eaa34a1e733;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 249be7f17f..30eb38d04a 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -280,7 +280,9 @@ class SpecialEmailUser extends UnlistedSpecialPage { return "blockedemailuser"; } - if ( $user->pingLimiter( 'emailuser' ) ) { + // Check the ping limiter without incrementing it - we'll check it + // again later and increment it on a successful send + if ( $user->pingLimiter( 'emailuser', 0 ) ) { wfDebug( "Ping limiter triggered.\n" ); return 'actionthrottledtext'; @@ -376,6 +378,11 @@ class SpecialEmailUser extends UnlistedSpecialPage { $text .= $context->msg( 'emailuserfooter', $from->name, $to->name )->inContentLanguage()->text(); + // Check and increment the rate limits + if ( $context->getUser()->pingLimiter( 'emailuser' ) ) { + throw new ThrottledError(); + } + $error = false; if ( !Hooks::run( 'EmailUser', [ &$to, &$from, &$subject, &$text, &$error ] ) ) { if ( $error instanceof Status ) {