diff options
| author | Hannah Isopod <me@bathynomus.xyz> | 2025-06-25 21:40:34 -0600 |
|---|---|---|
| committer | Hannah Isopod <me@bathynomus.xyz> | 2025-06-25 21:40:34 -0600 |
| commit | 2645f9c733fcab7491238c88a27826fb090aa6b0 (patch) | |
| tree | bd2649a771eb9184d0c39d86f029ab626cb8716d /guestbook | |
| parent | 54dac74821cca8bb84af32bece3779eb59dcf5ef (diff) | |
guestbook reflects .well-known/button in your site
also:
- moved johnvertisement and mothverisement to landing
page
- minor css fixes and other routine updates
Diffstat (limited to 'guestbook')
| -rw-r--r-- | guestbook/bg.jxl | bin | 664811 -> 0 bytes | |||
| -rw-r--r-- | guestbook/comments.css | 10 | ||||
| -rw-r--r-- | guestbook/comments.php | 12 | ||||
| -rw-r--r-- | guestbook/index.php | 2 | ||||
| -rw-r--r-- | guestbook/submit.php | 33 |
5 files changed, 48 insertions, 9 deletions
diff --git a/guestbook/bg.jxl b/guestbook/bg.jxl Binary files differdeleted file mode 100644 index a386f5e..0000000 --- a/guestbook/bg.jxl +++ /dev/null diff --git a/guestbook/comments.css b/guestbook/comments.css index 031320f..91628cf 100644 --- a/guestbook/comments.css +++ b/guestbook/comments.css @@ -12,7 +12,7 @@ form > table { margin-bottom: 1.5rem; } -article { +.comment { width: 100%; margin: 2rem auto; display: grid; @@ -24,7 +24,7 @@ article { 'gb-message gb-message gb-message' 'gb-reply gb-reply gb-reply'; } -article :is(h1,h2,h3,h4,h5,h6) { +.comment :is(h1,h2,h3,h4,h5,h6) { border: none; padding-left: initial; } @@ -86,7 +86,7 @@ input[type="submit"]:hover, input[type="reset"]:hover { .gb-index { text-align: right; } -.gb-cool { +.gb-cool, .gb-found { word-break: break-all; } .gb-name, .gb-date, .gb-index { @@ -105,11 +105,11 @@ input[type="submit"]:hover, input[type="reset"]:hover { border: 2px solid #00000033; border-bottom: 2px solid #888888; } - article { + .comment { margin: 2rem auto; } @media (max-width: 43rem) { - article { + .comment { grid-template-areas: 'gb-name gb-name gb-index' 'gb-date gb-date gb-date' diff --git a/guestbook/comments.php b/guestbook/comments.php index 3f65fb9..432c1d2 100644 --- a/guestbook/comments.php +++ b/guestbook/comments.php @@ -18,13 +18,19 @@ function echo_comments($page, $Parsedown = null) { $message = $Parsedown->text($post->message); $found = htmlentities($post->found); $website = $post->website; + $button = $post->button; $cool = $post->cool; $coolsanitized = htmlentities(preg_replace("/https?:\/\//i", "", $cool)); $reply = $Parsedown->text($post->reply); - $output = $output."<hr><article><div style='grid-area:gb-name;' class='gb-name'>"; - if($website) { $output = $output."<a href='$website'>$name</a>"; } - else { $output = $output.$name; } + $output = $output."<hr><article class='comment'><div style='grid-area:gb-name;' class='gb-name'>"; + if($website) { + if($button) { + $output = $output."<a href='$website'><img src='$button' alt='$name'/></a>"; + } else { + $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>"; if($cool) { $output = $output."<div style='grid-area:gb-cool;' class='gb-cool'><b>cool thing</b>: <a href='$cool'>$coolsanitized</a></div>"; diff --git a/guestbook/index.php b/guestbook/index.php index 8908e25..299bf96 100644 --- a/guestbook/index.php +++ b/guestbook/index.php @@ -22,7 +22,7 @@ error_reporting(E_ALL); <?php include($_SERVER['DOCUMENT_ROOT'] . '/nav.php'); bg(); include($_SERVER['DOCUMENT_ROOT'] . '/common.php'); ?> <h1>guestbook</h1> - <h2 id="caption">say hi!</h2> + <h2 id="caption">say hi</h2> <nav> <a href="feed.php">RSS</a> </nav> diff --git a/guestbook/submit.php b/guestbook/submit.php index 0e53fb3..bb745a2 100644 --- a/guestbook/submit.php +++ b/guestbook/submit.php @@ -52,6 +52,38 @@ error_reporting(E_ALL); $returnCode = "review"; } + $button = ""; // URL for the submitter's .well-known/button.json + if($_POST["website"]) { + $buttonjson = ""; + $buttonjsonurl = 'https://'.parse_url($_POST["website"], PHP_URL_HOST).'/.well-known/button.json'; + + $ch = curl_init($buttonjsonurl); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, 0); + + $buttonjson = curl_exec($ch); + if(curl_error($ch)) { + //echo curl_error($ch); + $buttonjson = ""; + } + curl_close($ch); + + if($buttonjson) { + $buttonobj = json_decode($buttonjson); + if($buttonobj->default) { + foreach ($buttonobj->buttons as $btn) { + if($btn->id === $buttonobj->default) { + $button = $btn->uri; + break; + } + } + } else { + $button = $buttonobj->buttons[0]->uri; + } + } + } + $currentPost = array( "entry" => $_POST["entry"], "sourceip" => $sourceip, @@ -61,6 +93,7 @@ error_reporting(E_ALL); "found" => $_POST["found"], "website" => $_POST["website"], + "button" => $button, "cool" => $_POST["cool"], "reply" => "", "modstatus" => $modstatus |
