diff --git a/.projectstructure.txt b/.projectstructure.txt new file mode 100644 index 0000000..60bc0ea --- /dev/null +++ b/.projectstructure.txt @@ -0,0 +1,115 @@ +Papa-Kind-Treff – Projektstruktur und Pflegehinweise +Stand: 2026-07-22 + +1. Zweck +- Plattform für Väter mit Fokus auf lokale Treffen, Community/Forum, Mitgliederbereich und spätere Liveschaltung. +- Sprache und Tonalität im Frontend: freundlich, direkt, nutzerzentriert. + +2. Zentrale Einstiegspunkte +- `public/index.php` + Front-Controller, Routing auf `public/page/*`, Staging-Basic-Auth, Layout-Steuerung. +- `partials/structure/layout_start.php` + Globale Assets, Body-Datasets, Consent-UI, Navigation, globale Modale. +- `partials/structure/layout_end.php` + Footer und Footer-Assets. + +3. Wichtige Verzeichnisse +- `public/page/` + Route-Dateien. + Wichtige Seiten: + - `index.php` Startseite + - `search.php` Suche + - `community.php` Community-Übersicht + - `community_thread.php` Thread-Ansicht + - `dashboard.php` Mitgliederbereich + - `community-admin.php` Moderation/Admin + - `impressum.php`, `datenschutz.php`, `ueber-uns.php` + - `api/location-preference.php` API zum Speichern der Standortpräferenz +- `partials/landing/main/` + Startseiten-Blöcke. +- `partials/landing/community/` + Community-Templates inkl. Sidebar-Navigation. +- `partials/landing/account/` + Dashboard, Community-Admin, Login/Register. +- `partials/structure/` + Layout, Navigation, Footer, Matomo-Konfiguration. +- `src/App/` + Geschäftslogik und Services. + +4. Relevante App-Klassen +- `src/App/AccountPages.php` + Dashboard-/Profil-Logik, Event-Anlage, Community-Bewerbung, Migration. +- `src/App/Community.php` + Boards, Threads, Posts, Forenstruktur, Punkte. +- `src/App/CommunityAccess.php` + Rollen, Bewerbungen, Meldungen, Moderation, Restrictions. +- `src/App/CommunityMigration.php` + DB-Erweiterungen für Community-Funktionen. +- `src/App/ProfileSettings.php` + Persistente Profileinstellungen für Standortfreigabe. +- `src/App/Search.php` + Eventsuche inkl. Distanzfilter. + +5. Frontend-Assets +- `public/assets/js/app.js` + Globale UI-Logik, Slider, Geolocation, Consent-Manager, Matomo-Opt-in. +- `public/assets/css/app.css` + Globales UI-Styling inkl. Community, Footer, Consent. +- `public/assets/css/styles.css` + Basis-Styles. + +6. Aktueller Funktionsstand +- Startseite mit Hero, Suche, neueste Treffen, Community-Vorschau, Mitgliederbereich. +- Hauptnavigation aktuell reduziert auf `Home`, `Suche`, `Community`. +- Für eingeloggte Nutzer gibt es rechts ein Profil-Dropdown mit `Übersicht`, `Mitgliederbereich`, `Abmelden`. +- Kein eigener Top-Level-Punkt `Termine`; Event-Fokus liegt derzeit auf Startseite und Suche. +- Community mit Kategorien, Boards, Thread-Liste, Thread-Ansicht, Rollen-/Moderationslogik. +- Dashboard mit Profil, Kinder, eigene Events, Community-Status. +- Community-Admin-Bereich für Bewerbungen, Meldungen, Rollen und Migration. +- Impressum, Datenschutz-&-Cookies-Seite und Über-uns vorhanden. +- Standortsortierung auf der Startseite für Treffen in der Nähe. +- Standortpräferenz im Profil: + - `disabled` + - `prompt` + - `enabled` +- Consent-Manager: + - notwendige Cookies immer aktiv + - `analytics` für Matomo + - `external_services` für Standort/Karten/Leaflet/Nominatim + +7. Rollenmodell Community +- normaler Nutzer + - schreiben, antworten, bewerten, melden +- `forum_admin` + - Themen/Beiträge bearbeiten und löschen + - Meldungen prüfen + - Community-Schreibsperren setzen +- `site_admin` + - alles wie `forum_admin` + - Bewerbungen prüfen + - Community-Migration +- `owner` + - alles wie `site_admin` + - Rollen vergeben/entziehen + +8. Externe Dienste und rechtlich relevante Punkte +- Matomo (`matomo.my-statistics.info`) nur nach Consent `analytics`. +- Leaflet via `unpkg.com` nur nach Consent `external_services`. +- OpenStreetMap Nominatim für Geocoding/Reverse-Geocoding nur nach Consent `external_services` bei Browserfunktionen. +- Browser-Geolocation und lokale Standortspeicherung nur nach Consent `external_services` und zusätzlicher Standortpräferenz. +- Jede neue Einbindung von Cookies, LocalStorage, SessionStorage, Tracking, externen Skripten, APIs oder Drittanbietern muss: + - technisch im Consent-Manager berücksichtigt werden + - in `README.md` dokumentiert werden + - in dieser Datei vermerkt werden + - in den rechtlich notwendigen Hinweisen/Datenschutztexten ergänzt werden + +9. Pflicht bei zukünftigen Änderungen +- Bei jeder funktionalen Änderung immer mitprüfen und bei Bedarf aktualisieren: + - `README.md` + - `.projectstructure.txt` + - `PROJECT_CONTEXT.md` +- Bei neuen Cookies, Tracking-Mechanismen oder Drittanbietern zusätzlich: + - Consent-Logik anpassen + - rechtliche Texte/Hinweise ergänzen + - Opt-in/Opt-out technisch verifizieren +- Änderungen an Navigation, Nutzerführung oder Rollenanzeige ebenfalls in dieser Datei, `README.md` und `PROJECT_CONTEXT.md` mitführen. diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md new file mode 100644 index 0000000..7d05a4a --- /dev/null +++ b/PROJECT_CONTEXT.md @@ -0,0 +1,55 @@ +# Papa-Kind-Treff – Chat-Kontext + +Stand: 2026-07-22 + +## Kurzbeschreibung +Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter. Kernbereiche sind lokale Treffen/Events, ein Community-Forum, Mitgliederprofile mit optionalen Kinderinfos und ein Moderations-/Adminbereich. + +## Technischer Rahmen +- Kein großes Framework, sondern eigener Front-Controller in `public/index.php` +- Templates unter `partials/` +- Geschäftslogik unter `src/App/` +- MySQL/MariaDB-Schema in `schema.sql` +- Globales Frontend vor allem über `public/assets/js/app.js` und `public/assets/css/app.css` + +## Wichtige Produktentscheidungen +- Die Ansprache im Frontend soll immer den aktuellen Nutzer direkt ansprechen. +- Die Hauptnavigation ist bewusst knapp gehalten: `Home`, `Suche`, `Community`. +- `Termine` ist aktuell kein eigener Hauptpunkt mehr; Events werden über Startseite und Suche erschlossen. +- Die Community ist hierarchisch aufgebaut: Kategorien -> Boards -> Threads -> Posts. +- Moderation ist getrennt vom normalen Community-Frontend in einem eigenen Adminbereich. +- Standortfunktionen sind relevant für lokale Treffen und werden künftig weiter ausgebaut. + +## Navigation / Konto +- Eingeloggte Nutzer sehen rechts ein Profil-Menü statt einzelner `Dashboard`-/`Logout`-Buttons. +- Das Profil-Menü enthält aktuell `Übersicht`, `Mitgliederbereich`, `Abmelden`. +- Debug ist kein Menüpunkt und erscheint nur als Floating-Käfer für `site_admin` bei aktivem Debug-Modus. + +## Community und Rechte +- dekorative Ränge über Punkte +- Moderationsrollen: + - `forum_admin` + - `site_admin` + - `owner` +- Bewerbungen für Moderation sind vorgesehen bzw. umgesetzt. + +## Recht / Consent +- Nicht notwendige Funktionen laufen nicht automatisch los. +- Es gibt einen Consent-Manager mit Kategorien: + - `analytics` + - `external_services` +- Matomo wird nur nach Analyse-Einwilligung geladen. +- Externe Karten-/Standortdienste und lokale Standortspeicherung hängen an `external_services`. +- Zusätzlich gibt es eine Standortpräferenz im Profil: + - `disabled` + - `prompt` + - `enabled` +- Es gibt eine eigene Seite `/datenschutz` für Datenschutz- und Cookie-Hinweise sowie einen Footer-Link auf die Consent-Einstellungen. + +## Doku-Regel +Bei jeder künftigen Änderung müssen mindestens diese Dateien mitgeprüft werden: +- `README.md` +- `.projectstructure.txt` +- `PROJECT_CONTEXT.md` + +Wenn Cookies, LocalStorage, SessionStorage, Tracking, Geolocation oder Drittanbieter neu hinzukommen oder geändert werden, müssen zusätzlich Consent und rechtliche Hinweise angepasst werden. diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 6a481a4..f955ac0 --- a/README.md +++ b/README.md @@ -1,93 +1,67 @@ -# emailtemplate +# Papa-Kind-Treff +Stand: 2026-07-22 +Papa-Kind-Treff ist eine PHP-basierte Plattform für Väter mit Fokus auf lokale Treffen, Community-Austausch und einen geschützten Mitgliederbereich. -## Getting started +## Produktumfang +- lokale Events und Treffen finden +- Community/Forum mit Kategorien, Boards, Threads und Antworten +- Mitgliederbereich für Profil, optionale Kinderinfos und eigene Termine +- Community-Moderation mit Rollenmodell -To make it easy for you to get started with GitLab, here's a list of recommended next steps. +## Aktueller Stand +- Startseite mit Hero, Suche, Event-Karussell, Community-Vorschau und Mitgliederbereichs-Block +- Community mit Board-Navigation und separater Thread-Ansicht +- Community-Admin-Bereich für Bewerbungen, Meldungen, Rollen und Migration +- Impressum, Datenschutz-&-Cookies-Seite und Über-uns +- standortbasierte Sortierung für die neuesten Treffen +- Standortpräferenz im Profil +- Consent-Manager für Analyse und externe Dienste +- Navigation aktuell mit `Home`, `Suche`, `Community` +- eingeloggte Nutzer sehen rechts ein Profil-Menü statt separater `Dashboard`-/`Logout`-Buttons +- Debug-Floating-Button nur für `site_admin` im Debug-Modus -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +## Technik +- Einstieg: `public/index.php` +- Templates: `partials/` +- App-Logik: `src/App/` +- Assets: `public/assets/` +- Datenbankschema: `schema.sql` -## Add your files +## Rollen +- `forum_admin` +- `site_admin` +- `owner` -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: +Die Rechteverteilung und Community-Logik sind in `src/App/CommunityAccess.php` abgebildet. -``` -cd existing_repo -git remote add origin https://gitlab.int.kusche.berlin/freemium_projects/papa-kind-treff.git -git branch -M main -git push -uf origin main -``` +## Consent und rechtlich relevante Integrationen +Der aktuelle Code nutzt oder kann nutzen: +- notwendige Session-/Client-Cookies +- Matomo (`analytics`) +- Browser-Geolocation (`external_services`) +- lokale Standortspeicherung via Cookie, `localStorage`, `sessionStorage` (`external_services`) +- Leaflet von `unpkg.com` (`external_services`) +- OpenStreetMap Nominatim (`external_services`) -## Integrate with your tools +Wichtig: +- Nicht notwendige Analyse- und Drittanbieterfunktionen dürfen erst nach Einwilligung aktiv werden. +- Änderungen an Cookies, Tracking oder Drittanbietern müssen immer auch in Consent und rechtlichen Hinweisen nachgezogen werden. -- [ ] [Set up project integrations](https://gitlab.int.kusche.berlin/emailtemplate/emailtemplate/-/settings/integrations) +## Dokumentationspflicht bei Änderungen +Bei jeder Änderung im Projekt immer mitprüfen und bei Bedarf aktualisieren: +- `README.md` +- `.projectstructure.txt` +- `PROJECT_CONTEXT.md` -## Collaborate with your team +Zusätzlich bei neuen Cookies, Tracking-Mechanismen oder Drittanbietern: +- Consent-Manager anpassen +- rechtliche Hinweise/Datenschutztexte ergänzen +- technische Opt-in-/Opt-out-Logik prüfen -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Papa-Kind-Treff - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +## Dateien für neue Chats +Für spätere Chats als Einstieg besonders wichtig: +- `README.md` +- `.projectstructure.txt` +- `PROJECT_CONTEXT.md` diff --git a/partials/landing/account/dashboard.php b/partials/landing/account/dashboard.php index 1af7ec9..01da9a9 100755 --- a/partials/landing/account/dashboard.php +++ b/partials/landing/account/dashboard.php @@ -462,6 +462,11 @@ $allowNoKidsChecked = $editEvent ? ((int)$editEvent['allow_kids'] === 0) : false let map, marker; function ensureLeaflet(callback) { + if (!window.PKTConsent || !window.PKTConsent.has('external_services')) { + alert('Für Karten und Adresssuche bitte zuerst die externen Dienste in den Cookie-Einstellungen erlauben.'); + window.PKTConsent?.openPreferences?.(); + return; + } if (window.L) { callback(); return; } const css = document.createElement('link'); css.rel = 'stylesheet'; @@ -508,6 +513,7 @@ $allowNoKidsChecked = $editEvent ? ((int)$editEvent['allow_kids'] === 0) : false } function reverseGeocode(lat, lng) { + if (!window.PKTConsent || !window.PKTConsent.has('external_services')) return; fetch(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${encodeURIComponent(lat)}&lon=${encodeURIComponent(lng)}`, { headers: { 'Accept-Language': 'de', 'User-Agent': 'papa-kind-treff/1.0' }, }) @@ -517,6 +523,11 @@ $allowNoKidsChecked = $editEvent ? ((int)$editEvent['allow_kids'] === 0) : false } function geocodeAndPlace(query) { + if (!window.PKTConsent || !window.PKTConsent.has('external_services')) { + alert('Für Karten und Adresssuche bitte zuerst die externen Dienste in den Cookie-Einstellungen erlauben.'); + window.PKTConsent?.openPreferences?.(); + return; + } fetch('https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&q=' + encodeURIComponent(query), { headers: { 'Accept-Language': 'de', 'User-Agent': 'papa-kind-treff/1.0' }, }) diff --git a/partials/landing/search/search.php b/partials/landing/search/search.php index d70b7f3..64af175 100755 --- a/partials/landing/search/search.php +++ b/partials/landing/search/search.php @@ -140,6 +140,11 @@ if ($pdo && ($q !== '' || $loc !== '' || ($lat !== null && $lng !== null))) { } function ensureLeaflet(cb) { + if (!window.PKTConsent || !window.PKTConsent.has('external_services')) { + alert('Für Karten- und Standortfunktionen bitte zuerst die externen Dienste in den Cookie-Einstellungen erlauben.'); + window.PKTConsent?.openPreferences?.(); + return; + } if (window.L) { cb(); return; } const css = document.createElement('link'); css.rel = 'stylesheet'; @@ -188,6 +193,11 @@ if ($pdo && ($q !== '' || $loc !== '' || ($lat !== null && $lng !== null))) { }); btnGeo?.addEventListener('click', () => { + if (!window.PKTConsent || !window.PKTConsent.has('external_services')) { + alert('Für Standortfunktionen bitte zuerst die externen Dienste in den Cookie-Einstellungen erlauben.'); + window.PKTConsent?.openPreferences?.(); + return; + } if (!navigator.geolocation) { alert('Geolocation wird nicht unterstützt.'); return; diff --git a/partials/structure/layout_end.php b/partials/structure/layout_end.php index a00d1e2..a2c13c4 100755 --- a/partials/structure/layout_end.php +++ b/partials/structure/layout_end.php @@ -2,6 +2,7 @@ - +