summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialEmailuser.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
commit222b01f5169f1c7e69762e0e8904c24f78f71882 (patch)
tree8e932e12546bb991357ec48eb1638d1770be7a35 /includes/specials/SpecialEmailuser.php
parent00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff)
update to MediaWiki 1.16.0
Diffstat (limited to 'includes/specials/SpecialEmailuser.php')
-rw-r--r--includes/specials/SpecialEmailuser.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php
index 58e2514e..48088ded 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;
+
}
}
@@ -256,7 +262,7 @@ class EmailUserForm {
}
static function validateEmailTarget ( $target ) {
- if ( "" == $target ) {
+ if ( $target == "" ) {
wfDebug( "Target is empty.\n" );
return "notarget";
}
@@ -268,7 +274,7 @@ class EmailUserForm {
}
$nu = User::newFromName( $nt->getText() );
- if( is_null( $nu ) || !$nu->getId() ) {
+ if( !$nu instanceof User || !$nu->getId() ) {
wfDebug( "Target is invalid user.\n" );
return "notarget";
} else if ( !$nu->isEmailConfirmed() ) {
@@ -284,6 +290,10 @@ class EmailUserForm {
static function getPermissionsError ( $user, $editToken ) {
if( !$user->canSendEmail() ) {
wfDebug( "User can't send.\n" );
+ // FIXME: this is also the error if user is in a group
+ // that is not allowed to send e-mail (no right
+ // 'sendemail'). Error messages should probably
+ // be more fine grained.
return "mailnologin";
}
@@ -297,12 +307,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 )