tl: newsletter.php > pt-BR

This commit is contained in:
Vitor Gonçalves 2023-12-02 13:24:33 -03:00
parent db56ec0771
commit 6270b60153
Signed by: vitorg
GPG Key ID: B90BF113DF56EB41
1 changed files with 17 additions and 17 deletions

View File

@ -33,14 +33,14 @@
if (preg_match("/^" . preg_quote($_GET['email']) . "$/m", file_get_contents("/var/spool/list")) === 1) {
if ($_GET['action'] == "unsub")
$email = sanitize($_GET['email']);
else $err = "E-mail already in list";
else $err = "E-mail já está na lista";
} else {
if ($_GET['action'] == "sub")
$email = sanitize($_GET['email']);
else $err = "E-mail not in list";
else $err = "E-mail não está na lista";
}
} else $err = "Invalid E-mail";
} else $err = "E-mail is required";
} else $err = "E-mail inválido";
} else $err = "E-mail necessário";
}
$filename = "/tmp/list-code-" . $email;
@ -58,16 +58,16 @@
}
unlink($filename);
$subject = ($_GET['action'] == "sub" ? "S" : "Uns") . "ubscription confirmed";
$subject = ($_GET['action'] == "sub" ? "I" : "Desi") . "nscrição confirmada!";
$headers = "From: announcements@vern.cc\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain\n";
$message = "You have been " . ($_GET['action'] == "sub" ? "added to" : "removed from") . " the ~vern announcement mailing list";
$message = "Você foi " . ($_GET['action'] == "sub" ? "adicionado à" : "removido da") . " mailing list de anúncios do ~vern";
mail($email, $subject, $message, $headers);
$confirmed = true;
} else {
$code_err = 'Incorrect code';
$code_err = 'Código incorreto';
}
} else {
$code = substr(md5(rand()), 0, 8);
@ -76,11 +76,11 @@
fwrite($handle, $code);
fclose($handle);
$subject = "Your confirmation code";
$subject = "Seu código de confirmação";
$headers = "From: announcements@vern.cc\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain\n";
$message = "Your confirmation code is $code. Do not share it with anyone.\n\nIf you did not initiate this, you can safely ignore this message.";
$message = "Seu código de confirmação é $code. Não o compartilhe com ninguém.\n\nSe você não fez isso, você pode ignorar essa mensagem.";
mail($email, $subject, $message, $headers);
}
@ -95,8 +95,8 @@
<input type="text" name="email"></p>
<select id="action" name="action">
<option value="sub">Subscribe</option>
<option value="unsub">Unsubscribe</option>
<option value="sub">Inscrever</option>
<option value="unsub">Desinscrever</option>
</select><br>
<br>
@ -105,12 +105,12 @@
<?php
} else if (!$confirmed) {
?>
<div class=h><h1 id=confirm>Confirm Action</h1> <a aria-hidden=true href=#confirm>#confirm</a></div>
<p>A confirmation code was sent to <?php echo htmlspecialchars($email); ?></p>
<div class=h><h1 id=confirm>Confirmar ação</h1> <a aria-hidden=true href=#confirm>#confirm</a></div>
<p>Um código de confirmação foi enviado para <?php echo htmlspecialchars($email); ?></p>
<form method="get" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ?>">
<input type="text" id="email" name="email" value="<?php echo htmlspecialchars($email); ?>" hidden>
<p>Code <span class="red">* <?php echo $code_err; ?></span>
<p>Código <span class="red">* <?php echo $code_err; ?></span>
<input type="text" name="code"></p>
<select id="action" name="action" hidden>
@ -124,9 +124,9 @@
} else {
?>
<meta http-equiv="refresh" content="5;url=/pt-BR/" />
<div class=h><h1 id=thanks>Confirmed</h1> <a aria-hidden=true href=#thanks>#thanks</a></div>
<p>You have received an e-mail confirming the action as well.</p>
<p>You will be redirected back <a href=/pt-BR/>home</a> in 5 seconds.</p>
<div class=h><h1 id=thanks>Confirmado!</h1> <a aria-hidden=true href=#thanks>#thanks</a></div>
<p>Você também recebeu um e-mail confirmando a ação.</p>
<p>Você será redirecionado de volta para a <a href=/pt-BR/>página principal</a> em 5 segundos.</p>
<?php
}
?>