From: Bryan Tong Minh Date: Thu, 21 Aug 2008 22:15:34 +0000 (+0000) Subject: * (bug 13879) Special:EmailUser shows a form in case no user was specified X-Git-Tag: 1.31.0-rc.0~45729 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=e751a22a2f9e092b61ac33f99e5d210a4ab09098;p=lhc%2Fweb%2Fwiklou.git * (bug 13879) Special:EmailUser shows a form in case no user was specified --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ddf583598c..1c598af880 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -94,6 +94,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * HTML entities like   now work (are not escaped) in edit summaries. * (bug 13815) In the comment for page moves, use the colon-separator message instead of a hardcoded colon. +* (bug 13879) Special:EmailUser shows a form in case no user was specified === Bug fixes in 1.14 === diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 7e083536c9..7d23ddea9b 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -52,6 +52,8 @@ class ApiEmailUser extends ApiBase { // Validate target $targetUser = EmailUserForm::validateEmailTarget( $params['target'] ); + if ( $targetUser === false ) + $this->dieUsageMsg( array( 'notargettitle' ) ); if ( !( $targetUser instanceof User ) ) $this->dieUsageMsg( array( $targetUser[0] ) ); diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index d557c847d2..917ae925ce 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -14,7 +14,7 @@ function wfSpecialEmailuser( $par ) { $target = isset($par) ? $par : $wgRequest->getVal( 'target' ); $targetUser = EmailUserForm::validateEmailTarget( $target ); - if ( !( $targetUser instanceof User ) ) { + if ( !( $targetUser instanceof User ) && $targetUser !== false ) { $wgOut->showErrorPage( $targetUser[0], $targetUser[1] ); return; } @@ -47,7 +47,7 @@ function wfSpecialEmailuser( $par ) { } - if ( "submit" == $action && $wgRequest->wasPosted() ) { + if ( "submit" == $action && $wgRequest->wasPosted() && $targetUser !== false ) { $result = $form->doSubmit(); if ( !is_null( $result ) ) { @@ -98,8 +98,9 @@ class EmailUserForm { $senderLink = $skin->makeLinkObj( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ); $emt = wfMsg( "emailto" ); - $recipientLink = $skin->makeLinkObj( - $this->target->getUserPage(), htmlspecialchars( $this->target->getName() ) ); + $recipient = $this->target instanceof User ? + htmlspecialchars( $this->target->getName() ) : + ''; $emr = wfMsg( "emailsubject" ); $emm = wfMsg( "emailmessage" ); $ems = wfMsg( "emailsend" ); @@ -107,8 +108,7 @@ class EmailUserForm { $encSubject = htmlspecialchars( $this->subject ); $titleObj = SpecialPage::getTitleFor( "Emailuser" ); - $action = $titleObj->escapeLocalURL( "target=" . - urlencode( $this->target->getName() ) . "&action=submit" ); + $action = $titleObj->escapeLocalURL( "action=submit" ); $token = htmlspecialchars( $wgUser->editToken() ); $wgOut->addHTML( " @@ -118,7 +118,7 @@ class EmailUserForm { {$senderLink} {$emt}: -{$recipientLink} + {$emr}: @@ -235,8 +235,7 @@ class EmailUserForm { return array( "nosuchspecialpage", "nospecialpagetext" ); if ( "" == $target ) { - wfDebug( "Target is empty.\n" ); - return array( "notargettitle", "notargettext" ); + return false; } $nt = Title::newFromURL( $target );