From 4539f357c10d1e2528e2120731406666f4cde9d4 Mon Sep 17 00:00:00 2001 From: Umut Kantarci Date: Wed, 16 Sep 2026 08:57:20 +0200 Subject: [PATCH] Stop text from being encoded again on every save Umut: "Beim Startseitenbild wird der Text & umgewandelt, aber in der Ansicht nach dem Speichern wird & daraus." RichText::sanitise() treated text without a single tag as plain text and only escaped it. What the editor sends is HTML, tag or no tag - so "Freudenstadt & Umgebung" gained one level of encoding on every save (&, & ...) until the entity stood on the page for everyone to read. The draft of the kant-it.de home page had already reached three levels. The same branch carried a second fault of the same kind: nl2br() left the newline behind the
, and the next pass turned it into a second
via breakLines() - one paragraph became two. The branch now decodes first and replaces the line break instead of adding to it, so it ends up with the same representation as the DOM branch and both are stable under repeated saves. scripts/repair-doubled-entities.php cleans up what is already stored: the published and draft revision of every page and the areas, with a dry run, each change checked against the validator. Older revisions stay as history. DEEG: favicon is now its own square mark - the roof gable from the logo, white on the logo blue, rendered from logo-deeg.png - instead of the centre crop of the wide logo, which showed the "EE" of the wordmark. Co-Authored-By: Claude Opus 5 --- README.md | 4 + docs/STATUS.md | 14 +++ scripts/repair-doubled-entities.php | 127 ++++++++++++++++++++++++ scripts/set-immobilien-deeg-favicon.php | 99 ++++++++++++++++++ src/Content/RichText.php | 14 ++- tests/CmsTest.php | 40 ++++++++ 6 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 scripts/repair-doubled-entities.php create mode 100644 scripts/set-immobilien-deeg-favicon.php diff --git a/README.md b/README.md index 8107576..5011a2d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Selbst betreibbares Block-CMS für PHP-Webhosting mit visuellem Editor nach dem Die übernommenen Originaldokumente sind `AGENTS.md` und `ENTWICKLUNGSPLAN.md`. Den tatsächlichen Stand enthält `docs/STATUS.md`, Entscheidungen und Datenmodell stehen in `docs/ARCHITECTURE.md`. +## Kaufmännisches Und und Zeilenumbrüche bleiben, wie sie sind (ab 1.20.1) + +**Behoben.** Ein Text ohne Auszeichnung wurde beim Speichern doppelt kodiert: aus `&` wurde `&`, beim nächsten Speichern `&` – irgendwann stand die Entity sichtbar auf der Seite. Ebenso wuchsen Zeilenumbrüche: jedes zweite Speichern machte aus einem `
` zwei. Beides ist behoben, und wiederholtes Speichern ändert einen Text jetzt nicht mehr. Was bereits falsch gespeichert ist, räumt `php scripts/repair-doubled-entities.php` auf (erst Trockenlauf, dann `--schreiben`). + ## Eigenes HTML und eingebettete Seiten (ab 1.20.0) Der Baustein **Eigenes HTML** (Werkzeugkasten, Gruppe „Seite und Daten“) nimmt Markup auf, das unverändert auf der Seite landet – eigene Tabellen, fremde Widgets, Auszeichnungen, die es als Baustein nicht gibt. Ändern darf ihn nur ein **Administrator**, genau wie das Feld „Eigenes Skript“; für alle anderen ist er sichtbar und schreibgeschützt, und der Server weist eine Änderung ohnehin ab. Zwei Tags nimmt er nicht an: `