From a6f8ce2a147713ee426e2e2b390c922a564338b5 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 17 Feb 2012 01:43:49 +0000 Subject: [PATCH] better search by date --- ext/index/main.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/index/main.php b/ext/index/main.php index 3494edef..f5e583df 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -226,9 +226,10 @@ class Index extends Extension { $filename = strtolower($matches[2]); $event->add_querylet(new Querylet('images.filename LIKE "%'.$filename.'%"')); } - else if(preg_match("/^posted=(([0-9\*]*)?(-[0-9\*]*)?(-[0-9\*]*)?)$/", $event->term, $matches)) { - $val = str_replace("*", "%", $matches[1]); - $event->add_querylet(new Querylet('images.posted LIKE "%'.$val.'%"')); + else if(preg_match("/^posted(<|>|<=|>=|=)([0-9-]*)$/", $event->term, $matches)) { + $cmp = $matches[1]; + $val = $matches[2]; + $event->add_querylet(new Querylet("images.posted $cmp :val", array("val"=>$val))); } else if(preg_match("/^size(<|>|<=|>=|=)(\d+)x(\d+)$/", $event->term, $matches)) { $cmp = $matches[1];