refactor(contact-handler.php): PSR2 autoformat

This commit is contained in:
Jérémy Dufraisse 2024-03-18 10:34:55 +01:00
parent b58b2357c0
commit 1dd30c2f75

View File

@ -5,28 +5,28 @@ use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$errors = '';
$myEmail = getenv('ASTRO_SMTP_FROM');
$errors = '';
$myEmail = getenv('ASTRO_SMTP_FROM');
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
if(empty($_POST['namezzz']) || empty($_POST['emailzzz']) || empty($_POST['message'])) {
$errors .= "\n Error: all fields are required";
}
}
if(!empty($_POST['name']) && !empty($_POST['email'])) {
if(!empty($_POST['name']) && !empty($_POST['email'])) {
$errors .= "\n Error: spam";
}
}
$name = $_POST['namezzz'];
$emailAddress = $_POST['emailzzz'];
$select = $_POST['select'];
$message = $_POST['message'];
$subscribe = $_POST['subscribe'];
$name = $_POST['namezzz'];
$emailAddress = $_POST['emailzzz'];
$select = $_POST['select'];
$message = $_POST['message'];
$subscribe = $_POST['subscribe'];
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) {
$errors .= "\n Error: Invalid email address $emailAddress";
}
}
if( empty($errors)) {
if(empty($errors)) {
$to = $myEmail;
$emailSubject = "[Formulaire Astrolabe] Nouveau message";
@ -85,7 +85,7 @@ $mail = new PHPMailer(true);
// redirect to the 'thank you' page
header("Location: /thank-you/index.html");
}
}
?>
<!DOCTYPE html>
<html>
@ -97,6 +97,6 @@ $mail = new PHPMailer(true);
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
?>
</body>
</html>