From 0f0cfb5b2268e165adf999f06425744e4dd4a966 Mon Sep 17 00:00:00 2001 From: Greg Sarjeant <1686767+gsarjeant@users.noreply.github.com> Date: Sat, 14 Jun 2025 14:17:49 -0400 Subject: [PATCH] Some feed fixes. Think atom is still broken. --- src/Framework/Util/Util.php | 8 +++++--- templates/feed/atom.php | 19 ++++++++++--------- templates/feed/rss.php | 21 ++++++++------------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/Framework/Util/Util.php b/src/Framework/Util/Util.php index 18751dc..328e7d2 100644 --- a/src/Framework/Util/Util.php +++ b/src/Framework/Util/Util.php @@ -1,13 +1,15 @@ "\'()]+)~i', - fn($matches) => '' . $matches[1] . '', + fn($matches) => '' . $matches[1] . '', $safe ); diff --git a/templates/feed/atom.php b/templates/feed/atom.php index d57a5f9..0a21399 100644 --- a/templates/feed/atom.php +++ b/templates/feed/atom.php @@ -13,11 +13,11 @@ echo '' . "\n"; <?= "$siteTitle Atom Feed" ?> - + title="siteTitle, ENT_XML1, 'UTF-8') ?> Atom Feed" + href="feed/atom"> + - + @@ -30,16 +30,17 @@ echo '' . "\n"; [$hour, $minute, $second] = $timeParts; $tickPath = "$year/$month/$day/$hour/$minute/$second"; - $tickUrl = htmlspecialchars($siteUrl . $basePath . "tick/$tickPath"); + $tickUrl = htmlspecialchars($siteUrl . $basePath . "tick/$tickPath", ENT_XML1, 'UTF-8'); $tickTime = date(DATE_ATOM, strtotime($tick['timestamp'])); - $tickText = htmlspecialchars($tick['tick']); + $tickTitle = htmlspecialchars($tick['tick'], ENT_XML1, 'UTF-8'); + $tickContent = Util::escape_and_linkify($tick['tick'], ENT_XML1, false); ?> - <?= $tickText ?> - + <?= $tickTitle ?> + - + diff --git a/templates/feed/rss.php b/templates/feed/rss.php index 534744e..5455d70 100644 --- a/templates/feed/rss.php +++ b/templates/feed/rss.php @@ -9,15 +9,9 @@ echo '' . "\n"; ?> - <?php echo htmlspecialchars($config->siteTitle) ?> RSS Feed - - - siteDescription) ?> + <?php echo htmlspecialchars($config->siteTitle, ENT_XML1, 'UTF-8') ?> RSS Feed + baseUrl . $config->basePath, ENT_XML1, 'UTF-8')?> + siteDescription, ENT_XML1, 'UTF-8') ?> en-us ' . "\n"; [$hour, $minute, $second] = $timeParts; $tickPath = "$year/$month/$day/$hour/$minute/$second"; + $tickUrl = $config->baseUrl . $config->basePath . $tickPath; ?> - <?php echo htmlspecialchars($tick['tick']); ?> - baseUrl . $config->basePath . "tick/$tickPath"); ?> - + <?php echo htmlspecialchars($tick['tick'], ENT_XML1, 'UTF-8'); ?> + baseUrl . $config->basePath . "tick/$tickPath", ENT_XML1, 'UTF-8'); ?> + - +