some niceness

main
yova 3 years ago
parent 56dc24c74a
commit 5057096a7e

@ -1,8 +1,8 @@
---
header_brand: "gugelfrei"
header_tagline_paragraph: "Verfütter dem Gugel nicht dein Leben!"
header_tagline_paragraph: "Verfütter dem Gugel nicht dein Leben!\nSmartphone upcycling auf hohem Niveau."
header_button_cta:
url: "#contact-form"
url: "#reused_form"
title: "Besorg dirs!"
header_button_more:
url: "#was-bekommst-du"
@ -67,7 +67,7 @@ Hast du Interesse an so einem Ding? Dann sicher dir gleich eins:
---
# Impressum und DGSVO
# Impressum und DSGVO
Joe fix IT!
Witzenhausen

@ -1,33 +0,0 @@
<form id="reused_form" >
<h4>Please send me some friendly words.</h4>
<br>
<div class="meta-group" style="display: flex;justify-content: space-evenly;flex-wrap:wrap;">
<div class="form-group">
<label>😀 Name</label>
<input type="text" name="name" class="form-control" placeholder="Enter Name" style="margin-top:0.5em;">
</div>
<div class="form-group">
<label>✉️ Email</label>
<input type="email" name="email" class="form-control" placeholder="Enter Email" style="margin-top:0.5em;">
</div>
</div>
<div >
<div class="form-group" text-align="center" style="margin-bottom:0.5em;margin-top:0.5em;">
<label>📝 Message</label>
<textarea rows="3" name="message" placeholder="Type Your Message"></textarea>
</div>
<center>
<button type="submit" style="font-size:x-large">🏹 Post ↩️ </button>
</center>
</div>
</form>
<div id="error_message" style="width:100%; height:100%; display:none; ">
<h4>
Error
</h4>
Very sorry! There was an error with emailing me your precious words.
</div>
<div id="success_message" style="width:100%; height:100%; display:none; ">
<h2>That looks good!</h2>
<p>Message has been accepted! Please stand by. I usually reply within one or two days.</p>
</div>

@ -56,6 +56,6 @@
Very sorry! There was an error with emailing me your precious words.
</div>
<div id="success_message" style="width:100%; height:100%; display:none; ">
<h2>That looks good!</h2>
<p>Message has been accepted! Please stand by. I usually reply within one or two days.</p>
<h2>Das sieht gut aus!</h2>
<p>Die Nachricht ist zu mir unterwegs. Normalerweise antworte ich innerhalb von ein bis zwei Tagen.</p>
</div>

@ -6,23 +6,23 @@ use FormGuide\Handlx\Microtemplate;
use Gregwar\Captcha\CaptchaBuilder;
/**
* FormHandler
* FormHandler
* A wrapper class that handles common form handling tasks
* - handles Form validations using PHPFormValidator class
* - sends email using PHPMailer
* - sends email using PHPMailer
* - can handle captcha validation
* - can handle file uploads and attaching the upload to email
*
*
* ==== Sample usage ====
* $fh = FormHandler::create()->validate(function($validator)
* {
* $validator->fields(['name','email'])
* ->areRequired()->maxLength(50);
* $validator->field('email')->isEmail();
*
*
* })->useMailTemplate(__DIR__.'/templ/email.php')
* ->sendEmailTo('you@website.com');
*
*
* $fh->process($_POST);
*/
class FormHandler
@ -42,13 +42,13 @@ class FormHandler
$this->mailer = new PHPMailer;
$this->mail_template='';
$this->mailer->Subject = "Contact Form Submission ";
$this->mailer->Subject = "gugelfrei Nachricht";
$host = isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:'localhost';
$from_email ='forms@'.$host;
$this->mailer->setFrom($from_email,'Contact Form',false);
$this->mailer->setFrom($from_email,'----- gugelfrei.de -----',false);
$this->captcha = false;
$this->captcha = false;
$this->attachments = [];
@ -70,9 +70,9 @@ class FormHandler
}
else
{
$this->emails[] = $email_s;
$this->emails[] = $email_s;
}
return $this;
}
@ -99,7 +99,7 @@ class FormHandler
/**
* [validate add Validations. This function takes a call back function which receives the PHPFormValidator object]
* @param function $validator_fn The funtion gets a validator parameter using which, you can add validations
* @param function $validator_fn The funtion gets a validator parameter using which, you can add validations
*/
public function validate($validator_fn)
{
@ -113,7 +113,7 @@ class FormHandler
$this->recaptcha->enable(true);
if($config_fn)
{
$config_fn($this->recaptcha);
$config_fn($this->recaptcha);
}
return $this;
}
@ -200,10 +200,10 @@ class FormHandler
return json_encode([
'result'=>'error_sending_email',
'errors'=> ['mail'=> $this->mailer->ErrorInfo]
]);
]);
}
}
return json_encode(['result'=>'success']);
}
@ -226,7 +226,7 @@ class FormHandler
return json_encode([
'result'=>'captcha_error',
'errors'=>['captcha'=>'Captcha code does not match']
]);
]);
}
}
return true;
@ -235,7 +235,7 @@ class FormHandler
private function attach_files()
{
foreach($this->attachments as $file_field)
{
if (!array_key_exists($file_field, $_FILES))
@ -246,7 +246,7 @@ class FormHandler
$uploadfile = tempnam(sys_get_temp_dir(), sha1($filename));
if (!move_uploaded_file($_FILES[$file_field]['tmp_name'],
if (!move_uploaded_file($_FILES[$file_field]['tmp_name'],
$uploadfile))
{
continue;
@ -266,4 +266,4 @@ class FormHandler
}
$this->mailer->Body = $content;
}
}
}

Loading…
Cancel
Save