- 01-architektur: Cron-Aufgaben (Bewertungsmail, Jahresarchiv), storage/exports, Aufbewahrungsregeln ohne/mit Rechnung, neue Konfigschlüssel. - 02-objekte-klassen-methoden: ER-Modell (deposit_amount_cents, document_signatures, review_mail_log), Tabellen, Funktionszahlen (407), neue Module app/export.php und Mail-/Signatur-/Kaution-Helfer. - 03-use-cases: Rollen der Unterschrift, UC-34 Übergabe/Rückgabe quittieren, UC-35 Jahresarchiv, Ablaufskizzen für Unterschrift und Cron ergänzt. - 04-routen-und-views: /admin/export, sign?role=…, ?from=<id>, Views und Rechte. - architecture.md und dsgvo.md: Datenmodell, Aufbewahrung, Bewertungsmail. - Anleitung (views/manual.php): Löschfristen korrigiert (30 Tage bzw. 8 Jahre für den Mietvertrag bei Rechnung).
471 lines
23 KiB
Markdown
471 lines
23 KiB
Markdown
# Objekte, Klassen und Methoden
|
||
|
||
Die Codebasis ist **prozedural**: Es gibt keine ORM-Entities und nur zwei echte
|
||
Klassen (`PdfDoc`, `WebPush`). „Objekte“ sind daher (a) Datenbanktabellen,
|
||
(b) assoziative Arrays, die durch die Module gereicht werden, (c) Datei- und
|
||
Storage-Objekte sowie (d) die beiden Klassen. Funktionsnamen sind global und
|
||
mit Modulpräfix (`booking_*`, `document_*`, `mailing_*`, …), damit `rg` sie
|
||
eindeutig findet.
|
||
|
||
## 1. Datenobjekte (Datenbank)
|
||
|
||
ER-Modell der Kernbeziehungen (alle Tabellen außer `schema_migrations`):
|
||
|
||
```mermaid
|
||
erDiagram
|
||
TRAILERS ||--o{ BOOKINGS : "anhänger"
|
||
EMPLOYEES ||--o{ BOOKINGS : "übergabe"
|
||
EMPLOYEES ||--o{ BOOKINGS : "rücknahme"
|
||
EMPLOYEES ||--o{ ABSENCES : "abwesend"
|
||
USERS ||--o{ AUTH_TOKENS : "sitzung"
|
||
USERS ||--o{ USER_INVITES : "einladung"
|
||
USERS ||--o{ PUSH_SUBSCRIPTIONS : "gerät"
|
||
USERS ||--o{ MAILINGS : "erstellt"
|
||
USERS }o--|| EMPLOYEES : "employee_id"
|
||
DEPOSIT_ACCOUNTS ||--o{ BOOKINGS : "kaution"
|
||
BOOKINGS ||--o{ BOOKING_DOCUMENTS : "unterlagen"
|
||
BOOKINGS ||--o{ REMINDER_DONE : "erledigt"
|
||
BOOKINGS ||--o{ REMINDER_MAIL_LOG : "mail"
|
||
BOOKINGS ||--o{ REMINDER_PUSH_LOG : "push"
|
||
BOOKINGS ||--o{ PAYMENT_REMINDER_LOG : "zahlung"
|
||
MAILINGS ||--o{ MAILING_RECIPIENTS : "empfänger"
|
||
|
||
BOOKINGS {
|
||
bigint id PK
|
||
bigint trailer_id FK
|
||
bigint employee_id FK
|
||
bigint return_employee_id FK
|
||
date start_date
|
||
date end_date
|
||
time start_time
|
||
time end_time
|
||
enum kind
|
||
enum status
|
||
enum balance_method
|
||
int deposit_cents
|
||
int deposit_amount_cents
|
||
int total_cents
|
||
bigint deposit_account_id FK
|
||
varchar customer_name
|
||
varchar email
|
||
tinyint invoice
|
||
}
|
||
BOOKING_DOCUMENTS {
|
||
bigint id PK
|
||
bigint booking_id FK
|
||
enum kind
|
||
varchar variant
|
||
varchar stored_file
|
||
char sign_token
|
||
varchar signed_via
|
||
datetime signed_at
|
||
datetime mailed_at
|
||
enum source
|
||
}
|
||
DOCUMENT_SIGNATURES {
|
||
bigint id PK
|
||
bigint document_id FK
|
||
enum role
|
||
varchar signature_file
|
||
datetime signed_at
|
||
varchar signed_via
|
||
bigint signed_by FK
|
||
}
|
||
REVIEW_MAIL_LOG {
|
||
bigint id PK
|
||
bigint booking_id FK
|
||
varchar sent_to
|
||
datetime sent_at
|
||
}
|
||
USER_INVITES {
|
||
bigint id PK
|
||
bigint user_id FK
|
||
char token_hash
|
||
datetime expires_at
|
||
datetime used_at
|
||
}
|
||
PUSH_SUBSCRIPTIONS {
|
||
bigint id PK
|
||
bigint user_id FK
|
||
varchar endpoint
|
||
char endpoint_hash
|
||
varchar p256dh
|
||
varchar auth
|
||
}
|
||
```
|
||
|
||
### Tabelle der Tabellen
|
||
|
||
| Tabelle | Inhalt | Beziehungen | Modul |
|
||
| --- | --- | --- | --- |
|
||
| `trailers` | Kühlanhänger (Label, Farbe, Sortierung, aktiv) | 1:n zu Buchungen | `data.php` |
|
||
| `employees` | Mitarbeiter für Übergabe/Rücknahme | 1:n zu Buchungen, Abwesenheiten | `data.php` |
|
||
| `users` | Konten (Name, E-Mail, `role` admin/user, `status`, `employee_id`, `auth_epoch`) | 1:n Tokens, Einladungen, Push; 1:1 Mitarbeiter optional | `auth.php`, `admin.php` |
|
||
| `deposit_accounts` | Bankkonten für Kaution | 1:n zu Buchungen | `documents.php` |
|
||
| `bookings` | Mietvorgang: Zeitraum, Zeiten, Anhänger, Mitarbeiter, Kunde, Preise, Kaution (`deposit_amount_cents`, 0 = keine), Status | n:1 zu Anhänger/Mitarbeiter/Konto | `data.php` |
|
||
| `booking_documents` | erzeugte Unterlagen (Art, Variante, Datei, Unterschriftslink, `signature_file`/`signed_at` = Rolle `customer`) | n:1 Buchung | `documents.php` |
|
||
| `reminder_done` | erledigte Erinnerung je `(booking_id, kind, due_date)` | n:1 Buchung | `data.php`, `pages.php` |
|
||
| `reminder_mail_log` | versendete E-Mail-Erinnerungen | n:1 Buchung | `mail.php` |
|
||
| `reminder_push_log` | versendete Push-Erinnerungen | n:1 Buchung | `push.php` |
|
||
| `payment_reminder_log` | versendete Zahlungserinnerungen | n:1 Buchung | `mail.php` |
|
||
| `review_mail_log` | versendete Bewertungsmails (eine je Buchung, Migration 022) | n:1 Buchung | `mail.php` |
|
||
| `document_signatures` | Unterschriften je Unterlage mit Rolle `handover`/`customer`/`return` (Migration 021; alte Werte aus `booking_documents.signature_file` übernommen) | n:1 Unterlage | `documents.php` |
|
||
| `auth_tokens` | Remember-Me-Tokens (Selector + Hash, Ablauf) | n:1 Benutzer | `auth.php` |
|
||
| `user_invites` | Einladungslinks (Hash, Ablauf, genutzt) | n:1 Benutzer | `invite.php` |
|
||
| `login_attempts` | Fehlversuche für Throttling (IP + Namensschlüssel) | – | `auth.php` |
|
||
| `push_subscriptions` | Web-Push-Geräte (Endpoint, Schlüssel) | n:1 Benutzer | `push.php` |
|
||
| `absences` | Urlaub/Krankheit/Sonstiges je Mitarbeiter | n:1 Mitarbeiter | `data.php` |
|
||
| `booking_documents` | erzeugte/hochgeladene Unterlagen, Signatur- und Versandstatus | n:1 Buchung | `documents.php` |
|
||
| `mail_optouts` | gesperrte E-Mail-Adressen für Mailings | – | `mailing.php` |
|
||
| `mailings` | E-Mail-Aussendung (Betreff, Text, Zähler) | 1:n Empfänger | `mailing.php` |
|
||
| `mailing_recipients` | Empfängerstatus je Mailing (`pending`/`sent`/`failed`) | n:1 Mailing | `mailing.php` |
|
||
| `schema_migrations` | angewendete Migrationen | – | `migrate.php` |
|
||
|
||
Schema: [`../../sql/schema.sql`](../../sql/schema.sql), Migrationen:
|
||
[`../../sql/migrations/`](../../sql/migrations/). `install.php` legt das
|
||
Basisschema an; `/cron/migrate` bzw. `/migrate` wendet Neuerungen an.
|
||
|
||
### Assoziative Arrays als „Value Objects“
|
||
|
||
- **Buchung** (`booking_find`, `booking_list`): alle Spalten von `bookings`
|
||
plus Join-Felder `trailer_label`, `trailer_color`, `employee_name`,
|
||
`return_employee_name`, `deposit_account_label`. Erzeugung/Prüfung über
|
||
`booking_input()` und `booking_validate()` (Rückgabe: Fehlerarray).
|
||
- **Unterlage** (`document_find`, `documents_for_booking`): Spalten von
|
||
`booking_documents` plus `sign_url`, Datumsformate.
|
||
- **Benutzer** (`auth_user`): `users`-Zeile plus `employee_name`.
|
||
- **Erinnerung** (`reminder_list`): berechnetes Array mit `booking_id`, `kind`,
|
||
`due_date`, `label`, `short`, `done`, `employee_id`, Buchungsdaten.
|
||
- **Zeitgeometrie** (`calendar_geometry`, `calendar_lanes`): berechnete
|
||
Kalenderbalken (Start-/Endspalte, Lane, Farbe) – keine DB-Tabelle.
|
||
|
||
### Konstanten und feste Objekttypen
|
||
|
||
| Konstante | Werte | Modul |
|
||
| --- | --- | --- |
|
||
| `DOCUMENT_KIND_*` | `contract`, `confirmation`, `invoice`, `reminder` | `documents.php` |
|
||
| `document_variants()` | `delivery`, `pickup`, `chest` | `documents.php` |
|
||
| `reminder_kinds()` | `start_8`, `start_1`, `end_1` | `data.php` |
|
||
| `REMINDER_SEND_MIN_AGE_MINUTES` | 60 (Mindestalter für Versand) | `data.php` |
|
||
| `bookings.status` | `active`, `cancelled` | Schema |
|
||
| `bookings.kind` | `pickup`, `delivery` | Schema |
|
||
| `bookings.balance_method` | `cash`, `transfer` | Schema |
|
||
| `users.role` | `admin`, `user` | Schema |
|
||
|
||
## 2. Klassen
|
||
|
||
### `PdfDoc` – PDF-Erzeugung ohne Bibliothek
|
||
|
||
`app/pdf.php`. A4-Seiten mit Text, Linien, Rechtecken und Bildern
|
||
(PNG/JPEG inkl. eigener Dekodierung), Koordinaten von oben.
|
||
|
||
```mermaid
|
||
classDiagram
|
||
class PdfDoc {
|
||
+float A4_W
|
||
+float A4_H
|
||
-array W_REGULAR
|
||
-array W_BOLD
|
||
-int pageNo
|
||
+__construct(width, height)
|
||
+pageWidth() float
|
||
+pageHeight() float
|
||
+pageNo() int
|
||
+newPage() void
|
||
+text(text, x, top, size, bold, align, maxWidth)
|
||
+measure(text, size, bold) float
|
||
+wrap(text, size, maxWidth, bold) array
|
||
+paragraph(text, x, top, size, leading, bold, align, maxWidth)
|
||
+line(x1, top1, x2, top2, lw) void
|
||
+rect(x, top, w, h, fill, lw) void
|
||
+image(file, x, top, w, h) bool
|
||
+output() string
|
||
-encode(text) string
|
||
-escape(encoded) string
|
||
-png_decode(data) array
|
||
-paeth(left, up, upLeft) int
|
||
-jpeg_size(data) array
|
||
}
|
||
```
|
||
|
||
| Methode | Zweck |
|
||
| --- | --- |
|
||
| `__construct`, `pageWidth`, `pageHeight`, `pageNo` | Seitenmaße und aktuelle Seite |
|
||
| `newPage` | neue A4-Seite beginnen |
|
||
| `text` | Text an Position, optional fett/zentriert/rechtsbündig, mit maximaler Breite |
|
||
| `measure`, `wrap`, `paragraph` | Textbreite messen, umbrechen, mehrzeiliger Absatz |
|
||
| `line`, `rect` | Linien und Rechtecke (Rahmen oder gefüllt) |
|
||
| `image` | PNG/JPEG einbetten (nutzt `png_decode`, `jpeg_size`) |
|
||
| `output` | fertiges PDF als String (für `file_put_contents`) |
|
||
| private Helfer | Font-Metriken, Base64/Filter, PNG-Zeilenfilter, OID-/PEM-Bausteine |
|
||
|
||
Verwendung: `document_contract_pdf()`, `document_confirmation_pdf()`,
|
||
`document_reminder_pdf()` in `documents.php`.
|
||
|
||
### `WebPush` – Web Push nach RFC 8291
|
||
|
||
`app/webpush.php`. Sendet verschlüsselte Push-Nachrichten mit VAPID-JWT an
|
||
Browser-Endpunkte; Schlüssel stammen aus der Config (`push.*`).
|
||
|
||
```mermaid
|
||
classDiagram
|
||
class WebPush {
|
||
+int TTL
|
||
+int RECORD_SIZE
|
||
+int TIMEOUT
|
||
+isConfigured() bool
|
||
+publicKey() string
|
||
+subject() string
|
||
+isValidEndpoint(endpoint) bool
|
||
+isValidKeyMaterial(p256dh, auth) bool
|
||
+send(subscription, payload) array
|
||
+encrypt(payload, p256dh, auth, salt, ephemeral) array
|
||
-privateKey() string
|
||
-headers(endpoint) array
|
||
-vapidJwt(audience, publicKey) string
|
||
-hkdfExpand(prk, info, length) string
|
||
-derToRaw(der) string
|
||
-privateKeyPem(scalar, point) string
|
||
-publicKeyPem(point) string
|
||
-ecOid() string
|
||
-curveOid() string
|
||
-pem(label, der) string
|
||
}
|
||
```
|
||
|
||
| Methode | Zweck |
|
||
| --- | --- |
|
||
| `isConfigured`, `publicKey`, `subject` | Verfügbarkeit und öffentliche VAPID-Daten für den Client |
|
||
| `send` | Push zustellen, HTTP-Status/Grund zurückgeben (Aufrufer protokolliert) |
|
||
| `encrypt` | Payload nach RFC 8291 (aes128gcm) verschlüsseln |
|
||
| `isValidEndpoint`, `isValidKeyMaterial` | Eingaben aus dem Browser prüfen |
|
||
| private Helfer | Schlüssel laden, VAPID-JWT signieren, HKDF, DER→Raw, PEM |
|
||
|
||
Fehlgeschlagene Abos werden in `push.php` über `push_mark_result()` und
|
||
`push_delete_subscription_row()` bereinigt (410/404 → löschen).
|
||
|
||
## 3. Funktionsmodule (Methoden der Anwendung)
|
||
|
||
407 globale Funktionen, verteilt auf:
|
||
|
||
| Modul | Anzahl | Verantwortung |
|
||
| --- | --- | --- |
|
||
| `app/documents.php` | 76 | Unterlagen, PDF-Inhalte, Kaution, Zahlungserinnerung, Signaturen |
|
||
| `app/util.php` | 68 | Config, Request/Response, Formatierung, Datum, Feiertage NRW |
|
||
| `app/data.php` | 62 | Buchungen, Anhänger, Mitarbeiter, Abwesenheiten, Erinnerungen, Kalender |
|
||
| `app/pages.php` | 45 | Routen der App, Rendering, Cron, JSON-APIs |
|
||
| `app/backup.php` | 25 | DB-Dump, Dateiarchiv, Rotation, Restore, Import |
|
||
| `app/auth.php` | 24 | Login, Session, Remember, Rollen/Rechte, Throttling |
|
||
| `app/mailing.php` | 20 | Empfänger, Opt-out, Mailings, Batch-Versand |
|
||
| `app/push.php` | 17 | Push-Abos, Versand, Protokoll, fällige Erinnerungen |
|
||
| `app/admin.php` | 19 | Verwaltungsrouten (inkl. Jahresexport) |
|
||
| `app/export.php` | 8 | Jahresarchiv der Mietverträge (ZIP/tar.gz) mit Buchungsdaten |
|
||
| `app/invite.php` | 9 | Einladungen und Konto-Provisionierung |
|
||
| `app/inquiry.php` | 8 | öffentliches Anfrageformular inkl. Throttling |
|
||
| `app/mail.php` | 11 | Mailtransport, Erinnerungs-, Zahlungserinnerungs- und Bewertungsversand, Signatur/Fuß |
|
||
| `app/legal.php` | 5 | Rechtstexte, öffentliche Rechtsseiten |
|
||
| `app/privacy.php` | 3 | Löschfristen, Cleanup, Log-Rotation |
|
||
| `app/migrate.php` | 3 | Migrationen anwenden |
|
||
| `app/agb.php` | 3 | AGB-Text und PDF-Blöcke |
|
||
| `app/db.php` | 1 | PDO-Singleton `db()` |
|
||
|
||
### `util.php` – Infrastruktur
|
||
|
||
- Config/HTTP: `config`, `is_https`, `security_headers`, `start_session`,
|
||
`redirect`, `url`, `asset`, `current_path`, `request_method`, `is_post`,
|
||
`wants_json`, `json_response`, `abort_page`, `safe_next`.
|
||
- Eingaben: `post_string`, `post_array`, `query_string`, `query_int`,
|
||
`csrf_token`, `csrf_field`, `csrf_valid`, `require_post`.
|
||
- Zeit: `today_iso`, `utc_now`, `utc_after`, `valid_date`, `date_obj`,
|
||
`add_days`, `days_between`, `week_start`, `month_start`, `month_end`,
|
||
`valid_time`, `normalize_time`, `fmt_*` (u. a. `fmt_date_weekday`,
|
||
`fmt_date_weekday_with_time`, `fmt_date_weekday_short`), `relative_day`, `greeting`.
|
||
- Kalender/Feiertage: `easter_sunday`, `holidays_nrw`, `holiday_name`,
|
||
`is_holiday`, `client_is_mobile`.
|
||
- Format: `fmt_money`, `parse_money`, `due_cents`, `contrast_color`, `initials`,
|
||
`truncate`, `e`, `e_attr`.
|
||
- Flashes: `flash`, `flash_pull`.
|
||
|
||
### `data.php` – Fachlogik Buchungen
|
||
|
||
- Stammdaten: `trailers_all`, `trailers_map`, `trailer_find`,
|
||
`trailer_is_chest`, `employees_all`, `employees_map`, `employee_find`,
|
||
`deposit_accounts` (in `documents.php`).
|
||
- Buchungen: `booking_find`, `booking_list`, `booking_search`,
|
||
`booking_conflicts`, `booking_validate`, `booking_input`, `booking_to_input`,
|
||
`booking_create`, `booking_update`, `booking_cancel`, `booking_restore`,
|
||
`booking_delete`, `booking_move`, `booking_lock_trailers`,
|
||
`booking_note_clean`.
|
||
- Anzeige/Text: `booking_copy_text`, `booking_kind_label`,
|
||
`booking_invoice_label`, `booking_employee_summary`,
|
||
`booking_employee_for_kind`, `booking_invoice_display`, `booking_item_label`
|
||
(„Kühlanhänger“/„Truhe“ ohne Nummer für Mailbetreffs).
|
||
- Kaution: `booking_deposit_default_cents` (Vorgabe aus
|
||
`app.document_deposit_cents`), `booking_deposit_amount` (Buchungswert, 0 = keine
|
||
Kaution). Die Kaution zählt nie zum offenen Betrag – sie wird bei der Übergabe
|
||
in bar hinterlegt.
|
||
- Abwesenheiten: `absence_list`, `absence_find`, `absence_bounds`,
|
||
`absence_validate`, `absence_save`, `absence_delete`,
|
||
`booking_absence_conflict`, `absence_conflict_message`.
|
||
- Verfügbarkeit: `availability_public_days`, `availability_level`.
|
||
- Erinnerungen: `reminder_kinds`, `booking_reminders`, `reminder_list`,
|
||
`reminder_done_map`, `reminder_done_key`, `reminder_open_count`,
|
||
`reminder_done_set`, `reminder_scope_employee`, `booking_scope_employee`,
|
||
`reminder_list_for_user`.
|
||
- Kalender: `calendar_lanes`, `calendar_geometry`, `booking_absent_hits`,
|
||
`next_booking_start`, `bookings_by_date`, `upcoming_handovers`,
|
||
`handover_count`, `booking_edge_overlaps`.
|
||
|
||
Zentrale Regeln: `booking_validate()` prüft Pflichtfelder, Zeitraum,
|
||
Anhänger-Konflikt und Abwesenheiten; `booking_conflicts()` liefert
|
||
Überschneidungen; `booking_lock_trailers()` serialisiert parallele Anlage.
|
||
|
||
### `documents.php` – Unterlagen und Geld
|
||
|
||
- Arten/Varianten: `document_kinds`, `document_kind_label`,
|
||
`document_variants`, `document_variant_label`, `document_variant_default`,
|
||
`document_texts`.
|
||
- Ablage: `documents_schema_ready`, `document_store_root`, `document_booking_dir`,
|
||
`documents_for_booking`, `document_find`, `document_path`,
|
||
`document_signature_path` (Altspalte `booking_documents`), `document_file_name`,
|
||
`documents_cleanup`, `document_retention_days`, `document_retention_text`.
|
||
Fristen: ohne Rechnung 30 Tage für alle Unterlagen, mit Rechnung 30 Tage außer
|
||
Mietvertrag (8 Jahre); Konfiguration `app.document_retention_days` mit
|
||
`with_invoice`/`without_invoice`.
|
||
- Erzeugen: `document_create`, `document_regenerate`, `document_render`,
|
||
`document_contract_pdf`, `document_confirmation_pdf`,
|
||
`document_reminder_pdf`.
|
||
- Layout-Bausteine: `document_pdf_footer`, `document_logo_path`,
|
||
`document_pdf_title`, `document_pdf_parties`, `document_pdf_heading`,
|
||
`document_pdf_rows`, `document_pdf_note`, `document_pdf_signatures`,
|
||
`document_delivery_address`, `document_subject_plain`, `document_subject_line`.
|
||
- Kaution/Konto: `deposit_accounts`, `deposit_account`, `deposit_account_label`,
|
||
`deposit_account_input`, `deposit_account_validate`, `deposit_account_create`,
|
||
`deposit_account_update`, `deposit_account_usage`, `deposit_account_delete`,
|
||
`deposit_due_working_days`, `deposit_due_date`.
|
||
- Vermieter-Unterschrift: `owner_signature_dir`, `owner_signature_path`,
|
||
`owner_signature_time`, `owner_signature_save`, `owner_signature_delete`.
|
||
- Rechnung/Zahlung: `booking_balance_transfer`, `booking_money_account`,
|
||
`booking_balance_due_date`, `document_reminder_days`,
|
||
`transfer_reminder_days`, `document_reminder_due_date`,
|
||
`document_reminder_account`, `document_reminder_amounts`.
|
||
- Unterschriftsrollen: `document_sign_roles`, `document_sign_role_label`,
|
||
`document_sign_role_short`, `document_sign_role_valid`,
|
||
`document_signatures_schema_ready`, `document_signatures`,
|
||
`document_signature_row`, `document_signature_file_path`.
|
||
- Signatur/ Versand: `document_save_signature` (Rollen `handover` = Mitarbeiter
|
||
bestätigt Zahlungseingang, `customer` = Kunde bestätigt Übernahme, `return` =
|
||
Kunde bestätigt Kautionsrückgabe), `document_absolute_url`,
|
||
`document_sign_link`, `document_find_by_sign_token`,
|
||
`document_request_signature`, `document_mail_signature_request`,
|
||
`document_mail_signed_copy`, `document_sign_by_customer`,
|
||
`document_upload_invoice`, `document_mail_to_customer`, `document_delete`.
|
||
|
||
### `auth.php` / `invite.php` – Zugang
|
||
|
||
- `auth.php`: `hash_password`, `password_needs_upgrade`, `auth_user`,
|
||
`auth_user_by_id`, `auth_login`, `auth_verify_login`, `auth_logout`,
|
||
`auth_clear_session`, `auth_require_login`, `auth_require_admin`,
|
||
`auth_is_locked_out`, `auth_record_failure`, `auth_find_by_name`,
|
||
`auth_name_key`, `auth_invalidate_sessions`, `auth_issue_remember`,
|
||
`auth_restore_from_remember`, `auth_forget_remember`, `auth_can_manage`,
|
||
`auth_can_create_booking`, `auth_can_edit_booking`,
|
||
`auth_can_cancel_booking`, `auth_employee_id`, `auth_reminder_badge`.
|
||
- `invite.php`: `invite_url`, `invite_create`, `invite_find`,
|
||
`invite_active_for_user`, `invite_provision`, `invite_mail_text`,
|
||
`invite_accept`, `invite_notice_set`, `invite_notice_take`.
|
||
|
||
### `pages.php` / `admin.php` – Routen
|
||
|
||
`pages.php`: `render_page`, `render_partial`, `render_standalone`,
|
||
`page_handle`, `health_check`, `availability_public_json`, `cron_reminders`,
|
||
`cron_backup`, `cron_migrate`, `page_login`, `page_invite`, `page_dashboard`,
|
||
`calendar_url`, `page_calendar`, `page_availability`, `booking_form_context`,
|
||
`form_values_from_input`, `page_booking_new`, `page_booking_edit`,
|
||
`booking_detail_context`, `page_booking_detail`, `page_booking_panel`,
|
||
`page_booking_cancel`, `page_booking_restore`, `page_booking_delete`,
|
||
`page_booking_move`, `booking_or_404`, `page_booking_documents_create`,
|
||
`page_booking_document_file`, `page_booking_document_action`,
|
||
`page_booking_document_invoice_upload`, `page_signature_public`,
|
||
`page_signature_public_pdf`, `api_availability`, `page_search`, `page_reminders`,
|
||
`page_absences`, `page_absence_delete`, `page_reminder_done`, `page_manual`,
|
||
`page_account`, `json_body`, `page_push_subscribe`, `page_push_unsubscribe`,
|
||
`page_push_test`.
|
||
|
||
`admin.php`: `admin_handle`, `admin_users_list`, `admin_user_form`,
|
||
`admin_user_invite`, `admin_user_delete`, `admin_employees`, `admin_trailers`,
|
||
`admin_reminders_send`, `admin_mailings`, `admin_mailing_detail`,
|
||
`admin_accounts`, `admin_backups`, `admin_backup_restore`,
|
||
`admin_backup_download`, `admin_year_export`, `admin_year_export_file`,
|
||
`admin_settings`, `admin_settings_signature`.
|
||
|
||
### Kommunikation – `mail.php`, `push.php`, `mailing.php`, `inquiry.php`
|
||
|
||
- `mail.php`: `mail_is_enabled`, `mail_send`, `mail_send_attachment`,
|
||
`mail_signature_block`, `mail_auto_hint` (Adressblock und
|
||
„bitte nicht antworten“ für alle Kundenmails), `reminder_mail_recipients`,
|
||
`reminder_send_due`, `payment_reminder_send_due`, `review_mail_days`,
|
||
`review_mail_url`, `review_mail_send_due` (Bewertungsmail nach der Rückgabe,
|
||
Protokoll in `review_mail_log`).
|
||
- `push.php`: `push_is_available`, `push_is_configured`,
|
||
`push_subscription_save`, `push_subscription_delete`,
|
||
`push_subscription_delete_all`, `push_subscription_count`,
|
||
`push_counts_by_user`, `push_last_update_by_user`,
|
||
`push_subscriptions_for_user`, `push_subscription_for_user_endpoint`,
|
||
`push_delete_subscription_row`, `push_mark_result`, `push_send_to_user`,
|
||
`push_users_for_employee`, `push_payload_for_reminder`, `push_dispatch_due`,
|
||
`push_send_test`.
|
||
- `mailing.php`: `mailing_recipients`, `mailing_optout_emails`,
|
||
`mailing_optout_count`, `mailing_is_optout`, `mailing_optout_add`,
|
||
`mailing_unsub_token`, `mailing_unsub_url`, `mailing_unsub_valid`,
|
||
`mailing_render`, `mailing_body_for`, `mailing_create`, `mailing_list`,
|
||
`mailing_find`, `mailing_pending_count`, `mailing_refresh_counts`,
|
||
`mailing_recipient_log`, `mailing_send_batch`, `mailing_send_test`,
|
||
`page_unsubscribe`, `mailing_template`.
|
||
- `inquiry.php`: `inquiry_recipient`, `inquiry_throttle_file`,
|
||
`inquiry_rate_limited`, `inquiry_line`, `inquiry_date`, `inquiry_submit`,
|
||
`inquiry_success_message`, `page_inquiry`.
|
||
|
||
### Betrieb – `backup.php`, `migrate.php`, `privacy.php`, `legal.php`, `agb.php`
|
||
|
||
- `backup.php`: `backup_format`, `backup_root`, `backup_keep`,
|
||
`backup_max_bytes`, `backup_is_archive_name`, `backup_path_for`,
|
||
`backup_meta_read`, `backup_meta_write`, `backup_list`, `backup_tables`,
|
||
`backup_sql_value`, `backup_db_dump`, `backup_split_sql`, `backup_exec_sql`,
|
||
`backup_collect_files`, `backup_create`, `backup_delete`, `backup_rotate`,
|
||
`backup_remove_tree`, `backup_copy_tree`, `backup_extract`,
|
||
`backup_restore`, `backup_prune_parked_files`, `backup_import`,
|
||
`backup_human_size`.
|
||
- `migrate.php`: `migrations_applied`, `migrations_pending`, `migrations_run`.
|
||
- `privacy.php`: `privacy_cleanup` (räumt auch `review_mail_log` und
|
||
`storage/exports` auf), `privacy_delete`, `privacy_rotate_error_log`.
|
||
- `legal.php`: `legal_data`, `legal_phone_href`, `legal_is_public_path`,
|
||
`legal_page_titles`, `legal_page`.
|
||
- `agb.php`: `agb_sections`, `agb_heading`, `agb_plain_blocks`.
|
||
|
||
## 4. Frontend-Objekte
|
||
|
||
| Datei | Objekte/Verantwortung |
|
||
| --- | --- |
|
||
| `views/layout.php` | Grundgerüst (Header, Navigation, Flash, Footer), bindet `app.js` und CSS ein |
|
||
| `views/*.php` | je Seite ein Template, erhält Daten als Variablen; Partials mit `_`-Präfix (`_admin_nav.php`) |
|
||
| `web/assets/app.js` | CSRF-Meta, PWA-Registrierung/Install-Prompt, Push-Abo, Clipboard, Toasts, Timer |
|
||
| `web/assets/js/main.js` | Marketing-/ öffentliche Seite: Scroll-Header, Mobile-Navigation, Lightbox |
|
||
| `web/sw.js` | `VERSION`/`CACHE`, `PRECACHE`, `cacheKey()`, Events `install`, `activate`, `fetch`, `push`, `notificationclick`; cached nur Assets und `/offline.html` |
|
||
| `web/manifest.webmanifest` | PWA-Metadaten (Name, Icons, Start-URL, Display) |
|
||
|
||
## 5. Werkzeuge und Datei-Objekte
|
||
|
||
| Objekt | Zweck |
|
||
| --- | --- |
|
||
| `tools/send_reminders.php` | CLI-Erinnerungslauf (nutzt `reminder_send_due`, `payment_reminder_send_due`, `push_dispatch_due`) |
|
||
| `tools/backup.php` | CLI für Backup/Restore/Import (`backup_cli_*`) |
|
||
| `tools/migrate.php` | CLI-Migrationen |
|
||
| `tools/test_webpush_rfc8291.php` | Selbsttest der Push-Verschlüsselung |
|
||
| `tools/generate_vapid_keys.py` | erzeugt VAPID-Schlüsselpaar |
|
||
| `tools/dump_drink_it_cold.py` | exportiert Daten für Auswertung |
|
||
| `tools/router.php` | PHP-Dev-Server-Router |
|
||
| `storage/documents/<booking_id>/` | PDFs und Unterschrifts-JPEGs je Buchung (`unterschrift-<id>.jpg` = Kunde, `unterschrift-<id>-<rolle>.jpg`) |
|
||
| `storage/exports/` | Jahresarchive der Mietverträge (`mietvertraege-<jahr>.zip`, im Januar automatisch fürs Vorjahr) |
|
||
| `storage/backups/` | `backup_*.tar.gz` + `.meta.json` |
|
||
| `storage/logs/` | `php.log` und weitere Laufzeitlogs |
|