X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialEmailuser.php;h=4d875e6ef94bc6f4ef8911f1e93d8a25a2199174;hb=4498b01558ff849af9263101817cd3dcb9747e8d;hp=3d6033e90f67356a06c35e2e1776f3e607cea59d;hpb=72e00dfb197ef8685e4c6aa993a2595da50ea435;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 3d6033e90f..4d875e6ef9 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -33,6 +33,15 @@ class SpecialEmailUser extends UnlistedSpecialPage { parent::__construct( 'Emailuser' ); } + public function getDescription() { + $target = self::getTarget( $this->mTarget ); + if( !$target instanceof User ) { + return $this->msg( 'emailuser-title-notarget' )->text(); + } + + return $this->msg( 'emailuser-title-target', $target->getName() )->text(); + } + protected function getFormFields() { return array( 'From' => array( @@ -84,13 +93,18 @@ class SpecialEmailUser extends UnlistedSpecialPage { } public function execute( $par ) { - $this->setHeaders(); - $this->outputHeader(); $out = $this->getOutput(); $out->addModuleStyles( 'mediawiki.special' ); + $this->mTarget = is_null( $par ) ? $this->getRequest()->getVal( 'wpTarget', $this->getRequest()->getVal( 'target', '' ) ) : $par; + + // This needs to be below assignment of $this->mTarget because + // getDescription() needs it to determine the correct page title. + $this->setHeaders(); + $this->outputHeader(); + // error out if sending user cannot do this $error = self::getPermissionsError( $this->getUser(), $this->getRequest()->getVal( 'wpEditToken' ) ); switch ( $error ) { @@ -136,7 +150,6 @@ class SpecialEmailUser extends UnlistedSpecialPage { return false; } - $out->setPageTitle( $this->msg( 'emailpage' ) ); $result = $form->show(); if( $result === true || ( $result instanceof Status && $result->isGood() ) ) {