Prevent Tor users from emailing other users
authorAndrew Garrett <werdna@users.mediawiki.org>
Thu, 28 May 2009 10:00:53 +0000 (10:00 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Thu, 28 May 2009 10:00:53 +0000 (10:00 +0000)
includes/specials/SpecialEmailuser.php

index 58e2514..5bf2b57 100644 (file)
@@ -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 )