From 6e8c3e5cdacd97ca62f4cc0df92ab8d9a09857a9 Mon Sep 17 00:00:00 2001 From: SJ Date: Mon, 13 Apr 2015 20:41:52 +0200 Subject: [PATCH] permission fix for attachment search --- webui/model/search/search.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webui/model/search/search.php b/webui/model/search/search.php index 32c9ec55..f4d1120f 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -215,7 +215,11 @@ class ModelSearchSearch extends Model { if(isset($data['aname']) && $data['aname']) { - $query = $this->sphx->query("SELECT id, mid FROM " . SPHINX_ATTACHMENT_INDEX . " WHERE MATCH('" . $data['aname'] . "') $sortorder LIMIT 0," . MAX_SEARCH_HITS . " OPTION max_matches=" . MAX_SEARCH_HITS); + + $match = $data['aname']; + if($emailfilter) { $match = "( $match ) & $emailfilter"; } + + $query = $this->sphx->query("SELECT id, mid FROM " . SPHINX_ATTACHMENT_INDEX . " WHERE MATCH('" . $match . "') ORDER BY `id` $order LIMIT 0," . MAX_SEARCH_HITS . " OPTION max_matches=" . MAX_SEARCH_HITS); } else if(isset($data['tag']) && $data['tag']) { $id_list = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag');