From c47e15c01b846b09b2a925c946f93072267385f8 Mon Sep 17 00:00:00 2001 From: shish Date: Wed, 24 Oct 2007 18:09:41 +0000 Subject: [PATCH] filetype search from ATravelingGeek git-svn-id: file:///home/shish/svn/shimmie2/trunk@564 7f39781d-f577-437e-ae19-be835c7a54ca --- core/database.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/database.class.php b/core/database.class.php index 74a66712..5623452d 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -160,11 +160,13 @@ class Database { } $img_search->append(new Querylet("AND (images.owner_id = $user_id)")); } - else if(preg_match("/(hash=|md5:)([0-9a-fA-F]*)/i",$term,$matches)) { + else if(preg_match("/(hash=|md5:)([0-9a-fA-F]*)/i", $term, $matches)) { $hash = strtolower($matches[2]); - if(!is_null($hash)) { - $img_search->append(new Querylet("AND (images.hash = '$hash')")); - } + $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);