This commit is contained in:
Torsten Schulz
2023-06-16 11:57:49 +02:00
commit 44da93c0e9
328 changed files with 134580 additions and 0 deletions

29
include/contact.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
include 'renderer.php';
class Contact extends Renderer {
protected array $formFields = [
['label' => 'Ihre Nachricht an uns:', 'type' => 'textarea', 'size' => 50, 'name' => 'message', 'combine_with_next_line' => false,
'rows' => 14, 'cols' => 100],
['label' => 'Ihr Name', 'type' => 'text', 'size' => 50, 'name' => 'sendername', 'combine_with_next_line' => false],
['label' => 'Ihre Email-Adresse', 'type' => 'text', 'size' => 50, 'name' => 'senderemail', 'combine_with_next_line' => false],
];
protected string $formSendButtonLabel = 'Nachricht absenden';
protected function formAction(): void {
$message = filter_input(INPUT_POST, 'message', FILTER_SANITIZE_STRING);
$senderName = filter_input(INPUT_POST, 'sendername', FILTER_SANITIZE_STRING);
$senderEmail = filter_input(INPUT_POST, 'senderemail', FILTER_SANITIZE_EMAIL);
$noForm = trim($message) !== '';
if (!$noForm) {
$this->errors[] = 'Leider haben Sie keine Nachricht an uns hinterlassen. Bitte versuchen Sie es nochmal.';
return;
}
$mail = $this->initSmtpMailer();
$mail->setFrom(($senderEmail !== '') ? $senderEmail : 'foerderverein-ajs@gmx.de', ($senderName !== '') ? $senderName: 'Anonymer Sender');
$mail->addReplyTo(($senderEmail !== '') ? $senderEmail : 'foerderverein-ajs@gmx.de', ($senderName !== '') ? $senderName: 'Anonymer Sender');
$mail->addAddress('foerderverein-ajs@gmx.de', 'Vorstand Förderverein AJS');
$this->sendMail($mail, 'Kontaktformular', $message, '');
$this->templateName = 'message_success';
}
}