From e6a16fe920961e805c1b6a901692229e33006e3e Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 25 Jan 2021 23:55:24 +0100 Subject: [PATCH] widget/contact: subject and recipient address from call options Custom variables instead of hardcoding each case. --- widget/contact.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/widget/contact.php b/widget/contact.php index c6e7022..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'])) { -- 2.30.0