Compare commits

...
17 Commits
Author SHA1 Message Date
Bruno Eckhardt 52446cc019 fixes 2026-07-07 10:07:22 +02:00
Bruno Eckhardt 771f9e7bf6 fix UTF8 formating and right timestamp in DB when updated 2026-07-07 09:05:38 +02:00
Tower a066c59576 client ip changes 2026-07-06 22:30:24 +02:00
Tower 388f9b8f0d add termin mailing 2026-07-06 22:26:26 +02:00
Tower b08857a4cd delete comments and change some words 2026-07-06 21:51:40 +02:00
Tower 6d68fbc25d fix format and delete option 2026-07-06 20:39:21 +02:00
Bruno Eckhardt dceb02a3de fixes 2026-07-06 15:51:27 +02:00
Bruno Eckhardt cd325270f0 add new calender / termine service 2026-07-06 15:18:11 +02:00
Bruno Eckhardt efa9584baf hotfix 2026-07-06 14:33:32 +02:00
Bruno Eckhardt ac202be4a7 add includes 2026-07-06 14:25:06 +02:00
Bruno Eckhardt 24e11e14a3 fix logout error logging 2026-07-06 14:21:53 +02:00
Bruno Eckhardt 5305fcabb6 logout fix 2026-07-06 14:13:33 +02:00
Bruno Eckhardt 3f7c840c39 style fixes 2026-07-06 13:50:12 +02:00
Bruno Eckhardt 378c462b1c new einkaufslisten service 2026-07-06 13:40:55 +02:00
Bruno Eckhardt 5f1aa1c6fc mobile optimizing 2026-07-06 08:47:33 +02:00
Bruno Eckhardt 5ac4fa4ac6 add showing entries and delete option 2026-07-06 08:40:00 +02:00
Bruno Eckhardt 3eb451069b delete wrong letter 2026-07-06 08:22:44 +02:00
11 changed files with 572 additions and 21 deletions

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
<?php
include_once(__DIR__ . "/../controller/DatabaseController.php");
include_once(__DIR__ . "/../modules/Mail.php");
date_default_timezone_set("Europe/Berlin");
$jetzt = new DateTime();
$heute = $jetzt->format("Y-m-d");
// Alle heutigen Termine laden
$termine = DatabaseShow(
"Termine",
"*",
"DATUM = ? AND ERINNERUNG_AM IS NULL",
$heute
);
foreach ($termine as $termin) {
$terminZeit = new DateTime($termin["DATUM"] . " " . $termin["ZEIT"]);
$sekundenBisTermin = $terminZeit->getTimestamp() - $jetzt->getTimestamp();
// Nur Termine innerhalb der nächsten 30 Minuten
if ($sekundenBisTermin > 0 && $sekundenBisTermin <= 1800) {
// Benutzer laden
$benutzer = DatabaseShow(
"Benutzer",
"*",
"NAME = ?",
$termin["ERSTELLT_VON"]
);
if (empty($benutzer)) {
continue;
}
$benutzer = $benutzer[0];
if (empty($benutzer["EMAIL"])) {
continue;
}
$subject = "Terminerinnerung";
$message = "Hallo {$benutzer["NAME"]},\n\n";
$message .= "Du hast in weniger als 30 Minuten einen Termin.\n\n";
$message .= "Termin: {$termin["NAME"]}\n";
$message .= "Datum: {$termin["DATUM"]}\n";
$message .= "Uhrzeit: {$termin["ZEIT"]}\n";
if (!empty($termin["NOTIZ"])) {
$notizClean = mb_convert_encoding($termin["NOTIZ"], "UTF-8", "auto");
$message .= "Notiz: {$notizClean}\n";
}
sendMail(
$subject,
$message,
$_SERVER['SCRIPT_NAME'] ?? 'CLI/Unbekannt',
true,
$benutzer["EMAIL"],
);
print_r("{$benutzer["EMAIL"]}\n{$message}");
DatabaseUpdate(
"Termine",
"ERINNERUNG_AM = ?",
"ID = ?",
date('d-m-Y H:i:s'),
$termin["ID"]
);
}
}
+18 -4
View File
@@ -16,8 +16,10 @@ $serviceGroups = array (
'services' =>
array (
0 => 'home_info',
1 => 'links',
2 => 'vergabe'
1 => 'vergabe',
2 => 'links',
3 => 'einkaufsliste',
4 => 'termine',
),
),
'Ausbildung' =>
@@ -78,7 +80,7 @@ $services = array (
'active' => true,
'adminOnly' => false,
),
'vergabe' =>
'vergabe' =>
array (
'name' => 'Vergabe',
'active' => true,
@@ -192,6 +194,18 @@ $services = array (
'active' => true,
'adminOnly' => false,
),
'einkaufsliste' =>
array (
'name' => 'Einkaufsliste',
'active' => true,
'adminOnly' => false,
),
'termine' =>
array (
'name' => 'Termine',
'active' => true,
'adminOnly' => false,
),
);
$linkGroups = array (
@@ -382,4 +396,4 @@ $linkButtons = array (
'adminOnly' => false,
'group' => 'tools',
),
);
);
+10 -6
View File
@@ -117,16 +117,20 @@ class getSpecificData {
}
}
public function getClientIP(): string {
public function getClientIP(): string
{
if (PHP_SAPI === 'cli') {
return 'CLI';
}
$xff = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? null;
if ($xff) {
if (!empty($xff)) {
$ips = array_map('trim', explode(',', $xff));
$clientIp = $ips[0];
return $clientIp;
} else {
return $_SERVER['REMOTE_ADDR'];
return $ips[0];
}
return $_SERVER['REMOTE_ADDR'] ?? 'UNKNOWN';
}
public function getRequestTime(): string {
+23 -1
View File
@@ -1,3 +1,25 @@
<?php
include_once(__DIR__ . '/modules/Mail.php');
include_once(__DIR__ . '/controller/DataController.php');
session_destroy();
try {
session_start();
$_SESSION = array();
session_destroy();
http_response_code(200);
exit();
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['error' => 'An error occurred while logging out.']);
sendMail(
"[ERROR] Logout",
"$e",
(new getSpecificData())->getRequestURL(),
true,
);
exit();
}
+1 -1
View File
@@ -27,7 +27,7 @@ document.querySelectorAll('.group-title').forEach(title => {
const logoutButton = document.getElementById('logoutButton');
logoutButton.addEventListener('click', () => {
fetch('services/logout.php', { method: 'POST' })
fetch('logout', { method: 'POST' })
.then(() => {
window.location.href = 'login.php';
});
+8 -5
View File
@@ -3,10 +3,11 @@
include_once __DIR__ . '/../controller/DatabaseController.php';
include_once __DIR__ . '/../controller/DataController.php';
function sendMail($subject, $message, $url, bool $log) {
function sendMail($subject, $message, $url, bool $log, $to = "bruno.eckhardt07 qmail.com")
{
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
mail(
"bruno.eckhardt07@gmail.com",
$to,
$subject,
$message,
$headers
@@ -14,17 +15,19 @@ function sendMail($subject, $message, $url, bool $log) {
if ($log == true) {
DatabaseInsert(
"Mailing",
"DATUM, SUBJECT, MESSAGE, URL, CLIENT_IP",
"DATUM, SUBJECT, MESSAGE, MAIL_AN, URL, CLIENT_IP",
(new getSpecificData())->getRequestTime(),
$subject,
$message,
$to,
$url,
(new getSpecificData())->getClientIP(),
);
}
}
function errorMail($title, $error, bool $log) {
function errorMail($title, $error, bool $log)
{
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
mail(
"bruno.eckhardt07@gmail.com",
@@ -42,4 +45,4 @@ function errorMail($title, $error, bool $log) {
(new getSpecificData())->getClientIP(),
);
}
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ $count = is_array($displayData) ? count($displayData) : 0;
<div class="main">
<div class="content">
<h2 style="display: flex; justify-content: space-between; align-items: center;">
<span>📊 Berichtte-Vorschau:</span>
<span>📊 Berichte-Vorschau:</span>
<div>
<a href="?service=<?= $selectedService ?>&mode=fk">
+91
View File
@@ -0,0 +1,91 @@
<?php
include_once __DIR__ . '/../controller/DatabaseController.php';
include_once __DIR__ . '/../controller/RoutesController.php';
$view = $_GET['view'] ?? 'show';
$selectedService = $_GET['service'] ?? null;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_entry'])) {
$artikel = $_POST['artikel'];
$menge = $_POST['menge'];
DatabaseInsert(
"Einkaufsliste",
"PRODUKT, MENGE",
$artikel,
$menge
);
redirectToWebsite((new getSpecificData())->getReferer());
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_entry'])) {
$id = $_POST['id'];
DatabaseDelete("Einkaufsliste", "ID = ?", $id);
redirectToWebsite((new getSpecificData())->getReferer());
exit;
}
$entries = DatabaseShow(
"Einkaufsliste"
);
?>
<div>
<div class="vergabe-form">
<form method="POST" class="vergabe-grid">
<div class="form-group">
<label>Artikel</label>
<input type="text" name="artikel" required>
</div>
<div class="form-group">
<label>Menge</label>
<input type="text" name="menge" required>
</div>
<button type="submit" name="add_entry" class="btn-submit-vergabe">
💾 Speichern
</button>
</form>
</div>
<div class="table-container" style="margin-top: 30px;">
<h3>Einkaufsliste</h3>
<?php if (!empty($entries)): ?>
<table class="db-table mobile-responsive-table">
<thead>
<tr>
<th>Artikel</th>
<th>Menge</th>
<th style="width: 100px;">Aktion</th>
</tr>
</thead>
<tbody>
<?php foreach ($entries as $entry): ?>
<tr>
<td data-label="Artikel"><?= htmlspecialchars($entry['PRODUKT'] ?? '') ?></td>
<td data-label="Menge"><?= htmlspecialchars($entry['MENGE'] ?? '') ?></td>
<td data-label="Aktion">
<form method="POST" onsubmit="return confirm('Möchtest du diesen Eintrag wirklich löschen?');" style="margin: 0;">
<input type="hidden" name="id" value="<?= $entry['ID'] ?? '' ?>">
<button type="submit" name="delete_entry" class="btn-delete">
🗑️ Löschen
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Keine Einträge vorhanden.</p>
<?php endif; ?>
</div>
</div>
+227
View File
@@ -0,0 +1,227 @@
<?php
include_once(__DIR__ . '/../controller/DatabaseController.php');
include_once(__DIR__ . '/../controller/DataController.php');
$msg = "";
$username = $_SESSION['username'] ?? 'Gast';
if (isset($_GET['action']) && $_GET['action'] === 'delete') {
if (isset($_GET['serien_id']) && !empty($_GET['serien_id'])) {
$serienId = $_GET['serien_id'];
DatabaseDelete("Termine", "SERIEN_ID = ?", $serienId);
$msg = "Komplette Terminserie erfolgreich gelöscht!";
} elseif (isset($_GET['id'])) {
$deleteId = (int)$_GET['id'];
DatabaseDelete("Termine", "ID = ?", $deleteId);
$msg = "Termin erfolgreich gelöscht!";
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_termin'])) {
$datum = $_POST['datum'] ?? '';
$zeit = $_POST['zeit'] ?? '';
$name = $_POST['name'] ?? '';
$notiz = $_POST['notiz'] ?? '';
$wiederholung = $_POST['wiederholung'] ?? 'none';
$enddatum = $_POST['enddatum'] ?? '';
if (!empty($datum) && !empty($zeit) && !empty($name)) {
if ($wiederholung !== 'none' && !empty($enddatum)) {
$currentDate = new DateTime($datum);
$endDate = new DateTime($enddatum);
if ($endDate < $currentDate) {
$msg = "Das Enddatum darf nicht vor dem Startdatum liegen.";
} else {
$insertedCount = 0;
$serienId = uniqid('serie_', true);
$intervalMapping = [
'daily' => '+1 day',
'weekly' => '+1 week',
'monthly' => '+1 month'
];
$modifier = $intervalMapping[$wiederholung] ?? null;
if ($modifier) {
while ($currentDate <= $endDate) {
DatabaseInsert(
"Termine",
"DATUM, ZEIT, NAME, NOTIZ, ERSTELLT_VON, SERIEN_ID, INTERVALL, SERIEN_ENDE",
$currentDate->format('Y-m-d'),
$zeit,
$name,
$notiz,
$username,
$serienId,
$wiederholung,
$enddatum
);
$insertedCount++;
$currentDate->modify($modifier);
}
$msg = "Serientermin ($insertedCount Termine) erfolgreich eingetragen!";
}
}
} else {
DatabaseInsert(
"Termine",
"DATUM, ZEIT, NAME, NOTIZ, ERSTELLT_VON",
$datum,
$zeit,
$name,
$notiz,
$username
);
$msg = "Termin erfolgreich eingetragen!";
}
} else {
$msg = "Bitte alle Pflichtfelder ausfüllen.";
}
}
$termine = DatabaseShow(
"Termine",
"MAX(ID) as ID, MIN(DATUM) as DATUM, ZEIT, NAME, NOTIZ, ERSTELLT_VON, SERIEN_ID, INTERVALL, SERIEN_ENDE",
"ERSTELLT_VON = ? GROUP BY IFNULL(SERIEN_ID, ID) ORDER BY DATUM ASC, ZEIT ASC",
$username
);
$intervallNamen = [
'daily' => 'Täglich',
'weekly' => 'Wöchentlich',
'monthly' => 'Monatlich'
];
?>
<?php if (!empty($msg)): ?>
<div class="status-msg"><?= htmlspecialchars($msg) ?></div>
<?php endif; ?>
<div class="form-container">
<h3>📅 Neuen Termin vergeben</h3>
<form method="POST" class="vergabe-form">
<div class="vergabe-grid">
<div class="form-group">
<label for="datum">Start-Datum *</label>
<input type="date" id="datum" name="datum" required>
</div>
<div class="form-group">
<label for="zeit">Uhrzeit *</label>
<input type="time" id="zeit" name="zeit" required
style="width:100%; padding:10px; border-radius:5px; border:1px solid var(--input-border); background:var(--input-bg); color:var(--input-text);">
</div>
<div class="form-group">
<label for="name">Name / Zweck *</label>
<input type="text" id="name" name="name" placeholder="z.B. Kundentermin" required>
</div>
<div class="form-group">
<label for="notiz">Notiz (Optional)</label>
<input type="text" id="notiz" name="notiz" placeholder="Details zum Termin...">
</div>
<div class="form-group">
<label for="wiederholung">Wiederholung</label>
<select id="wiederholung" name="wiederholung" onchange="toggleEnddatum()"
style="width:100%; padding:10px; border-radius:5px; border:1px solid var(--input-border); background:var(--input-bg); color:var(--input-text);">
<option value="none">Keine Wiederholung</option>
<option value="daily">Täglich</option>
<option value="weekly">Wöchentlich</option>
<option value="monthly">Monatlich</option>
</select>
</div>
<div class="form-group" id="enddatum-group" style="display: none;">
<label for="enddatum">Wiederholen bis *</label>
<input type="date" id="enddatum" name="enddatum">
</div>
<button type="submit" name="add_termin" class="btn-submit-vergabe">Speichern</button>
</div>
</form>
</div>
<div class="form-container">
<h3>📋 Aktuelle Terminbelegungen</h3>
<div class="table-container">
<table class="db-table mobile-responsive-table">
<thead>
<tr>
<th>Datum / Turnus</th>
<th>Uhrzeit</th>
<th>Termin / Name</th>
<th>Notiz</th>
<th>Eingetragen von</th>
<th>Aktion</th>
</tr>
</thead>
<tbody>
<?php if (empty($termine)): ?>
<tr>
<td colspan="6" style="text-align: center; padding: 20px;">Keine Termine eingetragen.</td>
</tr>
<?php else: ?>
<?php foreach ($termine as $termin): ?>
<?php
$dateFormatted = date('d.m.Y', strtotime($termin['DATUM']));
$timeFormatted = date('H:i', strtotime($termin['ZEIT']));
$istSerie = !empty($termin['SERIEN_ID']);
?>
<tr>
<td data-label="Datum:">
<strong><?= htmlspecialchars($dateFormatted) ?></strong>
<?php if ($istSerie): ?>
<br>
<small style="color: var(--primary-color, #007bff); font-style: italic;">
(<?= $intervallNamen[$termin['INTERVALL']] ?? '' ?>
bis <?= date('d.m.Y', strtotime($termin['SERIEN_ENDE'])) ?>)
</small>
<?php endif; ?>
</td>
<td data-label="Uhrzeit:"><?= htmlspecialchars($timeFormatted) ?></td>
<td data-label="Termin / Name:">
<strong><?= htmlspecialchars($termin['NAME']) ?></strong>
<?php if ($istSerie): ?>
<span
style="font-size: 0.8em; background: #e1f5fe; color: #0288d1; padding: 2px 6px; border-radius: 10px; margin-left: 5px;">Wiederholend</span>
<?php endif; ?>
</td>
<td data-label="Notiz:"><?= htmlspecialchars($termin['NOTIZ'] ?: '-') ?></td>
<td data-label="Von:"><span class="badge"><?= htmlspecialchars($termin['ERSTELLT_VON']) ?></span>
</td>
<td data-label="Aktion:">
<?php if ($istSerie): ?>
<a href="?service=termine&action=delete&serien_id=<?= urlencode($termin['SERIEN_ID']) ?>"
onclick="return confirm('Möchtest du die GESAMTE Terminserie löschen?');">
<button class="btn-delete" style="background-color: #d32f2f;">löschen</button>
</a>
<?php else: ?>
<a href="?service=termine&action=delete&id=<?= $termin['ID'] ?>"
onclick="return confirm('Möchtest du diesen Termin wirklich löschen?');">
<button class="btn-delete">Löschen</button>
</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<script>
function toggleEnddatum() {
var wiederholung = document.getElementById('wiederholung').value;
var enddatumGroup = document.getElementById('enddatum-group');
var enddatumInput = document.getElementById('enddatum');
if (wiederholung !== 'none') {
enddatumGroup.style.display = 'block';
enddatumInput.required = true;
} else {
enddatumGroup.style.display = 'none';
enddatumInput.required = false;
enddatumInput.value = '';
}
}
</script>
+51
View File
@@ -25,6 +25,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_entry'])) {
redirectToWebsite((new getSpecificData())->getReferer());
exit;
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_entry'])) {
$id = $_POST['id'];
DatabaseDelete("Vergabe", "ID = ?", $id);
redirectToWebsite((new getSpecificData())->getReferer());
exit;
}
$entries = DatabaseShow(
"Vergabe"
);
?>
<div class="arbeitsberichte-wrapper">
@@ -57,4 +71,41 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_entry'])) {
</form>
</div>
<div class="table-container" style="margin-top: 30px;">
<h3>Aktuelle Vergaben</h3>
<?php if (!empty($entries)): ?>
<table class="db-table mobile-responsive-table">
<thead>
<tr>
<th>Was</th>
<th>Wer</th>
<th>Wann ausgeliehen</th>
<th>Rückgabe</th>
<th style="width: 100px;">Aktion</th>
</tr>
</thead>
<tbody>
<?php foreach ($entries as $entry): ?>
<tr>
<td data-label="Was"><?= htmlspecialchars($entry['WAS'] ?? '') ?></td>
<td data-label="Wer"><?= htmlspecialchars($entry['WER'] ?? '') ?></td>
<td data-label="Wann"><?= htmlspecialchars($entry['WANN'] ?? '') ?></td>
<td data-label="Rückgabe"><?= htmlspecialchars($entry['RUECKGABE'] ?? '') ?></td>
<td data-label="Aktion">
<form method="POST" onsubmit="return confirm('Möchtest du diesen Eintrag wirklich löschen?');" style="margin: 0;">
<input type="hidden" name="id" value="<?= $entry['ID'] ?? '' ?>">
<button type="submit" name="delete_entry" class="btn-delete">
🗑️ Löschen
</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Keine Einträge vorhanden.</p>
<?php endif; ?>
</div>
</div>
+66 -3
View File
@@ -981,7 +981,7 @@ body.dark-mode .info-value {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
table-layout: fixed;
/* table-layout: fixed; */
/* sorgt für feste Spaltenbreite */
}
@@ -997,9 +997,9 @@ body.dark-mode .info-value {
border-bottom: 1px solid var(--card-border);
/* Wichtig für gleiche Größe */
overflow: hidden;
/* overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
white-space: nowrap; */
}
.db-table tr:hover {
@@ -1217,4 +1217,67 @@ body.dark-mode input[type="date"] {
padding: 10px;
height: auto;
}
}
/* ===== Mobile Optimierung für die Vergabe-Tabelle ===== */
@media (max-width: 768px) {
/* Verstecke die normale Tabellen-Überschrift */
.mobile-responsive-table thead {
display: none;
}
/* Mache aus der Tabelle ein Block-Layout */
.mobile-responsive-table,
.mobile-responsive-table tbody,
.mobile-responsive-table tr,
.mobile-responsive-table td {
display: block;
width: 100% !important;
}
/* Jede Zeile wird zu einer schicken Card */
.mobile-responsive-table tr {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 8px;
margin-bottom: 15px;
padding: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
/* Einzelne Zellen nebeneinander/untereinander stylen */
.mobile-responsive-table td {
text-align: right !important;
padding: 8px 10px !important;
border-bottom: 1px solid var(--card-border);
position: relative;
white-space: normal !important;
/* Erlaubt Textumbruch auf Handys */
overflow: visible !important;
}
.mobile-responsive-table td:last-child {
border-bottom: none;
padding-top: 12px !important;
}
/* Die Beschriftung (z.B. "Was:") links einblenden */
.mobile-responsive-table td::before {
content: attr(data-label);
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
font-weight: bold;
font-size: 0.9rem;
color: var(--text);
}
/* Lösch-Button auf Mobile über die gesamte Breite strecken für leichtere Bedienung */
.mobile-responsive-table .btn-delete {
width: 100%;
padding: 10px;
font-size: 1rem;
}
}