From 372ee7b344c9f12a6207306ddcd82f1015a143d6 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Thu, 28 May 2009 10:00:53 +0000 Subject: [PATCH] Prevent Tor users from emailing other users --- includes/specials/SpecialEmailuser.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 58e2514e08..5bf2b579a1 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -48,6 +48,12 @@ function wfSpecialEmailuser( $par ) { case 'mailnologin': $wgOut->showErrorPage( 'mailnologin', 'mailnologintext' ); return; + default: + // It's a hook error + list( $title, $msg, $params ) = $error; + $wgOut->showErrorPage( $title, $msg, $params ); + return; + } } @@ -297,12 +303,17 @@ class EmailUserForm { return 'actionthrottledtext'; } + $hookErr = null; + wfRunHooks( 'EmailUserPermissionsErrors', array( $user, $editToken, &$hookErr ) ); + + if ($hookErr) { + return $hookErr; + } + if( !$user->matchEditToken( $editToken ) ) { wfDebug( "Matching edit token failed.\n" ); return 'sessionfailure'; } - - return; } static function newFromURL( $target, $text, $subject, $cc_me ) -- 2.20.1