X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/dc7b531b3d4c33d18f64396ca20b0e010579cc88..e6a16fe920961e805c1b6a901692229e33006e3e:/widget/contact.php diff --git a/widget/contact.php b/widget/contact.php index a4fccda..6ccb79a 100644 --- a/widget/contact.php +++ b/widget/contact.php @@ -9,17 +9,18 @@ if ($_POST) { else { unset($_REQUEST['login']); } - $error = mailform($_REQUEST); + $error = mailform($_REQUEST, $Page->place); if (!empty($error)) { print "

$error

\n\n"; } } -function mailform($input = []) +function mailform($input = [], $config = []) { - $source = empty($input['subject']) ? 'reactie' : $input['subject']; + $source = $config['subject'] ?? + (empty($input['subject']) ? 'reactie' : $input['subject']); $domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); - $rcpt = "info@$domain"; + $rcpt = $config['rcpt'] ?? "info@$domain"; $subject = "Formulier {$_SERVER['HTTP_HOST']}: $source"; if (!$input) { @@ -39,7 +40,6 @@ switch ($source) { if (empty($input['naam']) or empty($input['huis'])) { return 'De bedoeling is juist dat je opgeeft wie er komt.'; } - $rcpt .= ', Heleen '; break; default: if (empty($input['email']) or !preg_match('/.+@.+\..+/', $input['email'])) { @@ -52,6 +52,9 @@ switch ($source) { $reply = preg_match('/\A[^\s\'@]{1,64}@[.a-zA-Z0-9-]{4,63}\z/', @$input['email']) ? $input['email'] : "noreply@$domain"; + if ($displayname = @$input['naam']) { + $reply = sprintf('"%s" <%s>', addcslashes($displayname, "\\\"\0..\37"), $reply); + } $header = "From: $reply"; foreach (array(