From 59f86034f9cebdd302c16ed7c39dc6abaa8cb499 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 25 Mar 2018 15:36:45 +0200 Subject: [PATCH] Added missing input field 'fromName' --- .../acp/templates/sendMailUserBulkProcessing.tpl | 12 ++++++++++++ .../SendMailUserBulkProcessingAction.class.php | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/acp/templates/sendMailUserBulkProcessing.tpl b/wcfsetup/install/files/acp/templates/sendMailUserBulkProcessing.tpl index bebbcac353..f6709d7e7f 100644 --- a/wcfsetup/install/files/acp/templates/sendMailUserBulkProcessing.tpl +++ b/wcfsetup/install/files/acp/templates/sendMailUserBulkProcessing.tpl @@ -10,6 +10,18 @@ + +
+
+ + {if $errorField == 'fromName'} + + {lang}wcf.acp.user.sendMail.subject.fromName.{@$errorType}{/lang} + + {/if} +
+ +
diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php index 3500f4b481..dea7b56fd8 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/SendMailUserBulkProcessingAction.class.php @@ -2,6 +2,7 @@ namespace wcf\system\bulk\processing\user; use wcf\data\user\UserList; use wcf\data\DatabaseObjectList; +use wcf\system\email\EmailGrammar; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\util\StringUtil; @@ -28,6 +29,12 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction */ public $from = ''; + /** + * sender name + * @var string + */ + public $fromName = ''; + /** * identifier for the mail worker * @var string @@ -63,6 +70,7 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction 'action' => '', 'enableHTML' => $this->enableHTML, 'from' => $this->from, + 'fromName' => $this->fromName, 'groupIDs' => '', 'subject' => $this->subject, 'text' => $this->text, @@ -78,6 +86,7 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction public function getHTML() { if (!count($_POST)) { $this->from = MAIL_FROM_ADDRESS; + $this->fromName = MAIL_FROM_NAME; } return WCF::getTPL()->fetch('sendMailUserBulkProcessing', 'wcf', [ @@ -85,7 +94,8 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction 'from' => $this->from, 'mailID' => $this->mailID, 'subject' => $this->subject, - 'text' => $this->text + 'text' => $this->text, + 'fromName' => $this->fromName ]); } @@ -97,6 +107,7 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction if (isset($_POST['from'])) $this->from = StringUtil::trim($_POST['from']); if (isset($_POST['subject'])) $this->subject = StringUtil::trim($_POST['subject']); if (isset($_POST['text'])) $this->text = StringUtil::trim($_POST['text']); + if (isset($_POST['fromName'])) $this->fromName = StringUtil::trim($_POST['fromName']); } /** @@ -114,5 +125,8 @@ class SendMailUserBulkProcessingAction extends AbstractUserBulkProcessingAction if (empty($this->from)) { throw new UserInputException('from'); } + else if (!preg_match('(^'.EmailGrammar::getGrammar('addr-spec').'$)', $this->from)) { + throw new UserInputException('from', 'invalid'); + } } } -- 2.20.1