diff --git a/core/imageboard/image.php b/core/imageboard/image.php
index f80402ea..f96a40ea 100644
--- a/core/imageboard/image.php
+++ b/core/imageboard/image.php
@@ -686,18 +686,18 @@ class Image
*/
public function set_tags(array $unfiltered_tags): void
{
- global $cache, $database;
+ global $cache, $database, $page;
$unfiltered_tags = array_unique($unfiltered_tags);
$tags = [];
foreach ($unfiltered_tags as $tag) {
if (mb_strlen($tag, 'UTF-8') > 255) {
- flash_message("Can't set a tag longer than 255 characters");
+ $page->flash("Can't set a tag longer than 255 characters");
continue;
}
if (startsWith($tag, "-")) {
- flash_message("Can't set a tag which starts with a minus");
+ $page->flash("Can't set a tag which starts with a minus");
continue;
}
diff --git a/core/imageboard/tag.php b/core/imageboard/tag.php
index b65b5313..09f80cd1 100644
--- a/core/imageboard/tag.php
+++ b/core/imageboard/tag.php
@@ -136,12 +136,13 @@ class Tag
public static function sanitize_array(array $tags): array
{
+ global $page;
$tag_array = [];
foreach ($tags as $tag) {
try {
$tag = Tag::sanitize($tag);
} catch (Exception $e) {
- flash_message($e->getMessage());
+ $page->flash($e->getMessage());
continue;
}
diff --git a/core/logging.php b/core/logging.php
index 22a0431d..a00d5ddb 100644
--- a/core/logging.php
+++ b/core/logging.php
@@ -19,6 +19,7 @@ define("SCORE_LOG_NOTSET", 0);
*/
function log_msg(string $section, int $priority, string $message, ?string $flash=null, $args=[])
{
+ global $page;
send_event(new LogEvent($section, $priority, $message, $args));
$threshold = defined("CLI_LOG_LEVEL") ? CLI_LOG_LEVEL : 0;
@@ -26,7 +27,7 @@ function log_msg(string $section, int $priority, string $message, ?string $flash
print date("c")." $section: $message\n";
}
if (!is_null($flash)) {
- flash_message($flash);
+ $page->flash($flash);
}
}
diff --git a/core/page.php b/core/page.php
index c91d3b44..cd64a3c8 100644
--- a/core/page.php
+++ b/core/page.php
@@ -157,6 +157,9 @@ class Page
/** @var Block[] */
public $blocks = [];
+ /** @var string[] */
+ public $flash = [];
+
/**
* Set the HTTP status code
*/
@@ -180,6 +183,11 @@ class Page
$this->subheading = $subheading;
}
+ public function flash(string $message): void
+ {
+ $this->flash[] = $message;
+ }
+
/**
* Add a line to the HTML head section.
*/
@@ -263,6 +271,10 @@ class Page
{
global $page, $user;
+ if (@$_GET["flash"]) {
+ $this->flash[] = $_GET['flash'];
+ }
+
header("HTTP/1.0 {$this->code} Shimmie");
header("Content-type: " . $this->type);
header("X-Powered-By: SCore-" . SCORE_VERSION);
@@ -295,9 +307,6 @@ class Page
# header("Cache-control: no-cache");
# header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 600) . ' GMT');
#}
- if ($this->get_cookie("flash_message") !== null) {
- $this->add_cookie("flash_message", "", -1, "/");
- }
usort($this->blocks, "blockcmp");
$pnbe = new PageNavBuildingEvent();
send_event($pnbe);
@@ -426,6 +435,10 @@ class Page
}
break;
case PageMode::REDIRECT:
+ if ($this->flash) {
+ $this->redirect .= (strpos($this->redirect, "?") === false) ? "?" : "&";
+ $this->redirect .= "flash=" . url_escape(implode("\n", $this->flash));
+ }
header('Location: ' . $this->redirect);
print 'You should be redirected to ' . $this->redirect . '';
break;
diff --git a/core/util.php b/core/util.php
index d19c68f8..71e2a6dc 100644
--- a/core/util.php
+++ b/core/util.php
@@ -132,27 +132,6 @@ function get_session_ip(Config $config): string
}
-/**
- * Set (or extend) a flash-message cookie.
- *
- * This can optionally be done at the same time as saving a log message with log_*()
- *
- * Generally one should flash a message in onPageRequest and log a message wherever
- * the action actually takes place (eg onWhateverElse) - but much of the time, actions
- * are taken from within onPageRequest...
- */
-function flash_message(string $text, string $type="info"): void
-{
- global $page;
- $current = $page->get_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
- $page->add_cookie("flash_message", $text, time()+60, "/");
-}
-
/**
* A shorthand way to send a TextFormattingEvent and get the results.
*/
diff --git a/ext/approval/main.php b/ext/approval/main.php
index a8ef3e2f..8c5ebb96 100644
--- a/ext/approval/main.php
+++ b/ext/approval/main.php
@@ -210,7 +210,7 @@ class Approval extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_approve_image":
@@ -220,7 +220,7 @@ class Approval extends Extension
self::approve_image($image->id);
$total++;
}
- flash_message("Approved $total items");
+ $page->flash("Approved $total items");
}
break;
case "bulk_disapprove_image":
@@ -230,7 +230,7 @@ class Approval extends Extension
self::disapprove_image($image->id);
$total++;
}
- flash_message("Disapproved $total items");
+ $page->flash("Disapproved $total items");
}
break;
}
diff --git a/ext/bulk_actions/main.php b/ext/bulk_actions/main.php
index c8f999d4..fd180754 100644
--- a/ext/bulk_actions/main.php
+++ b/ext/bulk_actions/main.php
@@ -116,13 +116,13 @@ class BulkActions extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_delete":
if ($user->can(Permissions::DELETE_IMAGE)) {
$i = $this->delete_items($event->items);
- flash_message("Deleted $i items");
+ $page->flash("Deleted $i items");
}
break;
case "bulk_tag":
@@ -137,7 +137,7 @@ class BulkActions extends Extension
}
$i= $this->tag_items($event->items, $tags, $replace);
- flash_message("Tagged $i items");
+ $page->flash("Tagged $i items");
}
break;
case "bulk_source":
@@ -147,7 +147,7 @@ class BulkActions extends Extension
if ($user->can(Permissions::BULK_EDIT_IMAGE_SOURCE)) {
$source = $_POST['bulk_source'];
$i = $this->set_source($event->items, $source);
- flash_message("Set source for $i items");
+ $page->flash("Set source for $i items");
}
break;
}
@@ -215,6 +215,7 @@ class BulkActions extends Extension
private function delete_items(iterable $items): int
{
+ global $page;
$total = 0;
foreach ($items as $image) {
try {
@@ -227,7 +228,7 @@ class BulkActions extends Extension
send_event(new ImageDeletionEvent($image));
$total++;
} catch (Exception $e) {
- flash_message("Error while removing {$image->id}: " . $e->getMessage(), "error");
+ $page->flash("Error while removing {$image->id}: " . $e->getMessage(), "error");
}
}
return $total;
@@ -275,13 +276,14 @@ class BulkActions extends Extension
private function set_source(iterable $items, String $source): int
{
+ global $page;
$total = 0;
foreach ($items as $image) {
try {
send_event(new SourceSetEvent($image, $source));
$total++;
} catch (Exception $e) {
- flash_message("Error while setting source for {$image->id}: " . $e->getMessage(), "error");
+ $page->flash("Error while setting source for {$image->id}: " . $e->getMessage(), "error");
}
}
return $total;
diff --git a/ext/comment/main.php b/ext/comment/main.php
index 2b954331..91acc6f4 100644
--- a/ext/comment/main.php
+++ b/ext/comment/main.php
@@ -203,7 +203,7 @@ class CommentList extends Extension
// FIXME: post, not args
if ($event->count_args() === 3) {
send_event(new CommentDeletionEvent($event->get_arg(1)));
- flash_message("Deleted comment");
+ $page->flash("Deleted comment");
$page->set_mode(PageMode::REDIRECT);
if (!empty($_SERVER['HTTP_REFERER'])) {
$page->set_redirect($_SERVER['HTTP_REFERER']);
@@ -232,7 +232,7 @@ class CommentList extends Extension
foreach ($comment_ids as $cid) {
send_event(new CommentDeletionEvent($cid));
}
- flash_message("Deleted $num comments");
+ $page->flash("Deleted $num comments");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("admin"));
diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index 8c7e1da3..f51607fb 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -107,6 +107,7 @@ class CronUploader extends Extension
private function restage_folder(string $folder)
{
+ global $page;
if (empty($folder)) {
throw new Exception("folder empty");
}
@@ -122,7 +123,7 @@ class CronUploader extends Extension
$results = get_dir_contents($queue_dir);
if (count($results) > 0) {
- flash_message("Queue folder must be empty to re-stage", "error");
+ $page->flash("Queue folder must be empty to re-stage", "error");
return;
}
@@ -130,9 +131,9 @@ class CronUploader extends Extension
if (count($results) == 0) {
if (rmdir($stage_dir)===false) {
- flash_message("Nothing to stage from $folder, cannot remove folder");
+ $page->flash("Nothing to stage from $folder, cannot remove folder");
} else {
- flash_message("Nothing to stage from $folder, removing folder");
+ $page->flash("Nothing to stage from $folder, removing folder");
}
return;
}
@@ -144,15 +145,16 @@ class CronUploader extends Extension
rename($original_path, $new_path);
}
- flash_message("Re-staged $folder to queue");
+ $page->flash("Re-staged $folder to queue");
rmdir($stage_dir);
}
private function clear_folder($folder)
{
+ global $page;
$path = join_path(CronUploaderConfig::get_dir(), $folder);
deltree($path);
- flash_message("Cleared $path");
+ $page->flash("Cleared $path");
}
diff --git a/ext/favorites/main.php b/ext/favorites/main.php
index f4791dab..64b15503 100644
--- a/ext/favorites/main.php
+++ b/ext/favorites/main.php
@@ -165,7 +165,7 @@ class Favorites extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_favorite":
@@ -175,7 +175,7 @@ class Favorites extends Extension
send_event(new FavoriteSetEvent($image->id, $user, true));
$total++;
}
- flash_message("Added $total items to favorites");
+ $page->flash("Added $total items to favorites");
}
break;
case "bulk_unfavorite":
@@ -185,7 +185,7 @@ class Favorites extends Extension
send_event(new FavoriteSetEvent($image->id, $user, false));
$total++;
}
- flash_message("Removed $total items from favorites");
+ $page->flash("Removed $total items from favorites");
}
break;
}
diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php
index 0df4ee4d..be90ab67 100644
--- a/ext/image_hash_ban/main.php
+++ b/ext/image_hash_ban/main.php
@@ -90,11 +90,11 @@ class ImageBan extends Extension
if ($hash) {
send_event(new AddImageHashBanEvent($hash, $reason));
- flash_message("Image ban added");
+ $page->flash("Image ban added");
if ($image) {
send_event(new ImageDeletionEvent($image));
- flash_message("Image deleted");
+ $page->flash("Image deleted");
}
$page->set_mode(PageMode::REDIRECT);
@@ -104,7 +104,7 @@ class ImageBan extends Extension
$user->ensure_authed();
$input = validate_input(["d_hash"=>"string"]);
send_event(new RemoveImageHashBanEvent($input['d_hash']));
- flash_message("Image ban removed");
+ $page->flash("Image ban removed");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect($_SERVER['HTTP_REFERER']);
} elseif ($event->get_arg(0) == "list") {
diff --git a/ext/ipban/main.php b/ext/ipban/main.php
index c96c2c34..e57baa32 100644
--- a/ext/ipban/main.php
+++ b/ext/ipban/main.php
@@ -93,6 +93,8 @@ class IPBan extends Extension
{
global $cache, $config, $database, $page, $user, $_shm_user_classes;
+ $d = @$_GET['DEBUG'];
+
// Get lists of banned IPs and banned networks
$ips = $cache->get("ip_bans");
$networks = $cache->get("network_bans");
@@ -130,6 +132,12 @@ class IPBan extends Extension
}
}
+ if ($d) {
+ print($remote);
+ print("\n");
+ print($active_ban_id);
+ print("\n");
+ }
// If an active ban is found, act on it
if (!is_null($active_ban_id)) {
$row = $database->get_row("SELECT * FROM bans WHERE id=:id", ["id"=>$active_ban_id]);
@@ -181,14 +189,14 @@ class IPBan extends Extension
$user->ensure_authed();
$input = validate_input(["c_ip"=>"string", "c_mode"=>"string", "c_reason"=>"string", "c_expires"=>"optional,date"]);
send_event(new AddIPBanEvent($input['c_ip'], $input['c_mode'], $input['c_reason'], $input['c_expires']));
- flash_message("Ban for {$input['c_ip']} added");
+ $page->flash("Ban for {$input['c_ip']} added");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("ip_ban/list"));
} elseif ($event->get_arg(0) == "delete") {
$user->ensure_authed();
$input = validate_input(["d_id"=>"int"]);
send_event(new RemoveIPBanEvent($input['d_id']));
- flash_message("Ban removed");
+ $page->flash("Ban removed");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("ip_ban/list"));
} elseif ($event->get_arg(0) == "list") {
diff --git a/ext/media/main.php b/ext/media/main.php
index 55a62653..f71c7874 100644
--- a/ext/media/main.php
+++ b/ext/media/main.php
@@ -157,7 +157,7 @@ class Media extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_media_rescan":
@@ -172,7 +172,7 @@ class Media extends Extension
$failed++;
}
}
- flash_message("Scanned media properties for $total items, failed for $failed");
+ $page->flash("Scanned media properties for $total items, failed for $failed");
}
break;
}
diff --git a/ext/not_a_tag/main.php b/ext/not_a_tag/main.php
index 43975956..d6cc0289 100644
--- a/ext/not_a_tag/main.php
+++ b/ext/not_a_tag/main.php
@@ -114,11 +114,11 @@ class NotATag extends Extension
$input = validate_input(["d_tag"=>"string"]);
$database->execute(
$database->scoreql_to_sql(
- "DELETE FROM untags WHERE LOWER(tag) = LOWER(:tag)"
+ "DELETE FROM untags WHERE LOWER(tag) = LOWER(:tag)"
),
["tag"=>$input['d_tag']]
);
- flash_message("Image ban removed");
+ $page->flash("Image ban removed");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect($_SERVER['HTTP_REFERER']);
} elseif ($event->get_arg(0) == "list") {
diff --git a/ext/pm/main.php b/ext/pm/main.php
index 6a01b527..b0d5d874 100644
--- a/ext/pm/main.php
+++ b/ext/pm/main.php
@@ -164,7 +164,7 @@ class PrivMsg extends Extension
$subject = $_POST["subject"];
$message = $_POST["message"];
send_event(new SendPMEvent(new PM($from_id, $_SERVER["REMOTE_ADDR"], $to_id, $subject, $message)));
- flash_message("PM sent");
+ $page->flash("PM sent");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect($_SERVER["HTTP_REFERER"]);
}
diff --git a/ext/rating/main.php b/ext/rating/main.php
index a22b492d..b08f86a8 100644
--- a/ext/rating/main.php
+++ b/ext/rating/main.php
@@ -357,7 +357,7 @@ class Ratings extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_rate":
@@ -371,7 +371,7 @@ class Ratings extends Extension
send_event(new RatingSetEvent($image, $rating));
$total++;
}
- flash_message("Rating set for $total items");
+ $page->flash("Rating set for $total items");
}
break;
}
diff --git a/ext/regen_thumb/main.php b/ext/regen_thumb/main.php
index 5be9b5f7..bb60d726 100644
--- a/ext/regen_thumb/main.php
+++ b/ext/regen_thumb/main.php
@@ -63,7 +63,7 @@ class RegenThumb extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_regen":
@@ -80,7 +80,7 @@ class RegenThumb extends Extension
$total++;
}
}
- flash_message("Regenerated thumbnails for $total items");
+ $page->flash("Regenerated thumbnails for $total items");
}
break;
}
@@ -93,6 +93,7 @@ class RegenThumb extends Extension
public function onAdminAction(AdminActionEvent $event)
{
+ global $page;
switch ($event->action) {
case "regen_thumbs":
$event->redirect = true;
@@ -128,7 +129,7 @@ class RegenThumb extends Extension
break;
}
}
- flash_message("Re-generated $i thumbnails");
+ $page->flash("Re-generated $i thumbnails");
break;
case "delete_thumbs":
$event->redirect = true;
@@ -144,11 +145,11 @@ class RegenThumb extends Extension
$i++;
}
}
- flash_message("Deleted $i thumbnails for ".$_POST["delete_thumb_type"]." images");
+ $page->flash("Deleted $i thumbnails for ".$_POST["delete_thumb_type"]." images");
} else {
$dir = "data/thumbs/";
$this->remove_dir_recursively($dir);
- flash_message("Deleted all thumbnails");
+ $page->flash("Deleted all thumbnails");
}
diff --git a/ext/rule34/main.php b/ext/rule34/main.php
index 4499832e..8af88b71 100644
--- a/ext/rule34/main.php
+++ b/ext/rule34/main.php
@@ -108,7 +108,7 @@ class Rule34 extends Extension
if (preg_match_all("/([a-fA-F0-9]{32})/", $all, $matches)) {
$matches = $matches[0];
foreach ($matches as $hash) {
- flash_message("Cleaning {$hash}");
+ $page->flash("Cleaning {$hash}");
if (strlen($hash) != 32) {
continue;
}
diff --git a/ext/setup/main.php b/ext/setup/main.php
index 8fdd764c..adf30fbc 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -295,8 +295,7 @@ class Setup extends Extension
} elseif ($event->get_arg(0) == "save" && $user->check_auth_token()) {
send_event(new ConfigSaveEvent($config));
$config->save();
- flash_message("Config saved");
-
+ $page->flash("Config saved");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("setup"));
} elseif ($event->get_arg(0) == "advanced") {
diff --git a/ext/transcode/main.php b/ext/transcode/main.php
index 214b5816..28a7e805 100644
--- a/ext/transcode/main.php
+++ b/ext/transcode/main.php
@@ -166,7 +166,7 @@ class TranscodeImage extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user, $database;
+ global $user, $database, $page;
switch ($event->action) {
case self::ACTION_BULK_TRANSCODE:
@@ -195,7 +195,7 @@ class TranscodeImage extends Extension
}
}
}
- flash_message("Transcoded $total items");
+ $page->flash("Transcoded $total items");
}
break;
}
diff --git a/ext/trash/main.php b/ext/trash/main.php
index 68ce366e..7a246ca3 100644
--- a/ext/trash/main.php
+++ b/ext/trash/main.php
@@ -133,7 +133,7 @@ class Trash extends Extension
public function onBulkAction(BulkActionEvent $event)
{
- global $user;
+ global $page, $user;
switch ($event->action) {
case "bulk_trash_restore":
@@ -143,7 +143,7 @@ class Trash extends Extension
self::set_trash($image->id, false);
$total++;
}
- flash_message("Restored $total items from trash");
+ $page->flash("Restored $total items from trash");
}
break;
}
diff --git a/ext/user/main.php b/ext/user/main.php
index 9e319f33..0745388c 100644
--- a/ext/user/main.php
+++ b/ext/user/main.php
@@ -563,11 +563,11 @@ class UserPage extends Extension
private function change_name_wrapper(User $duser, $name)
{
- global $user;
+ global $page, $user;
if ($user->can(Permissions::EDIT_USER_NAME) && $this->user_can_edit_user($user, $duser)) {
$duser->set_name($name);
- flash_message("Username changed");
+ $page->flash("Username changed");
// TODO: set login cookie if user changed themselves
$this->redirect_to_user($duser);
} else {
@@ -577,7 +577,7 @@ class UserPage extends Extension
private function change_password_wrapper(User $duser, string $pass1, string $pass2)
{
- global $user;
+ global $page, $user;
if ($this->user_can_edit_user($user, $duser)) {
if ($pass1 != $pass2) {
@@ -590,7 +590,7 @@ class UserPage extends Extension
$this->set_login_cookie($duser->name, $pass1);
}
- flash_message("Password changed");
+ $page->flash("Password changed");
$this->redirect_to_user($duser);
}
}
@@ -598,23 +598,23 @@ class UserPage extends Extension
private function change_email_wrapper(User $duser, string $address)
{
- global $user;
+ global $page, $user;
if ($this->user_can_edit_user($user, $duser)) {
$duser->set_email($address);
- flash_message("Email changed");
+ $page->flash("Email changed");
$this->redirect_to_user($duser);
}
}
private function change_class_wrapper(User $duser, string $class)
{
- global $user;
+ global $page, $user;
if ($user->class->name == "admin") {
$duser->set_class($class);
- flash_message("Class changed");
+ $page->flash("Class changed");
$this->redirect_to_user($duser);
}
}
diff --git a/themes/danbooru/layout.class.php b/themes/danbooru/layout.class.php
index 7c36d08b..d3c1d4df 100644
--- a/themes/danbooru/layout.class.php
+++ b/themes/danbooru/layout.class.php
@@ -125,11 +125,7 @@ class Layout
$withleft = "noleft";
}
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/danbooru2/layout.class.php b/themes/danbooru2/layout.class.php
index eba4e346..cedfed6a 100644
--- a/themes/danbooru2/layout.class.php
+++ b/themes/danbooru2/layout.class.php
@@ -125,11 +125,7 @@ class Layout
$withleft = "noleft";
}
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/default/layout.class.php b/themes/default/layout.class.php
index 9d6e80d6..fe6af251 100644
--- a/themes/default/layout.class.php
+++ b/themes/default/layout.class.php
@@ -45,11 +45,7 @@ class Layout
$wrapper = ' style="height: 3em; overflow: auto;"';
}
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php
index 98076afb..b6c0f281 100644
--- a/themes/futaba/layout.class.php
+++ b/themes/futaba/layout.class.php
@@ -50,11 +50,7 @@ class Layout
$withleft = "";
}
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php
index 2cbf1ccd..a88b2a0e 100644
--- a/themes/lite/layout.class.php
+++ b/themes/lite/layout.class.php
@@ -82,11 +82,7 @@ class Layout
$main_block_html = "{$main_block_html}";
}
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if (!empty($flash)) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/material/layout.class.php b/themes/material/layout.class.php
index d74df253..fa6887de 100644
--- a/themes/material/layout.class.php
+++ b/themes/material/layout.class.php
@@ -92,11 +92,7 @@ class Layout
}
*/
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<
diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php
index 1d3017fb..ec3c847a 100644
--- a/themes/warm/layout.class.php
+++ b/themes/warm/layout.class.php
@@ -54,11 +54,7 @@ class Layout
}
*/
- $flash = $page->get_cookie("flash_message");
- $flash_html = "";
- if ($flash) {
- $flash_html = "".nl2br(html_escape($flash))." [X]";
- }
+ $flash_html = $page->flash ? "".nl2br(html_escape(implode("\n", $flash)))."" : "";
print <<