diff --git a/core/util.inc.php b/core/util.inc.php
index 4bf59033..7168d610 100644
--- a/core/util.inc.php
+++ b/core/util.inc.php
@@ -687,6 +687,19 @@ function set_prefixed_cookie($name, $value, $time, $path) {
setcookie($full_name, $value, $time, $path);
}
+/**
+ * Set (or extend) a flash-message cookie
+ */
+function flash_message(/*string*/ $text) {
+ $current = get_prefixed_cookie("flash_message");
+ if($current) {
+ $text = $current . "\n" . $text;
+ }
+ # the message should be viewed pretty much immediately,
+ # so 60s timeout should be more than enough
+ set_prefixed_cookie("flash_message", $text, time()+60, "/");
+}
+
/**
* Figure out the path to the shimmie install directory.
*
diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php
index bf9763f2..ee760130 100644
--- a/themes/danbooru/layout.class.php
+++ b/themes/danbooru/layout.class.php
@@ -191,6 +191,13 @@ class Layout {
$withleft = "noleft";
}
+ $flash = get_prefixed_cookie("flash_message");
+ $flash_html = "";
+ if($flash) {
+ $flash_html = "".nl2br(html_escape($flash))." [X]";
+ set_prefixed_cookie("flash_message", "", -1, "/");
+ }
+
print <<
@@ -217,6 +224,7 @@ $header_html
$sub_block_html
$left
+ $flash_html
$main_block_html