diff --git a/contrib/danbooru_api/main.php b/contrib/danbooru_api/main.php index 8f0b6c4a..a4b27e16 100644 --- a/contrib/danbooru_api/main.php +++ b/contrib/danbooru_api/main.php @@ -42,6 +42,15 @@ class DanbooruApi extends Extension // execute the danbooru processing code $this->api_danbooru($event); } + if(is_a($event, 'SearchTermParseEvent')) + { + $matches = array(); + if(preg_match("/md5:([0-9a-fA-F]*)/i", $event->term, $matches)) + { + $hash = strtolower($matches[2]); + $event->set_querylet(new Querylet("AND (images.hash = '$hash')")); + } + } } // Danbooru API diff --git a/ext/index/main.php b/ext/index/main.php index 58834b33..d69b5f2c 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -109,7 +109,7 @@ class Index extends Extension { } $event->set_querylet(new Querylet("AND (images.owner_id = $user_id)")); } - else if(preg_match("/(hash=|md5:)([0-9a-fA-F]*)/i", $event->term, $matches)) { + else if(preg_match("/hash=([0-9a-fA-F]*)/i", $event->term, $matches)) { $hash = strtolower($matches[2]); $event->set_querylet(new Querylet("AND (images.hash = '$hash')")); }