aboutsummaryrefslogtreecommitdiff
path: root/blog/posts/post.php
diff options
context:
space:
mode:
authorHannah Isopod <me@bathynomus.xyz>2025-06-11 03:25:00 -0600
committerHannah Isopod <me@bathynomus.xyz>2025-06-11 03:25:00 -0600
commitb3bb0b898d3178963fefb9c0b16a00a76cf2a034 (patch)
treeeec6da7a21790183b15f31283fe3b8bcaabfaa4d /blog/posts/post.php
parent5023bdef46281034c0476bc4201342a0a4cc2ae7 (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 'blog/posts/post.php')
-rw-r--r--blog/posts/post.php129
1 files changed, 75 insertions, 54 deletions
diff --git a/blog/posts/post.php b/blog/posts/post.php
index e6b13b6..65d2661 100644
--- a/blog/posts/post.php
+++ b/blog/posts/post.php
@@ -1,17 +1,36 @@
<?php
+/*ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+error_reporting(E_ALL);*/
+
+if($_SERVER['REQUEST_URI'] === "/blog/posts/post.php") {
+ header("Location: /blog/");
+ die();
+}
+
$cwd = preg_replace('/^.*\//', '', getcwd());
$feed = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."/blog/blog.atom");
$pdate = "";
$udate = "";
$title = "";
$descr = "";
+$prevtitle = "";
+$prevlink = "";
+$nexttitle = "";
+$nextlink = "";
foreach($feed->entry as $entry) {
if($entry->id == $cwd) {
$pdate = preg_replace('/T.*$/', ' ', $entry->published);
$udate = preg_replace('/T.*$/', ' ', $entry->updated);
$title = $entry->title;
$descr = $entry->summary;
+ } else if($title) {
+ $nextlink = $entry->link["href"];
+ $nexttitle = $entry->title;
break;
+ } else {
+ $prevlink = $entry->link["href"];
+ $prevtitle = $entry->title;
}
}
?>
@@ -21,27 +40,50 @@ foreach($feed->entry as $entry) {
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
- <link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
+ <link href="/guestbook/comments.css" rel="stylesheet" type="text/css" media="all">
<?php
echo("<title>$title</title><meta name='description' content='$descr'>");
$bgfile = glob('bg.*')[0];
if(!is_null($bgfile)) {
- echo("<style> h1 { background-image: url('$bgfile') } </style>");
+ echo("<style> body > h1:first-of-type { background-image: url('$bgfile') } </style>");
}
?>
<style>
- td {
- display: table-cell;
+ form {
+ display: flex;
+ flex-direction: column;
+ gap: calc(var(--stdpadding) / 2);
+ }
+ #commentform-top, #commentform-bottom {
+ display: flex;
+ gap: calc(var(--stdpadding) / 2);
+ align-items: center;
+ }
+ #commentform-bottom {
+ justify-content: right;
+ }
+ input[type="submit"] {
+ width: fit-content;
+ }
+ .error, .success {
+ flex-grow: 1;
+ }
+ @media only screen and (hover: none) {
+ #commentform-top {
+ flex-direction: column;
+ }
}
</style>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
</head>
<body>
- <?php
+ <?php
include($_SERVER['DOCUMENT_ROOT'] . '/nav.php');
+ include($_SERVER['DOCUMENT_ROOT'] . '/common.php');
$udates = "";
if($pdate != $udate) { $udates = " | Updated&nbsp;on&nbsp;$udate"; }
echo("<h1>isoblog</h1><h2 id='caption'>$title</h2><p style='text-align: center;'><em>Posted&nbsp;on&nbsp;$pdate$udates</em></p>");
+ //echo("<p style='text-align: right;'>I'm testing in prod right now. don't worry about it");
include("../../../Parsedown.php");
$Parsedown = new Parsedown();
echo $Parsedown->text(file_get_contents("index.md"));
@@ -49,57 +91,36 @@ foreach($feed->entry as $entry) {
$return = $_GET["return"];
?>
<hr>
+ <nav style="flex-direction: column;">
+ <?php
+ if($prevlink) {
+ echo("<a style='width: 100%; box-sizing: border-box;' href='$prevlink'><svg style='max-height: 1em;' xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 4 28 16' stroke-width='1.5' stroke='currentColor' class='size-6'><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 18.75 7.5-7.5 7.5 7.5' /><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 12.75 7.5-7.5 7.5 7.5' /></svg>$prevtitle</a>");
+ }
+ if($nextlink) {
+ echo("<a style='width: 100%; box-sizing: border-box;' href='$nextlink'><svg style='max-height: 1em;' xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 4 28 16' stroke-width='1.5' stroke='currentColor' class='size-6'><path stroke-linecap='round' stroke-linejoin='round' d='m4.5 5.25 7.5 7.5 7.5-7.5m-15 6 7.5 7.5 7.5-7.5' /></svg>$nexttitle</a>");
+ }
+ ?>
+ </nav>
+ <hr>
<h2>Comments</h2>
- <form action="/blog/comment/submit.php" method="post" autocomplete="off">
+ <form action="/guestbook/submit.php" method="post" autocomplete="off">
<?php echo "<input type='text' name='entry' value='".preg_replace("/^.*\//","",getcwd())."' style='display: none;' readonly>"; ?>
- <table>
- <tr>
- <td><input type="text" name="name" placeholder="Name"></td>
- <td><input type="text" name="botcheck" placeholder="Bot test (type &quot;isopod&quot;)"></td>
- </tr>
- <tr>
- <td colspan="2"><textarea name="message" placeholder="Comment (Now supports Markdown!)"></textarea></td>
- </tr>
-
- <tr>
- <?php
- switch ($return) {
- case 'noname':
- echo "<td><span class='error'>Name required!</span></td>";
- break;
- case 'nomessage':
- echo "<td><span class='error'>Message required!</span></td>";
- break;
- case 'botcheckfailed':
- echo "<td><span class='error'>You failed the bot check!</span></td>";
- break;
- case 'success':
- echo "<td><span class='success'>Successfully posted!</span></td>";
- break;
- default:
- echo "<td></td>";
- break;
- }
- ?>
- <td style="text-align: right;"><input type="submit" value="Post"></td>
- </tr>
- </table>
+ <textarea name="msg" placeholder="I know what you are." style="opacity: 0; position: absolute; left: -10000rem; height: 0; width: 0; overflow: clip;"></textarea>
+ <div id="commentform-top">
+ <input type="text" name="name" placeholder="Name">
+ <input type="text" name="website" placeholder="Website (optional)">
+ <input type="text" name="botcheck" placeholder="Bot test (type &quot;isopod&quot;)">
+ </div>
+ <textarea name="message" placeholder="Comment (Now supports Markdown!)"></textarea>
+ <div id="commentform-bottom">
+ <?php
+ if($return) {
+ echo($gbform_messages[$return]);
+ }
+ ?>
+ <input type="submit" value="Submit">
+ </div>
</form>
- <?php
-
- $totaloutput = "";
- $postlist = json_decode(file_get_contents("../../comment/posts.json"));
- foreach($postlist as $post) {
- if ($post->entry == preg_replace("/^.*\//","",getcwd())) {
- $output = "";
- $date = date("Y-m-d h:iA", $post->date);
- $name = $post->name;
- $message = $Parsedown->text(html_entity_decode($post->message));
-
- $output = $output."<hr><article><table><tr><td style='text-align: left;'>".$name."</td><td style='text-align: right;'>".$date."</td></tr><tr><td colspan='2'>".$message."</td></tr></table></article>";
- $totaloutput = $output.$totaloutput;
- }
- }
- echo $totaloutput; ?>
+ <?php include('../../../guestbook/comments.php'); echo_comments(preg_replace("/^.*\//","",getcwd()), $Parsedown); ?>
</body>
</html>