aboutsummaryrefslogtreecommitdiff
path: root/guestbook
diff options
context:
space:
mode:
Diffstat (limited to 'guestbook')
-rw-r--r--guestbook/commentbox.php67
-rw-r--r--guestbook/comments.php35
-rw-r--r--guestbook/index.php65
-rw-r--r--guestbook/submit.php1
4 files changed, 105 insertions, 63 deletions
diff --git a/guestbook/commentbox.php b/guestbook/commentbox.php
new file mode 100644
index 0000000..9ba6586
--- /dev/null
+++ b/guestbook/commentbox.php
@@ -0,0 +1,67 @@
+<section> <!-- If I did it right, this <section> should be everything needed to give any page a comment box -->
+ <?php
+ $root = $_SERVER['DOCUMENT_ROOT'];
+
+ //Boilerplate for Parsedown
+ include_once($root."/Parsedown.php");
+ $Parsedown = new Parsedown();
+ $Parsedown->setSafeMode(true);
+
+ //Boilerplate for comments
+ include_once($root . '/common.php');
+ $return = $_GET["return"];
+ $cwd = preg_replace("/^.*\//","",getcwd());
+
+ $ismaingb = false;
+ if($cwd != "guestbook") {
+ echo('<h2>Comments</h2>');
+ } else {
+ $ismaingb = true;
+ }
+
+ ?>
+
+ <form action="/guestbook/submit.php" method="post" autocomplete="off" class="commentform">
+ <?php echo "<input type='text' name='entry' value='$cwd' style='display: none;' readonly>"; ?>
+ <textarea name="msg" placeholder="I know what you are." style="opacity: 0; position: absolute; left: -10000rem; height: 0; width: 0; overflow: clip;"></textarea>
+ <div class="commentform-top">
+ <div class="commentform-field">
+ <label for="name">Name<span style="color:red;">*</span></label>
+ <input type="text" name="name" id="name" placeholder="Hannah">
+ </div>
+ <div class="commentform-field">
+ <label for="website">Website</label>
+ <input type="text" name="website" id="website" placeholder="https://">
+ </div>
+ </div>
+
+ <?php if($ismaingb) { echo("<div class='commentform-field'>
+ <label for='cool'>Link something cool</label>
+ <input type='text' name='cool' id='cool' placeholder='https://'>
+ </div>
+ <div class='commentform-field'>
+ <textarea name='found' id='found'></textarea>
+ <label for='found'>How did you find me?</label>
+ </div>"); } ?>
+ <div class="commentform-field">
+ <textarea name="message" id="message" placeholder="Supports Markdown!"></textarea>
+ <label for="message">Message<span style="color:red;">*</span></label>
+ </div>
+ <div class="commentform-field">
+ <label for="botcheck">Bot test (6-letter term for roly-poly)<span style="color:red;">*</span></label>
+ <input type="text" name="botcheck" placeholder="[_].cool">
+ </div>
+ <div class="commentform-bottom">
+ <input type="submit" value="Submit">
+ <?php
+ if($return) {
+ echo($gbform_messages[$return]);
+ }
+ ?>
+ </div>
+ </form>
+ <?php
+ //Displays comments
+ include($root.'/guestbook/comments.php'); echo_comments($cwd, $Parsedown);
+ ?>
+</section> \ No newline at end of file
diff --git a/guestbook/comments.php b/guestbook/comments.php
index b0acbae..92505e3 100644
--- a/guestbook/comments.php
+++ b/guestbook/comments.php
@@ -13,7 +13,7 @@ function echo_comments($page, $Parsedown = null) {
foreach($postlist as $post) {
if($post->entry === $page and $post->modstatus > 0) {
$output = "";
- $date = date("Y-m-d h:iA", $post->date);
+ $date = date("Y-m-d", $post->date);
$name = htmlentities($post->name);
$message = $Parsedown->text($post->message);
$found = htmlentities($post->found);
@@ -23,7 +23,28 @@ function echo_comments($page, $Parsedown = null) {
$coolsanitized = htmlentities(preg_replace("/https?:\/\//i", "", $cool));
$reply = $Parsedown->text($post->reply);
- $output = $output."<hr><article class='comment'><div style='grid-area:gb-name;' class='gb-name'>";
+ $nice = "";
+ switch($index) {
+ case 42:
+ $nice = "scifi reference ayo???";
+ break;
+ case 67:
+ $nice = "six sevennn";
+ break;
+ case 69:
+ $nice = "nice";
+ break;
+ case 420:
+ $nice = "blaze it";
+ break;
+ case 911:
+ $nice = "ohhhh nine eleven";
+ break;
+ default:
+ $nice = "#$index";
+ }
+
+ $output = $output."<article class='comment'><div class='gb-head'><p class='gb-name'>";
if($website) {
if($button) {
$output = $output."<a href='$website'><img src='$button' alt='$name'/></a>";
@@ -31,16 +52,16 @@ function echo_comments($page, $Parsedown = null) {
$output = $output."<a href='$website'>$name</a>";
}
} else { $output = $output.$name; }
- $output = $output."</div><div style='grid-area:gb-date;' class='gb-date'>$date</div><div style='grid-area:gb-index;' class='gb-index'>Entry #$index</div>";
+ $output = $output."</p><p class='gb-date'>$date</p><p class='gb-index'>$nice</p></div>";
if($cool) {
- $output = $output."<div style='grid-area:gb-cool;' class='gb-cool'><b>cool thing</b>: <a href='$cool'>$coolsanitized</a></div>";
+ $output = $output."<div class='gb-cool'><p><b>cool thing</b>: <a href='$cool'>$coolsanitized</a></p></div>";
}
if($found) {
- $output = $output."<div style='grid-area:gb-found;' class='gb-found'><b>How did you find me?</b><br>$found</div>";
+ $output = $output."<div class='gb-found'><p><b>How did you find me?</b></p><p>$found</p></div>";
}
- $output = $output."<div style='grid-area:gb-message;'>$message</div>";
+ $output = $output."<div class='gb-message'>$message</div>";
if($reply) {
- $output = $output."<div style='grid-area:gb-reply;' class='reply'><b>Reply</b>:$reply</div>";
+ $output = $output."<div class='gb-reply'><p><b>Reply</b>:</p><div>$reply</div></div>";
}
$output = $output."</article>";
$index++;
diff --git a/guestbook/index.php b/guestbook/index.php
index 97e902b..dc7d654 100644
--- a/guestbook/index.php
+++ b/guestbook/index.php
@@ -8,63 +8,18 @@ error_reporting(E_ALL);
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Guestbook</title>
- <link href="../style.css" rel="stylesheet" type="text/css" media="all">
- <link href="./comments.css" rel="stylesheet" type="text/css" media="all">
- <style>
- form td:first-child {
- text-align: right;
- }
- </style>
- <?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
+ <title>guestbook | isopod.cool v4</title>
+ <link href="/style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
- <?php include($_SERVER['DOCUMENT_ROOT'] . '/nav.php'); bg();
+ <?php include($_SERVER['DOCUMENT_ROOT'] . '/header.php');
include($_SERVER['DOCUMENT_ROOT'] . '/common.php'); ?>
- <h1>guestbook</h1>
- <h2 id="caption">say hi</h2>
- <nav>
- <a href="feed.php">RSS</a>
- </nav>
- <?php
- $return = $_GET["return"];
- ?>
- <form action="submit.php" method="post" autocomplete="off">
- <textarea name="msg" placeholder="I know what you are." style="opacity: 0; position: absolute; left: -10000rem; height: 0; width: 0; overflow: clip;"></textarea>
- <table>
- <tr>
- <td><label for="name">Name</label><span style="color:red;">*</span></td>
- <td><input type="text" name="name" id="name"></td>
- </tr>
- <tr>
- <td><label for="website">Website</label></td>
- <td><input type="text" name="website" id="website" placeholder="https://"></td>
- </tr>
- <tr>
- <td><label for="cool">Link something cool</label></td>
- <td><input type="text" name="cool" id="cool" placeholder="https://"></td>
- </tr>
- <tr>
- <td><label for="found">How did you find me?</label></td>
- <td><textarea name="found" id="found"></textarea></td>
- </tr>
- <tr>
- <td><label for="message">Message</label><span style="color:red;">*</span></td>
- <td><textarea name="message" id="message" placeholder="Now supports Markdown!"></textarea></td>
- </tr>
- <tr>
- <td><label for="botcheck">Bot test (six-letter scientific term for a roly-poly or woodlouse)</label><span style="color:red;">*</span></td>
- <td><input type="text" name="botcheck" id="botcheck" placeholder="*.cool"></td>
- </tr>
-
- <?php if($return) { echo("<tr><td colspan='2' style='text-align: center;''>".$gbform_messages[$return]."</td></tr>"); }?>
- <tr>
- <td colspan="2" style="text-align: center;"><input type="reset"><input type="submit" value="Submit"></td>
- </tr>
-
- </table>
- <input type='text' name='entry' value='guestbook' style='display: none;' readonly>
- </form>
- <?php include('./comments.php'); echo_comments('guestbook'); ?>
+ <main>
+ <h2>guestbook</h2>
+ <p class="h2caption">say hi!</p>
+ <nav class="pagenav"><ul><li><a href="feed.php">RSS</a></li></ul></nav>
+ <?php include('./commentbox.php'); ?>
+ </main>
+ <?php include($_SERVER['DOCUMENT_ROOT'] . '/footer.php'); ?>
</body>
</html>
diff --git a/guestbook/submit.php b/guestbook/submit.php
index bb745a2..3393cb3 100644
--- a/guestbook/submit.php
+++ b/guestbook/submit.php
@@ -123,7 +123,6 @@ error_reporting(E_ALL);
align-items: center;
}
</style>
- <?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
</head>
<body>
<p>Your post has been submitted! It's weird that you're seeing this page though. Maybe your browser can't process location headers? At any rate, click <?php echo "<a href='./?return=$returnCode'>here</a>"; ?> to get where you're supposed to be right now.</p>