diff options
| author | Hannah Isopod <me@bathynomus.xyz> | 2025-06-11 03:25:00 -0600 |
|---|---|---|
| committer | Hannah Isopod <me@bathynomus.xyz> | 2025-06-11 03:25:00 -0600 |
| commit | b3bb0b898d3178963fefb9c0b16a00a76cf2a034 (patch) | |
| tree | eec6da7a21790183b15f31283fe3b8bcaabfaa4d /guestbook/feed.php | |
| parent | 5023bdef46281034c0476bc4201342a0a4cc2ae7 (diff) | |
total guestbook overhaul + new blog post + etc
- Added /about/pronouns/ in leiu of something like
a pronouns.cc profile
- New blog post about my new and improved AI
opinions
- Moved Stop Using Chromium to an actual blog post
page
- Blog posts now have previous and next buttons
- New /blog/ background
- Moved status.cafe widget from /blog/ to landing
page
- Total overhaul of guestbook:
- Merged guestbook and blog comment section code
- Beefed up bot protection
- Added a word filter
- Added a property to entries to facilitate
holding comments for review and approving or
denying them manually (The interface for this
is somewhere else)
- IP address from which a post originates is now
tracked in order to IP ban malicious actors
- Various new buttons
- Updated /greenhouse/
- The site is now a member of the No AI Webring
- a couple minor CSS fixes
Diffstat (limited to 'guestbook/feed.php')
| -rw-r--r-- | guestbook/feed.php | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/guestbook/feed.php b/guestbook/feed.php index 7cdb62e..64d1b31 100644 --- a/guestbook/feed.php +++ b/guestbook/feed.php @@ -4,43 +4,51 @@ header('Content-Type: text/xml'); echo '<rss version="2.0"><channel>'; echo '<title>isopod.cool guestbook</title>'; -echo '<description>The guestbook on isopod.cool</description>'; +echo '<description>The guestbook and blog comments on isopod.cool</description>'; echo '<language>en-us</language>'; echo '<link>https://isopod.cool/guestbook/</link>'; echo '<generator>My crappy PHP code</generator>'; -$postlist = json_decode(file_get_contents("posts.json")); + +include($_SERVER['DOCUMENT_ROOT']."/Parsedown.php"); +$Parsedown = new Parsedown(); +$Parsedown->setSafeMode(true); +include($_SERVER['DOCUMENT_ROOT'] . '/common.php'); +$postlist = json_decode(file_get_contents($datadir."posts.json")); $index = 1; $totaloutput = ""; foreach($postlist as $post) { - $output = ""; - $date = date("D, d M Y H:m:s", $post->date) . " GMT"; - $name = $post->name; - $message = $post->message; - $found = $post->found; - $website = $post->website; - $cool = $post->cool; - $coolsanitized = htmlentities(preg_replace("/https?:\/\//i", "", $cool)); - $reply = htmlentities($post->reply); - - if($website) { $output = $output."<a href='$website'>$name</a>:<br><br>"; } - else { $output = $output.$name.":<br><br>"; } - - if($cool) { - $output = $output."<b>cool thing</b>: <a href='$cool'>$coolsanitized</a><br><br>"; - } - - if($found) { - $output = $output."<b>How did you find me?</b><br>$found<br><br>"; - } - - $output = $output.$message."<br><br>"; - - if($reply) { - $output = $output."<hr><b>Reply:</b><br>$reply"; + if($post->modstatus == 1) { + $output = ""; + $entry = $post->entry; + $date = date("D, d M Y H:m:s", $post->date) . " GMT"; + $name = $post->name; + $message = $Parsedown->text($post->message); + $found = $post->found; + $website = $post->website; + $cool = $post->cool; + $reply = $Parsedown->text($post->reply); + + if($website) { $output = $output."<p><a href='$website'>$name</a>:</p>"; } + else { $output = $output."</p>$name:</p>"; } + + if($cool) { + $output = $output."<p><b>cool thing</b>: <a href='$cool'>$cool</a></p>"; + } + + if($found) { + $output = $output."<p><b>How did you find me?</b><br>$found</p>"; + } + + $output = $output.$message; + + if($reply) { + $output = $output."<hr><p><b>Reply</b>:</p>$reply"; + } + $output_sanitized = preg_replace("/&gt;/", ">", preg_replace("/&lt;/", "<", htmlspecialchars($output))); + $totaloutput = "<item><title>Entry #" . $index . " on " . $entry . " - " . $name . "</title><link>https://isopod.cool/guestbook/</link><pubDate>" . $date . "</pubDate><description>".$output_sanitized."</description><guid isPermaLink='false'>" . $index . $post->date . $name . "</guid></item>\n".$totaloutput; + $index++; } - $totaloutput = "<item><title>Entry #" . $index . " - " . $name . "</title><link>https://isopod.cool/guestbook/</link><pubDate>" . $date . "</pubDate><description>".htmlentities($output)."</description><guid isPermaLink='false'>" . $index . $post->date . $name . "</guid></item>".$totaloutput; - $index++; } echo $totaloutput; |
