From 558f8f42c840d2212b323cd5c94152bdcbcf8f64 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 27 Oct 2013 22:55:14 +0100 Subject: [PATCH] Closed #55 --- src/Controllers/PostController.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index b1e093f3..fc3adfac 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -826,11 +826,24 @@ class PostController switch ($key) { + case 'id': + $ids = preg_split('/[;,]/', $val); + $ids = array_map('intval', $ids); + $dbQuery->$andFunc('id')->in('(' . R::genSlots($ids) . ')'); + foreach ($ids as $id) + $dbQuery->put($id); + break; + + case 'idmin': + case 'idmax': + $operator = $key == 'idmin' ? '>=' : '<='; + $dbQuery->$andFunc('id ' . $operator . ' ?')->put(intval($val)); + break; + case 'favmin': case 'favmax': $operator = $key == 'favmin' ? '>=' : '<='; - $dbQuery - ->$andFunc('fav_count ' . $operator . ' ?')->put(intval($val)); + $dbQuery->$andFunc('fav_count ' . $operator . ' ?')->put(intval($val)); break; case 'type':