From 6bea5d507faa4b1e5283d33d9a36d3e9604a9ecd Mon Sep 17 00:00:00 2001 From: shish Date: Wed, 24 Oct 2007 18:12:33 +0000 Subject: [PATCH] add a couple of search types to branch_2.1 git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.1@565 7f39781d-f577-437e-ae19-be835c7a54ca --- core/database.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index 3317ce5c..b72902dd 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -139,11 +139,13 @@ class Database { } $img_search->append(new Querylet("AND (images.owner_id = $user_id)")); } - else if(preg_match("/hash=([0-9a-fA-F]*)/i",$term,$matches)) { - $hash = strtolower($matches[1]); - if(!is_null($hash)) { - $img_search->append(new Querylet("AND (images.hash = '$hash')")); - } + else if(preg_match("/(hash=|md5:)([0-9a-fA-F]*)/i", $term, $matches)) { + $hash = strtolower($matches[2]); + $img_search->append(new Querylet("AND (images.hash = '$hash')")); + } + else if(preg_match("/(filetype|ext)=([a-zA-Z0-9]*)/i", $term, $matches)) { + $ext = strtolower($matches[2]); + $img_search->append(new Querylet("AND (images.ext = '$ext')")); } else { $term = str_replace("*", "%", $term);