From: Tim Düsterhus Date: Thu, 18 Feb 2021 10:08:05 +0000 (+0100) Subject: Fix use of localized recipient email addresses in contact form X-Git-Tag: 5.3.5~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c9a0011e7b5c08e7f7bad91fa4b3a6d3ed0ff0b;p=GitHub%2FWoltLab%2FWCF.git Fix use of localized recipient email addresses in contact form --- diff --git a/wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php b/wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php index 042990c091..21ecda03ba 100644 --- a/wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php +++ b/wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php @@ -111,7 +111,7 @@ class ContactOptionAction extends CustomOptionAction implements ISortableAction // build mail $email = new Email(); - $email->addRecipient(new Mailbox($recipient->email)); + $email->addRecipient($recipient->getMailbox()); $email->setSubject($defaultLanguage->get('wcf.contact.mail.subject')); $email->setBody(new MimePartFacade([ new RecipientAwareTextMimePart('text/html', 'email_contact', 'wcf', $messageData), diff --git a/wcfsetup/install/files/lib/data/contact/recipient/ContactRecipient.class.php b/wcfsetup/install/files/lib/data/contact/recipient/ContactRecipient.class.php index 457c26cf4f..00a1d06699 100644 --- a/wcfsetup/install/files/lib/data/contact/recipient/ContactRecipient.class.php +++ b/wcfsetup/install/files/lib/data/contact/recipient/ContactRecipient.class.php @@ -1,6 +1,7 @@ get($this->name); + return $this->getName(); } /** @@ -49,4 +50,34 @@ class ContactRecipient extends DatabaseObject { $this->data['isAdministrator'] = MAIL_ADMIN_ADDRESS; } } + + /** + * Returns the localized name of this recipient. + * + * @since 5.3 + */ + public function getName(): string { + return WCF::getLanguage()->get($this->name); + } + + /** + * Returns the localized email address of this recipient. + * + * @since 5.3 + */ + public function getEmail(): string { + return WCF::getLanguage()->get($this->email); + } + + /** + * Returns a localized Mailbox for this recipient. + * + * @since 5.3 + */ + public function getMailbox(): Mailbox { + return new Mailbox( + $this->getEmail(), + $this->getName() + ); + } }