function fm_helper_displayAck($formInfo, $postData) { global $fm_display; $ack = fm_getSubmissionDataShortcoded($formInfo['submitted_msg'], $formInfo, $postData); $output = '<p>' . $ack . '</p>'; //show the automatic redirection script if ($formInfo['auto_redirect'] == 1) { $output .= "<script language=\"javascript\"><!--\n" . "setTimeout('location.replace(\"" . get_permalink($formInfo['auto_redirect_page']) . "\")', " . $formInfo['auto_redirect_timeout'] * 1000 . ");\n" . "//-->\n" . "</script>\n"; } //show the data summary if ($formInfo['show_summary'] == 1) { $output .= $fm_display->displayDataSummary('summary', $formInfo, $postData); } return $output; }
function fm_helper_sendEmail($formInfo, $postData) { global $fmdb; global $current_user; global $fm_display; if ($formInfo['use_advanced_email'] == 1) { $metaForm = $formInfo; $metaItems = $fmdb->getFormItems($formInfo['ID'], 1); $metaForm['items'] = array_merge($formInfo['items'], $metaItems); $advEmail = new fm_advanced_email_class($metaForm, $postData); $emails = $advEmail->generateEmails($formInfo['advanced_email']); foreach ($emails as $email) { $headerStr = ""; foreach ($email['headers'] as $header => $value) { $headerStr .= $header . ": " . $value . "\r\n"; } fm_sendEmail($email['to'], $email['subject'], $email['message'], $headerStr); } return true; } $formInfo['email_list'] = trim($formInfo['email_list']); $formInfo['email_user_field'] = trim($formInfo['email_user_field']); if ($formInfo['email_list'] != "" || $formInfo['email_user_field'] != "" || $fmdb->getGlobalSetting('email_admin') == "YES" || $fmdb->getGlobalSetting('email_reg_users') == "YES") { $subject = fm_getSubmissionDataShortcoded($formInfo['email_subject'], $formInfo, $postData); $message = $fm_display->displayDataSummary('email', $formInfo, $postData); $message = '<html><body>' . $message . '</body></html>'; $headers = 'From: ' . fm_getSubmissionDataShortcoded($formInfo['email_from'], $formInfo, $postData) . "\r\n" . 'Reply-To: ' . fm_getSubmissionDataShortcoded($formInfo['email_from'], $formInfo, $postData) . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: 8bit' . "\r\n"; $temp = ""; if ($fmdb->getGlobalSetting('email_admin') == "YES") { fm_sendEmail(get_option('admin_email'), $subject, $message, $headers); } if ($fmdb->getGlobalSetting('email_reg_users') == "YES") { if (trim($current_user->user_email) != "") { if ($fmdb->getGlobalSetting('email_admin') == "YES" && $current_user->user_email != get_option('admin_email') || $fmdb->getGlobalSetting('email_admin') != "YES") { fm_sendEmail($current_user->user_email, $subject, $message, $headers); } } } if ($formInfo['email_list'] != "") { fm_sendEmail($formInfo['email_list'], $subject, $message, $headers); } if ($formInfo['email_user_field'] != "") { fm_sendEmail($postData[$formInfo['email_user_field']], $subject, $message, $headers); } } }