From 14f682da75a74fdb6df2203a8bf799b03f5c8f8d Mon Sep 17 00:00:00 2001 From: Daku Date: Fri, 20 Jun 2014 00:39:29 +0100 Subject: [PATCH] avoid errors if tag exceeds limit + flash message showing the problem tag --- core/imageboard.pack.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index a76428b2..517b5a5c 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -534,6 +534,11 @@ class Image { continue; } + if(mb_strlen($tag, 'UTF-8') > 255){ + flash_message("The tag below is longer than 255 characters, please use a shorter tag.\n$tag\n"); + continue; + } + $id = $database->get_one( $database->scoreql_to_sql( "SELECT id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)" @@ -562,7 +567,7 @@ class Image { array("tag"=>$tag)); } - log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags), false, array("image_id" => $this->id)); + log_info("core_image", "Tags for Image #{$this->id} set to: ".implode(" ", $tags), null, array("image_id" => $this->id)); $database->cache->delete("image-{$this->id}-tags"); } }