Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/snippets/eform/docs/eform.htm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<div class="qe_level_1"><a name="whatsnew"></a>
<h2>What's New</h2>
<div class="qe_level_2">
<h3>Version 1.4.4.1 - 1.4.4.7</h3>
<h3>Version 1.4.4.1 - 1.4.4.8</h3>
<ul>
<li>eForm now retains default values for check boxes and radio buttons</li>
<li>text input fields now retain default value set in form template</li>
Expand All @@ -155,6 +155,7 @@ <h3>Version 1.4.4.1 - 1.4.4.7</h3>
<li>Work around for setting required class on check &amp; radio labels</li>
<li>bugfix: If eform attibute is set on multiple check boxes only the last value is set in values list</li>
<li>Security fix: Additional sanitization applied after stripslashes is used on fields</li>
<li>Security fix: Send sendirect, ccsender and autotext mails only to the first mail address of the comma separated list.</li>
</ul>
<p><br />You can see a more extensive <a href="eform_history.htm">version history here</a>. </p>
</div>
Expand Down
3 changes: 2 additions & 1 deletion assets/snippets/eform/docs/eform_history.htm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
</ul>
</div>
<div class="qe_level_1"><h2>Version History</h2>
<h3>Version 1.4.4.1 - 1.4.4.7</h3>
<h3>Version 1.4.4.1 - 1.4.4.8</h3>
<ul>
<li>eForm now retains default values for check boxes and radio buttons</li>
<li>text input fields now retain default value set in form template</li>
Expand All @@ -146,6 +146,7 @@ <h3>Version 1.4.4.1 - 1.4.4.7</h3>
<li>Work around for setting required class on check &amp; radio labels</li>
<li>bugfix: If eform attibute is set on multiple check boxes only the last value is set in values list</li>
<li>Security fix: Additional sanitization applied after stripslashes is used on fields</li>
<li>Security fix: Send sendirect, ccsender and autotext mails only to the first mail address of the comma separated list.</li>
</ul>
<h3>Version 1.4.4</h3>
<ul>
Expand Down
19 changes: 13 additions & 6 deletions assets/snippets/eform/eform.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
# eForm 1.4.4.7 - Electronic Form Snippet
# eForm 1.4.4.8 - Electronic Form Snippet
# Original created by: Raymond Irving 15-Dec-2004.
# Extended by: Jelle Jager (TobyL) September 2006
# -----------------------------------------------------
Expand Down Expand Up @@ -457,8 +457,15 @@ function eForm($modx,$params) {
//defaults to html so only test sendasText
$isHtml = ($sendAsText==1 || strstr($sendAsText,'report'))?false:true;

# added in 1.4.4.8 - Send sendirect, ccsender and autotext mails only to the first mail address of the comma separated list.
if ($fields['email']) {
$firstEmail = array_shift(explode(',', $fields['email']));
} else {
$firstEmail = '';
}

if(!$noemail) {
if($sendirect) $to = $fields['email'];
if($sendirect) $to = $firstEmail;
$mail = new PHPMailer();
$mail->IsMail();
$mail->CharSet = $modx->config['modx_charset'];
Expand All @@ -476,7 +483,7 @@ function eForm($modx,$params) {
}

# send user a copy of the report
if($ccsender && $fields['email']) {
if($ccsender && $firstEmail != '') {
$mail = new PHPMailer();
$mail->IsMail();
$mail->CharSet = $modx->config['modx_charset'];
Expand All @@ -485,15 +492,15 @@ function eForm($modx,$params) {
$mail->FromName = $fromname;
$mail->Subject = $subject;
$mail->Body = $report;
AddAddressToMailer($mail,"to",$fields['email']);
AddAddressToMailer($mail,"to",$firstEmail);
AttachFilesToMailer($mail,$attachments);
if(!$mail->send()) return 'CCSender: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
}

# send auto-respond email
//defaults to html so only test sendasText
$isHtml = ($sendAsText==1 || strstr($sendAsText,'autotext'))?false:true;
if ($autotext && $fields['email']!='') {
if ($autotext && $firstEmail != '') {
$autotext = formMerge($autotext,$fields);
$mail = new PHPMailer();
$mail->IsMail();
Expand All @@ -503,7 +510,7 @@ function eForm($modx,$params) {
$mail->FromName = ($autoSenderName)?$autoSenderName:$fromname;
$mail->Subject = $subject;
$mail->Body = $autotext;
AddAddressToMailer($mail,"to",$fields['email']);
AddAddressToMailer($mail,"to",$firstEmail);
if(!$mail->send()) return 'AutoText: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
}

Expand Down