From 275a1691d1ea259d3938a99b841df1de9312cb2f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 19 Feb 2018 22:01:42 -0500 Subject: [PATCH] cc/bcc fields work properly in api --- api/BusinessLogic/Emails/BasicEmailSender.php | 6 ++++-- api/DataAccess/CustomFields/CustomFieldsGateway.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/BusinessLogic/Emails/BasicEmailSender.php b/api/BusinessLogic/Emails/BasicEmailSender.php index 8ab1c37d..0ff5e449 100644 --- a/api/BusinessLogic/Emails/BasicEmailSender.php +++ b/api/BusinessLogic/Emails/BasicEmailSender.php @@ -10,8 +10,10 @@ use PHPMailer; class BasicEmailSender extends \BaseClass implements EmailSender { function sendEmail($emailBuilder, $heskSettings, $modsForHeskSettings, $sendAsHtml) { - if (preg_match("/\n|\r|\t|%0A|%0D|%08|%09/", $emailBuilder->to . $emailBuilder->subject)) { - return false; + foreach ($emailBuilder->to as $to) { + if (preg_match("/\n|\r|\t|%0A|%0D|%08|%09/", $to . $emailBuilder->subject)) { + return false; + } } $mailer = new PHPMailer(); diff --git a/api/DataAccess/CustomFields/CustomFieldsGateway.php b/api/DataAccess/CustomFields/CustomFieldsGateway.php index fb52d6a9..ce26ba45 100644 --- a/api/DataAccess/CustomFields/CustomFieldsGateway.php +++ b/api/DataAccess/CustomFields/CustomFieldsGateway.php @@ -14,7 +14,7 @@ class CustomFieldsGateway extends CommonDao { $customField = new CustomField(); $customField->id = $row['id']; $names = json_decode($row['name'], true); - $customField->name = (isset($names[$hesk_settings['language']])) ? $names[$heskSettings['language']] : reset($names); + $customField->name = (isset($names[$heskSettings['language']])) ? $names[$heskSettings['language']] : reset($names); $customField->type = $row['type']; $customField->properties = json_decode($row['value'], true);