diff --git a/src/Framework/Util/Util.php b/src/Framework/Util/Util.php index 328e7d2..54af536 100644 --- a/src/Framework/Util/Util.php +++ b/src/Framework/Util/Util.php @@ -1,20 +1,30 @@ "\'()]+)~i', - fn($matches) => '' . $matches[1] . '', - $safe - ); + function($matches) use ($link_attrs) { + $escaped_url = rtrim($matches[1], '.,!?;:)]}>'); + $clean_url = html_entity_decode($escaped_url, ENT_QUOTES, 'UTF-8'); - return $safe; - } + return '' . $escaped_url . ''; + }, + $text + ); + } // For relative time display, compare the stored time to the current time // and display it as "X seconds/minutes/hours/days etc." ago diff --git a/src/View/HomeView/HomeView.php b/src/View/HomeView/HomeView.php index ba29a11..da17826 100644 --- a/src/View/HomeView/HomeView.php +++ b/src/View/HomeView/HomeView.php @@ -8,8 +8,8 @@ class HomeView {
-
- +
+
diff --git a/templates/feed/atom.php b/templates/feed/atom.php index 7ed1587..f85dfa6 100644 --- a/templates/feed/atom.php +++ b/templates/feed/atom.php @@ -1,45 +1,49 @@ siteTitle); -$siteUrl = htmlspecialchars($config->baseUrl); -$basePath = htmlspecialchars($config->basePath); +$feedTitle = Util::escape_xml("$config->siteTitle Atom Feed"); +$siteUrl = Util::escape_xml($config->baseUrl . $config->basePath); +$feedUrl = Util::escape_xml($config->baseUrl . $config->basePath . 'feed/atom'); $updated = date(DATE_ATOM, strtotime($ticks[0]['timestamp'] ?? 'now')); header('Content-Type: application/atom+xml; charset=utf-8'); echo '' . "\n"; ?> - <?= "$siteTitle Atom Feed" ?> + <?php echo $feedTitle ?> - - - + title="" + href="" /> + + + - <?= $tickText ?> + <?= $tickTitle ?> - + diff --git a/templates/feed/rss.php b/templates/feed/rss.php index d5484e2..294516d 100644 --- a/templates/feed/rss.php +++ b/templates/feed/rss.php @@ -4,34 +4,43 @@ // Need to have a little php here because the starting xml tag // will mess up the PHP parser. // TODO - I think short php tags can be disabled to prevent that. + header('Content-Type: application/rss+xml; charset=utf-8'); echo '' . "\n"; ?> - <?php echo htmlspecialchars($config->siteTitle, ENT_XML1, 'UTF-8') ?> RSS Feed - baseUrl . $config->basePath, ENT_XML1, 'UTF-8')?> - - siteDescription, ENT_XML1, 'UTF-8') ?> + <?php echo Util::escape_xml($config->siteTitle . 'RSS Feed') ?> + baseUrl . $config->basePath)?> + + siteDescription) ?> en-us baseUrl . $config->basePath . $tickPath; + // build the tick entry components + $tickPath = "tick/$year/$month/$day/$hour/$minute/$second"; + $tickUrl = Util::escape_xml($config->baseUrl . $config->basePath . $tickPath); + $tickDate = date(DATE_RSS, strtotime($tick['timestamp'])); + $tickTitle = Util::escape_xml($tick['tick']); + $tickDescription = Util::linkify($tickTitle); ?> - <?php echo htmlspecialchars($tick['tick'], ENT_XML1, 'UTF-8'); ?> - baseUrl . $config->basePath . "tick/$tickPath", ENT_XML1, 'UTF-8'); ?> - - - + <?php echo $tickTitle ?> + + + + diff --git a/templates/partials/home.php b/templates/partials/home.php index 4c10bd8..64c674d 100644 --- a/templates/partials/home.php +++ b/templates/partials/home.php @@ -11,7 +11,7 @@

About: about ?>

website)): ?> -

Website: website) ?>

+

Website: website)) ?>

mood) || Session::isLoggedIn()): ?>
@@ -27,7 +27,7 @@
- +
diff --git a/templates/partials/tick.php b/templates/partials/tick.php index 8ec7d21..97fccb0 100644 --- a/templates/partials/tick.php +++ b/templates/partials/tick.php @@ -2,4 +2,4 @@

Tick from format('Y-m-d H:i:s'); ?>

-

+