From d27945b2b35d527a52344dcb15284a51f5c5ac59 Mon Sep 17 00:00:00 2001 From: swag Date: Fri, 8 Apr 2022 14:17:23 -0400 Subject: [PATCH] Use unique tags for single message view; change status to 404 if page is not found --- guestbook-ng.pl | 2 + templates/layouts/single_message.html.ep | 47 ++++++++++++++++++++++++ templates/message_id.html.ep | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 templates/layouts/single_message.html.ep diff --git a/guestbook-ng.pl b/guestbook-ng.pl index 2dc58ae..0d9f2b5 100755 --- a/guestbook-ng.pl +++ b/guestbook-ng.pl @@ -135,6 +135,8 @@ group { ? $c->message->get_posts($this_page) : $c->message->get_spam($this_page); + $c->stash(status => 404) unless @$view_posts[0]; + $c->stash( view_posts => $view_posts, this_page => $this_page, diff --git a/templates/layouts/single_message.html.ep b/templates/layouts/single_message.html.ep new file mode 100644 index 0000000..f4db412 --- /dev/null +++ b/templates/layouts/single_message.html.ep @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + Swagg::Net::Guestbook - <%= title %> + + <%= asset 'swagg.css' %> + + +
+

Swagg::Net::Guestbook

+ + <% if (flash 'error') { =%> +
+

Stop! You've violated the law:

+

<%= flash 'error' %>

+

Please report to the + <%= link_to 'cyber police', 'mailto:swaggboi@slackware.uk' %>!

+
+ <% } =%> +
+
+
+<%= content =%> +
+
+
+

<%= $post_count %> of <%= $visitor_count %> total visitors have + signed the guestbook to date.

+
+
+ + diff --git a/templates/message_id.html.ep b/templates/message_id.html.ep index 5d67bca..883afcb 100644 --- a/templates/message_id.html.ep +++ b/templates/message_id.html.ep @@ -1,4 +1,4 @@ -% layout 'default'; +% layout 'single_message'; % title 'View';

Messages from the World Wide Web

<% if (@$view_post[0]) { =%>