removed credentials from PHP souce code; refined handling of error/success message; added more images
This commit is contained in:
parent
d4da1dee46
commit
08141b6687
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ utils/.caldav_pass
|
|||||||
content/pages/termine.md
|
content/pages/termine.md
|
||||||
lighttpd.conf
|
lighttpd.conf
|
||||||
newsletter.sqlite
|
newsletter.sqlite
|
||||||
|
config.ini
|
||||||
|
|||||||
BIN
content/images/tr/motif-fireworks.jpg
Normal file
BIN
content/images/tr/motif-fireworks.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 747 KiB After Width: | Height: | Size: 747 KiB |
@ -1,8 +1,8 @@
|
|||||||
let query = new URLSearchParams(location.search);
|
let query = new URLSearchParams(location.search);
|
||||||
let msg = 'keine Fehlermeldung gefunden';
|
let msg = 'keine Statusmeldung gefunden';
|
||||||
if (query.has('msg')) {
|
if (query.has('msg')) {
|
||||||
msg = query.get('msg');
|
msg = query.get('msg');
|
||||||
}
|
}
|
||||||
if ( document.getElementById('error-msg').firstChild != null ) {
|
if ( document.getElementById('msg').firstChild != null ) {
|
||||||
document.getElementById('error-msg').firstChild.nodeValue = msg;
|
document.getElementById('msg').firstChild.nodeValue = msg;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
---
|
---
|
||||||
title: Kleines Dankeschön
|
title: Du bist Abonnent!
|
||||||
date: 2025-02-04 10:20
|
date: 2025-02-04 10:20
|
||||||
author: Tobias Radloff
|
author: Tobias Radloff
|
||||||
summary: Danke für deine Nachricht.
|
summary: Danke für deine Nachricht.
|
||||||
lang: de
|
lang: de
|
||||||
slug: danke
|
slug: danke
|
||||||
save_as: newsletter/danke.html
|
save_as: newsletter/danke.html
|
||||||
|
featured_image:
|
||||||
|
- pic: ../images/tr/motif-fireworks.jpg
|
||||||
|
alt: prächtige Feuerwerksraketen explodieren am Nachthimmel über einem See
|
||||||
|
credit: Ray Hennessy | unsplash.com
|
||||||
|
credit_link: https://unsplash.com/@rayhennessy
|
||||||
---
|
---
|
||||||
|
|
||||||
Klasse, dass du dich für meinen Newsletter angemeldet hast. Als kleines Dankeschön und um die Wartezeit auf die nächste Ausgabe zu verkürzen, ist hier ein bislang unveröffentlichtes Gedicht von mir. Viel Spaß :-)
|
Klasse, dass du dich für meinen Newsletter angemeldet hast. Als kleines Dankeschön und um die Wartezeit auf die nächste Ausgabe zu verkürzen, ist hier ein bislang unveröffentlichtes Gedicht von mir. Viel Spaß :-)
|
||||||
|
|||||||
@ -13,9 +13,9 @@ featured_image:
|
|||||||
credit_link: https://unsplash.com/@elisa_ventur
|
credit_link: https://unsplash.com/@elisa_ventur
|
||||||
---
|
---
|
||||||
|
|
||||||
Verflixt, es ist ein Fehler bei der Newsletter-Verwaltung aufgetreten. Vielleicht hilft dir die Fehlermeldung weiter?
|
Verflixt, es ist ein Fehler bei der Newsletter-Verwaltung aufgetreten. Vielleicht hilft dir die Statusmeldung weiter?
|
||||||
|
|
||||||
`suche Fehlermeldung`{: #error-msg}
|
`suche Statusmeldung`{: #msg}
|
||||||
|
|
||||||
<script src="{static}/js/Message.js"></script>
|
<script src="{static}/js/Message.js"></script>
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,8 @@ featured_image:
|
|||||||
credit_link: https://unsplash.com/@ianstauffer
|
credit_link: https://unsplash.com/@ianstauffer
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<p id="msg">Erfolg auf der ganzen Linie.</p>
|
||||||
|
|
||||||
<script src="{static}/js/Message.js"></script>
|
<script src="{static}/js/Message.js"></script>
|
||||||
|
|
||||||
[← zur Startseite](/)
|
[← zur Startseite](/)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ slug: termine
|
|||||||
url: termine/
|
url: termine/
|
||||||
save_as: termine/index.html
|
save_as: termine/index.html
|
||||||
featured_image:
|
featured_image:
|
||||||
- pic: ../images/tr/motif-termine-towfiqu-barbhuiya-unsplash.jpg
|
- pic: ../images/tr/motif-termine.jpg
|
||||||
alt: in einem Kalender stecken rote Reißzwecken und ein Tag ist rot eingekringelt
|
alt: in einem Kalender stecken rote Reißzwecken und ein Tag ist rot eingekringelt
|
||||||
credit: Towfiqu barbhuiya | unsplash.com
|
credit: Towfiqu barbhuiya | unsplash.com
|
||||||
credit_link: https://unsplash.com/@towfiqu999999
|
credit_link: https://unsplash.com/@towfiqu999999
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// inspired by https://www.mailgun.com/blog/email/double-opt-in-with-php-mailgun/
|
// inspired by https://www.mailgun.com/blog/email/double-opt-in-with-php-mailgun/
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../settings.php');
|
require(dirname(__FILE__) . '/../functions.php');
|
||||||
|
|
||||||
$successURL = '/newsletter/danke.html';
|
$successURL = '/newsletter/danke.html';
|
||||||
$errorURL = '/error.html';
|
$errorURL = '/error.html';
|
||||||
|
|||||||
@ -7,7 +7,7 @@ if ( $_POST['address'] != '' ) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../settings.php');
|
require(dirname(__FILE__) . '/../functions.php');
|
||||||
|
|
||||||
$successURL = '/success.html';
|
$successURL = '/success.html';
|
||||||
$errorURL = '/error.html';
|
$errorURL = '/error.html';
|
||||||
|
|||||||
@ -9,13 +9,17 @@ require $dname . '/Exception.php';
|
|||||||
require $dname . '/PHPMailer.php';
|
require $dname . '/PHPMailer.php';
|
||||||
require $dname . '/SMTP.php';
|
require $dname . '/SMTP.php';
|
||||||
|
|
||||||
|
// read ini file
|
||||||
|
$ini_file = '../../config.ini';
|
||||||
|
$ini = parse_ini_file($ini_file, TRUE);
|
||||||
|
|
||||||
// general constants
|
// general constants
|
||||||
$general = [
|
$general = [
|
||||||
// site domain (used for building confirmation links)
|
// site domain (used for building confirmation links)
|
||||||
/* 'domain' => 'tobias-radloff.de', */
|
/* 'domain' => 'tobias-radloff.de', */
|
||||||
'domain' => 'localhost',
|
'domain' => 'localhost',
|
||||||
// string concatenated with email address to create a non-recreatable md5 hash
|
// string concatenated with email address to create a non-recreatable md5 hash
|
||||||
'uniqueKey' => '***REMOVED***', // works like password salt
|
'uniqueKey' => $ini['hash']['uniqueKey'], // works like password salt
|
||||||
// file name of confirm script
|
// file name of confirm script
|
||||||
'confirmScript' => '/newsletter/confirm.php',
|
'confirmScript' => '/newsletter/confirm.php',
|
||||||
// status code to be used when redirection to success or error page
|
// status code to be used when redirection to success or error page
|
||||||
@ -33,28 +37,8 @@ $general = [
|
|||||||
// complete site URL
|
// complete site URL
|
||||||
$general['siteURL'] = 'https://' . $general['domain'];
|
$general['siteURL'] = 'https://' . $general['domain'];
|
||||||
|
|
||||||
// SMTP server information
|
$smtp = $ini['smtp'];
|
||||||
$smtp = [
|
$db = $ini['db'];
|
||||||
'host' => '***REMOVED***
|
|
||||||
'port' => 587,
|
|
||||||
'username' => 'tobias',
|
|
||||||
'password' => '***REMOVED***',
|
|
||||||
'auth' => TRUE,
|
|
||||||
];
|
|
||||||
|
|
||||||
// database information
|
|
||||||
$db = [
|
|
||||||
'sqlite' => [
|
|
||||||
'dsn' => 'sqlite:../../newsletter.sqlite',
|
|
||||||
],
|
|
||||||
'mysql' => [
|
|
||||||
'dsn' => '',
|
|
||||||
'host' => '',
|
|
||||||
'port' => '',
|
|
||||||
'username' => '',
|
|
||||||
'password' => ''
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
function GetConfirmationHash($confEmail) {
|
function GetConfirmationHash($confEmail) {
|
||||||
global $general;
|
global $general;
|
||||||
@ -68,22 +52,22 @@ function getPDO($dbType = 'sqlite') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sends an email to single recipient with subject, body and sender info specified in an array
|
// Sends an email to single recipient with subject, body and sender info specified in an array
|
||||||
function SendEmail($recipientAddress, $mailContents) {
|
function SendEmail($toAddress, $mailContents) {
|
||||||
global $general, $smtp;
|
global $general, $smtp;
|
||||||
$mail = new PHPMailer(true);
|
$mail = new PHPMailer(true);
|
||||||
|
|
||||||
//Server settings
|
//Server settings
|
||||||
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
|
||||||
$mail->isSMTP();
|
$mail->isSMTP();
|
||||||
$mail->Host = $smtp['host'];
|
$mail->Host = $smtp['host'];
|
||||||
|
$mail->Port = $smtp['port']; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
||||||
$mail->SMTPAuth = $smtp['auth'];
|
$mail->SMTPAuth = $smtp['auth'];
|
||||||
$mail->Username = $smtp['username'];
|
$mail->Username = $smtp['username'];
|
||||||
$mail->Password = $smtp['password'];
|
$mail->Password = $smtp['password'];
|
||||||
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
//$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
|
||||||
$mail->Port = $smtp['port']; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
|
|
||||||
|
|
||||||
// recipient
|
// recipient
|
||||||
$mail->addAddress($recipientAddress); //Add a recipient
|
$mail->addAddress($toAddress);
|
||||||
|
|
||||||
// content
|
// content
|
||||||
$mail->CharSet = 'UTF-8';
|
$mail->CharSet = 'UTF-8';
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// inspired by https://www.mailgun.com/blog/email/double-opt-in-with-php-mailgun/
|
// inspired by https://www.mailgun.com/blog/email/double-opt-in-with-php-mailgun/
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../settings.php');
|
require(dirname(__FILE__) . '/../functions.php');
|
||||||
|
|
||||||
$successURL = '/success.html';
|
$successURL = '/success.html';
|
||||||
$errorURL = '/error.html';
|
$errorURL = '/error.html';
|
||||||
@ -59,5 +59,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// success
|
// success
|
||||||
|
$mailContents['subject'] = 'Jemand will den Newsletter abonnieren und hat eine Kopie dieser Mail bekommen';
|
||||||
|
SendEmail($general['notificationAddress'], $mailContents);
|
||||||
GracefulExit($successURL, "Anmeldung erfolgreich: Email mit Bestätigungslink wurde an {$email} versandt.");
|
GracefulExit($successURL, "Anmeldung erfolgreich: Email mit Bestätigungslink wurde an {$email} versandt.");
|
||||||
?>
|
?>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../settings.php');
|
require(dirname(__FILE__) . '/../functions.php');
|
||||||
|
|
||||||
$successURL = '/success.html';
|
$successURL = '/success.html';
|
||||||
$errorURL = '/error.html';
|
$errorURL = '/error.html';
|
||||||
|
|||||||
@ -28,7 +28,7 @@ IGNORE_FILES = ['**/.*', '__pycache__', 'favicon-from-svg.sh', '*.metadata']
|
|||||||
|
|
||||||
EXTRA_PATH_METADATA = {
|
EXTRA_PATH_METADATA = {
|
||||||
'favicon/favicon.ico': {'path': 'favicon.ico'},
|
'favicon/favicon.ico': {'path': 'favicon.ico'},
|
||||||
'php/settings.php': {'path': 'settings.php'},
|
'php/functions.php': {'path': 'functions.php'},
|
||||||
'php/subscribe.php': {'path': 'newsletter/subscribe.php'},
|
'php/subscribe.php': {'path': 'newsletter/subscribe.php'},
|
||||||
'php/confirm.php': {'path': 'newsletter/confirm.php'},
|
'php/confirm.php': {'path': 'newsletter/confirm.php'},
|
||||||
'php/unsubscribe.php': {'path': 'newsletter/unsubscribe.php'},
|
'php/unsubscribe.php': {'path': 'newsletter/unsubscribe.php'},
|
||||||
|
|||||||
@ -323,6 +323,8 @@ figcaption {
|
|||||||
.index-link::after {
|
.index-link::after {
|
||||||
content: "\00a0\02192"; /* arrow to the right */
|
content: "\00a0\02192"; /* arrow to the right */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a { color: var(--pico-h1-color);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user