' . oc_('Fields not correctly filled out') . '';
}
if (!isset($_POST['name']) || !preg_match("/\p{L}/u", $_POST['name']) || preg_match("/[\r\n]/", $_POST['name'])) {
$err .= '
' . sprintf(oc_('%s field empty or invalid'), oc_('Name')) . '';
}
if (!isset($_POST['liame']) || !validEmail(($_POST['liame'] = trim($_POST['liame']))) || preg_match("/[\r\n]/", $_POST['liame'])) {
$err .= '' . sprintf(oc_('%s field empty or invalid'), oc_('Email')) . '';
}
if (($OC_configAR['OC_privacy_display'] > 0) && (!isset($_POST['consent']) || ($_POST['consent'] != '1'))) {
$err .= '' . sprintf(oc_('%s field is required'), oc_('Consent')) . '';
}
if (!isset($_POST['subject']) || !preg_match("/\p{L}/u", $_POST['subject']) || preg_match("/[\r\n]/", $_POST['subject'])) {
$err .= '' . sprintf(oc_('%s field empty or invalid'), oc_('Subject')) . '';
}
if (!isset($_POST['message']) || !preg_match("/\p{L}/u", $_POST['message'])) {
$err .= '' . sprintf(oc_('%s field empty or invalid'), oc_('Message')) . '';
} else {
$message = $_POST['message'];
}
if (oc_hookSet('author-contact-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-contact-validate'] as $hook) {
require_once $hook;
}
}
if (empty($err)) {
// add who it's from to body of message in case of an issue with reply headers
$message .= "\n\nFrom: " . $_POST['name'] . ' <' . $_POST['liame'] . ">\n";
// setup Reply-To
if (empty($hdr)) {
$hdr = 'From: "' . preg_replace('/"/', '', $_POST['name']) . '" <' . $GLOBALS['OC_configAR']['OC_pcemail'] . '>' . "\r\n" . // pcemail used to avoid email validation issues
'Reply-To: ' . $_POST['liame'] . "\r\n";
} else {
if (preg_match("/^(.*Reply-To:\s?)\S+(.*)$/s", $hdr, $matches)) {
$hdr = $matches[1] . $_POST['liame'] . $matches[2];
} elseif (preg_match("/[\r\n]$/s", $hdr)) {
$hdr .= 'Reply-To: ' . $_POST['liame'] . "\r\n";
} else {
$hdr .= "\r\n" . 'Reply-To: ' . $_POST['liame'] . "\r\n";
}
}
if (! oc_mail($OC_configAR['OC_pcemail'], $_POST['subject'], $message, $hdr)) {
err(oc_('An error occurred sending out the email.'));
} else {
print '' . oc_('Your message has been sent.') . '
';
printFooter();
exit;
}
}
}
print '
';
printFooter();
?>