From 6d58fe9b324342740d95a734eff7f18076d03542 Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Mon, 10 Feb 2020 13:11:26 -0600 Subject: [PATCH 1/4] Fix invalid type arg --- themes/lite/themelet.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/lite/themelet.class.php b/themes/lite/themelet.class.php index 6759ca10..df5561f4 100644 --- a/themes/lite/themelet.class.php +++ b/themes/lite/themelet.class.php @@ -72,7 +72,7 @@ class Themelet extends BaseThemelet $pages = []; foreach (range($start, $end) as $i) { - $pages[] = $this->litetheme_gen_page_link_block($base_url, $query, $i, $current_page, $i); + $pages[] = $this->litetheme_gen_page_link_block($base_url, $query, $i, $current_page, strval($i)); } $pages_html = implode(" ", $pages); From 152e55b5dbb82325efe7fe773ca5fe0b5766ddbd Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Mon, 10 Feb 2020 14:44:36 -0600 Subject: [PATCH 2/4] Changed Image::by_hash so that it isn't case-sensitive --- core/imageboard/image.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/imageboard/image.php b/core/imageboard/image.php index a6b5b7ff..7e8997cd 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -107,6 +107,7 @@ class Image public static function by_hash(string $hash): ?Image { global $database; + $hash = strtolower($hash); $row = $database->get_row("SELECT images.* FROM images WHERE hash=:hash", ["hash"=>$hash]); return ($row ? new Image($row) : null); } From 30761e6d1f8039e0674ee0de608977d1d83a649c Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Mon, 24 Feb 2020 14:29:27 +0000 Subject: [PATCH 3/4] Added mime check to svg check so that it doesn't try to load every upload into memory --- ext/handle_svg/main.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php index f8c8bef2..84eb19a6 100644 --- a/ext/handle_svg/main.php +++ b/ext/handle_svg/main.php @@ -67,6 +67,10 @@ class SVGFileHandler extends DataHandlerExtension protected function check_contents(string $file): bool { + if (getMimeType($file)!="image/svg+xml") { + return false; + } + $msp = new MiniSVGParser($file); return bool_escape($msp->valid); } From ea96f415c580e7548baf1e86fdfbf78dbef3df53 Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Mon, 24 Feb 2020 14:40:08 +0000 Subject: [PATCH 4/4] Fixed replace creating a new image instead of replacing, fixed null source causing repalce error --- ext/image/main.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/image/main.php b/ext/image/main.php index 48b91696..d3b8b725 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -180,11 +180,13 @@ class ImageIO extends Extension throw new ImageReplaceException($error); } - if (strlen(trim($image->source)) == 0) { + if (strlen(trim($image->source ?? '')) == 0) { $image->source = $existing->get_source(); } // Update the data in the database. + $image->id = $id; + send_event(new MediaCheckPropertiesEvent($image)); $image->save_to_db(); /*