diff options
author | gweltas <gweltas@piwigo.org> | 2005-01-18 14:28:47 +0000 |
---|---|---|
committer | gweltas <gweltas@piwigo.org> | 2005-01-18 14:28:47 +0000 |
commit | f760cdb9879ef3eafc0ec88c094c43a81b66e2bc (patch) | |
tree | d65ab7008b223bfd3cddd0e339504d09060024a8 /include/functions_category.inc.php | |
parent | bd9c43e364f002aeb7a8e22c3ccf786ec918cd60 (diff) |
- Author included in "all words" search
git-svn-id: http://piwigo.org/svn/trunk@707 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_category.inc.php')
-rw-r--r-- | include/functions_category.inc.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index f66d8bded..807920947 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -425,27 +425,25 @@ function initialize_category( $calling_page = 'category' ) // construction $clauses = array(); - $textfields = array('file', 'name', 'comment', 'keywords', 'author'); - foreach ($textfields as $textfield) - { - if (isset($search['fields'][$textfield])) + // Author Search + if (isset($search['fields']['author'])) { $local_clauses = array(); - foreach ($search['fields'][$textfield]['words'] as $word) + foreach ($search['fields']['author']['words'] as $word) { - array_push($local_clauses, $textfield." LIKE '%".$word."%'"); + array_push($local_clauses, "author LIKE '%".$word."%'"); } // adds brackets around where clauses array_walk($local_clauses,create_function('&$s','$s="(".$s.")";')); array_push($clauses, - implode(' '.$search['fields'][$textfield]['mode'].' ', + implode(' '.$search['fields']['author']['mode'].' ', $local_clauses)); } - } + // All words search (author included) if (isset($search['fields']['allwords'])) { - $fields = array('file', 'name', 'comment', 'keywords'); + $textfields = array('file', 'name', 'comment', 'keywords', 'author'); // in the OR mode, request bust be : // ((field1 LIKE '%word1%' OR field2 LIKE '%word1%') // OR (field1 LIKE '%word2%' OR field2 LIKE '%word2%')) @@ -457,7 +455,7 @@ function initialize_category( $calling_page = 'category' ) foreach ($search['fields']['allwords']['words'] as $word) { $field_clauses = array(); - foreach ($fields as $field) + foreach ($textfields as $field) { array_push($field_clauses, $field." LIKE '%".$word."%'"); } |