aboutsummaryrefslogtreecommitdiffstats
path: root/journal/render_entries.php
diff options
context:
space:
mode:
authorsillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
committersillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
commit898b52edcb47bcb3e9d6106e74ca73e74ea01e70 (patch)
tree85c6ee5ad58b860144551184d4cf86b560c62b91 /journal/render_entries.php
downloadwww-main.tar.gz
www-main.zip
import live www.sillylaird.ca webrootHEADmain
Diffstat (limited to '')
-rw-r--r--journal/render_entries.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/journal/render_entries.php b/journal/render_entries.php
new file mode 100644
index 0000000..68915e4
--- /dev/null
+++ b/journal/render_entries.php
@@ -0,0 +1,13 @@
+<?php
+if (realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME'] ?? '')) { http_response_code(404); exit; }
+
+$journal_entries = is_file(__DIR__ . '/entries.php') ? require __DIR__ . '/entries.php' : [];
+foreach ($journal_entries as $entry) {
+ $date = $entry['date'] ?? '';
+ $body = $entry['body'] ?? '';
+ if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $date) || trim((string)$body) === '') continue;
+ echo ' <div class="entry"><time datetime="' . htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '">'
+ . htmlspecialchars($date, ENT_QUOTES, 'UTF-8') . '</time><p>'
+ . nl2br(htmlspecialchars((string)$body, ENT_QUOTES, 'UTF-8'), false)
+ . "</p></div>\n";
+}