Compare commits
14 Commits
9f257e569d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7566cb2e6b | ||
|
|
e043a1b022 | ||
|
|
e88e5477de | ||
|
|
dd8ce88556 | ||
|
|
8ed62b86bc | ||
|
|
d73f287f7b | ||
|
|
7682671a79 | ||
|
|
c8475be001 | ||
|
|
6b27f094a2 | ||
|
|
4dd6b9ffca | ||
|
|
8cebbf17d2 | ||
|
|
d37805a798 | ||
|
|
32cf68e3ac | ||
|
|
bc2eefd305 |
@@ -11,8 +11,8 @@
|
||||
"mail": "",
|
||||
"bulkmail": "Emailverteiler",
|
||||
"logout": "",
|
||||
"savemail": "Ideenboard",
|
||||
"planboard": "",
|
||||
"savemail": "",
|
||||
"planboard": "Ideenboard",
|
||||
"projectsmanagement": "Förderprojekte",
|
||||
"memberlistdownload": ""
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ class Bulkmail extends Renderer {
|
||||
['label' => 'Signatur', 'type' => 'combobox', 'size' => 5, 'name' => 'signature', 'combine_with_next_line' => false,
|
||||
'values' => ['Persönliche Signatur', 'Vorstandssignatur'],
|
||||
],
|
||||
['label' => 'An normale Mitglieder', 'type' => 'checkbox', 'size' => 50, 'name' => 'custommembers', 'size' => 1, 'value' => 1, 'combine_with_next_line' => false],
|
||||
['label' => 'An den Vorstand', 'type' => 'checkbox', 'size' => 50, 'name' => 'board', 'size' => 1, 'value' => 1, 'combine_with_next_line' => false],
|
||||
];
|
||||
protected string $formSendButtonLabel = 'Email an alle aktiven Mitglieder absenden';
|
||||
protected string $formSendButtonLabel = 'Email an ausgewählte Empfängergruppe senden';
|
||||
|
||||
protected function formAction(): void {
|
||||
$this->sendEmail($this->generateSubject(), $this->generateBody(), $this->generateSignature(filter_input(INPUT_POST, 'signature')));
|
||||
@@ -26,23 +28,32 @@ class Bulkmail extends Renderer {
|
||||
protected function sendEmail(string $subject, string $body, string $signature): void {
|
||||
$mail = $this->initSmtpMailer();;
|
||||
$bccRecipients = $this->loadReceivers();
|
||||
$sendToCustomMembers = intval(filter_input(INPUT_POST, 'custommembers')) === 1;
|
||||
$sendToBoard = intval(filter_input(INPUT_POST, 'board')) === 1;
|
||||
$sendTo = [];
|
||||
try {
|
||||
$mail->setFrom('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule');
|
||||
$mail->addReplyTo('foerderverein-ajs@gmx.de', 'Förderverein der Steffi-Jones-Schule');
|
||||
$mail->addAddress('vorstand@fvajs.de', 'Vorstand des FVAJS');
|
||||
foreach ($bccRecipients as $recipient) {
|
||||
$mail->addBCC($recipient);
|
||||
if (($sendToCustomMembers && $recipient['position'] === null)
|
||||
|| ($sendToBoard && $recipient['position'] !== null)) {
|
||||
$mail->addBCC($recipient['email']);
|
||||
$sendTo[] = $recipient['email'];
|
||||
} else {
|
||||
var_dump($recipient['position']);
|
||||
}
|
||||
}
|
||||
$this->sendMail($mail, $subject, $body, $signature);
|
||||
} catch (Exception $e) {
|
||||
$this->templateName = 'error_smtp';
|
||||
}
|
||||
$this->templateName = 'bulkmail_success';
|
||||
$this->content['recipients'] = implode('<br />', $bccRecipients);
|
||||
$this->content['recipients'] = implode('<br />', $sendTo);
|
||||
}
|
||||
|
||||
protected function loadReceivers(): array {
|
||||
$query = 'SELECT c.first_name, c.last_name, c.email, c.salt
|
||||
$query = 'SELECT c.first_name, c.last_name, c.email, c.salt, c.position_id
|
||||
FROM clubmember c
|
||||
JOIN clubmember_status cs
|
||||
ON cs.id = c.membership_status
|
||||
@@ -50,7 +61,7 @@ class Bulkmail extends Renderer {
|
||||
$dbResult = mysqli_query($this->dbConnection, $query);
|
||||
$recipientsList = [];
|
||||
while ($row = mysqli_fetch_assoc($dbResult)) {
|
||||
$recipientsList[] = $this->decode($row['email'], $row['salt']);
|
||||
$recipientsList[] = ['email' => $this->decode($row['email'], $row['salt']), 'position' => $row['position_id'] ];
|
||||
}
|
||||
return $recipientsList;
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ class Projectsmanagement extends Renderer {
|
||||
WHERE caption = "Fortlaufende Projekte"', $newName);
|
||||
mysqli_query($this->dbConnection, $query);
|
||||
$id = mysqli_insert_id($this->dbConnection);
|
||||
$query = 'SELECT id, short_title FROM project p ORDER BY short_title';
|
||||
$query = 'SELECT id, short_title, project_type_id FROM project p ORDER BY short_title';
|
||||
$dbResult = mysqli_query($this->dbConnection, $query);
|
||||
$list = [];
|
||||
while ($row = mysqli_fetch_assoc($dbResult)) {
|
||||
$list[] = ['id' => $row['id'], 'title' => $row['short_title'] ];
|
||||
$list[] = ['id' => $row['id'], 'title' => $row['short_title'], 'project_type_id' => $row['project_type_id'] ];
|
||||
}
|
||||
echo json_encode(['list' => $list, 'id' => $id]);
|
||||
echo json_encode(['list' => $list, 'id' => $id, 'types' => $this->getProjectTypes()]);
|
||||
}
|
||||
|
||||
protected function setDescription(): void {
|
||||
@@ -90,15 +90,10 @@ class Projectsmanagement extends Renderer {
|
||||
}
|
||||
|
||||
protected function generateContent(): void {
|
||||
$typesQuery = 'SELECT * FROM project_type ORDER BY id';
|
||||
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
|
||||
$types = [];
|
||||
while ($row = mysqli_fetch_assoc($typesResult)) {
|
||||
$types[$row['id'] ] = $row['caption'];
|
||||
}
|
||||
$types = $this->getProjectTypes();
|
||||
$query = 'SELECT * FROM project ORDER BY short_title';
|
||||
$result = mysqli_query($this->dbConnection, $query);
|
||||
$overviewHtml = '<table><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>';
|
||||
$overviewHtml = '<table id="projectoverview"><thead><tr><th>Projekt</th><th>Projekttyp</th><tr><thead><tbody>';
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$overviewHtml .= '<tr><td>' . $row['short_title'] . '</td>';
|
||||
$overviewHtml .= '<td><select name="project_type" data="' . $row['id'] . '">';
|
||||
@@ -111,4 +106,14 @@ class Projectsmanagement extends Renderer {
|
||||
$overviewHtml .= '</tbody></table>';
|
||||
$this->content['projects'] = $overviewHtml;
|
||||
}
|
||||
|
||||
protected function getProjectTypes(): array {
|
||||
$typesQuery = 'SELECT * FROM project_type ORDER BY id';
|
||||
$typesResult = mysqli_query($this->dbConnection, $typesQuery);
|
||||
$types = [];
|
||||
while ($row = mysqli_fetch_assoc($typesResult)) {
|
||||
$types[$row['id'] ] = $row['caption'];
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,23 @@ class Register extends Renderer {
|
||||
'value' => 1],
|
||||
];
|
||||
protected string $formSendButtonLabel = 'Zugang beantragen';
|
||||
protected string $templateName = 'renderer';
|
||||
|
||||
protected function formAction(): void {
|
||||
error_log('DEBUG Register::formAction aufgerufen');
|
||||
if (!$this->formCheckFields()) {
|
||||
error_log('DEBUG Register::formCheckFields fehlgeschlagen: ' . print_r($this->errors, true));
|
||||
// Bei Validierungsfehlern: nichts speichern, keine Mail, Fehler im Formular anzeigen
|
||||
return;
|
||||
}
|
||||
error_log('DEBUG Register::formCheckFields ok, schreibe in DB');
|
||||
$this->writeToDb();
|
||||
error_log('DEBUG Register::writeToDb erledigt, sende Mail');
|
||||
$this->sendEmail();
|
||||
$this->templateName = 'register_successful';
|
||||
error_log('DEBUG Register::sendEmail beendet, Errors: ' . print_r($this->errors, true));
|
||||
if (count($this->errors) === 0) {
|
||||
$this->templateName = 'register_successful';
|
||||
}
|
||||
}
|
||||
|
||||
protected function formCheckFields(): bool {
|
||||
@@ -28,7 +40,10 @@ class Register extends Renderer {
|
||||
if (!preg_match('/^([a-z0-9]{3,16})$/', $username)) {
|
||||
$this->errors['username'] = 'Der Benutzername darf nur aus Buchstaben (ohne Umlaute) und Zahlen bestehen und muss zwischen drei und sechzen Zeichen lang sein.';
|
||||
}
|
||||
if (!filter_var(strtolower(trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL)), FILTER_VALIDATE_EMAIL))) {
|
||||
if (!filter_var(
|
||||
strtolower(trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL))),
|
||||
FILTER_VALIDATE_EMAIL
|
||||
)) {
|
||||
$this->errors['email'] = 'Die Email-Adresse ist inkorrekt';
|
||||
}
|
||||
if (strlen(filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING)) < 8) {
|
||||
@@ -40,22 +55,22 @@ class Register extends Renderer {
|
||||
if (filter_input(INPUT_POST, 'accept', FILTER_SANITIZE_NUMBER_INT) !== '1') {
|
||||
$this->errors['accept'] = 'Sie müssen der Speicherung Ihrer Daten zustimmen.';
|
||||
}
|
||||
return (count($errors) === 0);
|
||||
return (count($this->errors) === 0);
|
||||
}
|
||||
|
||||
protected function writeToDb(): void {
|
||||
$salt = $this->generateRandomString();
|
||||
$encryptedName = $this->encode(trim(filter_input(INPUT_POST, 'fullname', FILTER_SANITIZE_STRING), $salt));
|
||||
$encryptedName = $this->encode(trim(filter_input(INPUT_POST, 'fullname', FILTER_SANITIZE_STRING)), $salt);
|
||||
$email = strtolower(trim(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL)));
|
||||
$encryptedEmail = $this->encode($email, $salt);
|
||||
$query = sprintf("INSERT INTO ffajs.`user` (username, password, realname, email, active, save_data_accepted, salt, color_id) "
|
||||
. "VALUES('%s', '%s', '%s', '%s', 0, %d, '%s', (SELECT c.id
|
||||
. "VALUES('%s', '%s', '%s', '%s', 0, %d, '%s', COALESCE((SELECT c.id
|
||||
FROM color c
|
||||
left join `user` u
|
||||
on u.color_id = c.id
|
||||
where u.id is null
|
||||
order by rand()
|
||||
limit 1))",
|
||||
limit 1), 1))",
|
||||
strtolower(trim(filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING))),
|
||||
password_hash(filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING), PASSWORD_DEFAULT),
|
||||
$encryptedName,
|
||||
|
||||
@@ -8,7 +8,7 @@ use Webklex\PHPIMAP\Client;
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
class Renderer {
|
||||
protected string $templateName;
|
||||
protected string $templateName = 'index';
|
||||
private array $menuItems = [];
|
||||
protected array $internalMenuItems = [];
|
||||
protected $hiddenCount = 0;
|
||||
@@ -48,10 +48,11 @@ class Renderer {
|
||||
$scriptName = $this->getScriptName();
|
||||
if (!in_array($scriptName, array_merge($this->menuItems, $this->internalMenuItems))) {
|
||||
header('Location: /', true, 301);
|
||||
return;
|
||||
exit;
|
||||
}
|
||||
$this->templateName = $templateName ?: (!in_array($scriptName, ['ffajs', 'fvajs', '', '/']) ? $scriptName : 'index');
|
||||
$this->connectDb();
|
||||
$this->content['year'] = date('Y');
|
||||
}
|
||||
|
||||
private function createPublicMenuItems(): void {
|
||||
@@ -173,7 +174,9 @@ class Renderer {
|
||||
}
|
||||
|
||||
private function footer(): void {
|
||||
$this->website = str_replace('{{footer}}', file_get_contents('templates/footer.html'), $this->website);
|
||||
$footerTemplate = file_get_contents('templates/footer.html');
|
||||
$footer = str_replace('{{year}}', date('Y'), $footerTemplate);
|
||||
$this->website = str_replace('{{footer}}', $footer, $this->website);
|
||||
}
|
||||
|
||||
protected function showInputField(array $errors, string $inputType, string $fieldName, int $fieldLength): void {
|
||||
@@ -184,7 +187,7 @@ class Renderer {
|
||||
}
|
||||
|
||||
protected function renderForm(): string {
|
||||
$form = '<form method="post" action="' . $this->getUrl() . '" enctype="' . $this->encType . '"><table class="form">';
|
||||
$form = '<form method="post" action="' . str_replace('.php', '', $this->getUrl()) . '" enctype="' . $this->encType . '"><table class="form">';
|
||||
$label = '';
|
||||
$input = '';
|
||||
$error = '';
|
||||
@@ -458,7 +461,12 @@ class Renderer {
|
||||
$mail->addStringAttachment($attachment['content'], $fileName, 'base64', $attachment['type']);
|
||||
|
||||
}
|
||||
$mail->send();
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
error_log('Mailversand fehlgeschlagen: ' . $e->getMessage());
|
||||
$this->errors[] = 'Die Bestätigungs-Email konnte nicht versendet werden. Bitte versuchen Sie es später erneut oder kontaktieren Sie uns direkt.';
|
||||
}
|
||||
}
|
||||
|
||||
protected function connectToImap($folder = ''): bool {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<?php
|
||||
// Temporäre Fehlerausgabe und Logging für Debugzwecke
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('error_reporting', (string)E_ALL);
|
||||
ini_set('error_log', __DIR__ . '/php-error.log');
|
||||
|
||||
if (isset($_REQUEST['q']) && substr($_REQUEST['q'], -4) === '.php') {
|
||||
$url = substr($_REQUEST['q'], 0, -4);
|
||||
header('Location: ' . $url, true, 301);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<h2>Nicht bearbeitete Anfragen</h2>
|
||||
<form action="accounts.php" method="post">
|
||||
<form action="accounts" method="post">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<footer>
|
||||
<span class="footer-copyright">(c) 2023 Verein der Freunde und Förderer der <a href="https://www.steffi-jones-schule.com" target="_blank">Steffi-Jones-Schule e.V.</a></span>
|
||||
<span class="footer-copyright">© {{year}} Verein der Freunde und Förderer der <a href="https://www.steffi-jones-schule.com" target="_blank">Steffi-Jones-Schule e.V.</a></span>
|
||||
<a href="imprint" class="footer-imprint">Impressum</a>
|
||||
</footer>
|
||||
|
||||
@@ -11,5 +11,5 @@ Tel: xxx-xxxxxxx
|
||||
</ul>
|
||||
<h2>Amtliche Informationen</h2>
|
||||
Registergericht: Amtsgericht Frankfurt a.M., Gerichtsstraße 2, 60313 Frankfurt am Main<br/>
|
||||
Vereinsregisternummer: <br/>
|
||||
Umsatzsteueridentifkationsnummer: <br/>
|
||||
Vereinsregisternummer: 13422<br/>
|
||||
Umsatzsteueridentifkationsnummer: 4525075625<br/>
|
||||
|
||||
@@ -19,6 +19,7 @@ $(document).ready(function() {
|
||||
return;
|
||||
}
|
||||
$("#shorttitle > option:not(:first-child)").remove();
|
||||
$("#projectoverview > tbody > tr").remove();
|
||||
response.list.forEach(function(item) {
|
||||
let newItem = $("<option></option>");
|
||||
newItem.attr("id", item.id);
|
||||
@@ -26,7 +27,17 @@ $(document).ready(function() {
|
||||
if (item.id == response.id) {
|
||||
newItem.attr("selected", "selected");
|
||||
}
|
||||
let newRow = $('<tr><td>' + item.title + '</td></tr>');
|
||||
let selectElement = $('<select name="project_type" data="' + item.id + '"></select>');
|
||||
for (let typeId in response.types) {
|
||||
if (response.types.hasOwnProperty(typeId)) {
|
||||
let option = $('<option value="' + typeId + '"' + (typeId == item.project_type_id ? ' selected' : '') + '>' + response.types[typeId] + '</option>');
|
||||
selectElement.append(option);
|
||||
}
|
||||
}
|
||||
newRow.append('<td>' + selectElement.prop('outerHTML') + '</td>');
|
||||
$("#shorttitle").append(newItem);
|
||||
$("#projectoverview > tbody").append(newRow);
|
||||
});
|
||||
}).fail(function(response) {
|
||||
alert(response);
|
||||
|
||||
Reference in New Issue
Block a user