diff options
author | plegall <plg@piwigo.org> | 2005-01-19 23:52:59 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-01-19 23:52:59 +0000 |
commit | 351aae658fb11f323de8769466f18eca27055560 (patch) | |
tree | e2d95d18ae37a46d490df3af6ad8296fc02b4b55 | |
parent | da60b94ca0450f7e9656564fbb944cc98d9b913c (diff) |
- back to revision 1.63 + add author in fields list for allwords search
git-svn-id: http://piwigo.org/svn/trunk@710 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/functions_category.inc.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 807920947..d52f24d71 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -425,25 +425,27 @@ function initialize_category( $calling_page = 'category' ) // construction $clauses = array(); - // Author Search - if (isset($search['fields']['author'])) + $textfields = array('file', 'name', 'comment', 'keywords', 'author'); + foreach ($textfields as $textfield) + { + if (isset($search['fields'][$textfield])) { $local_clauses = array(); - foreach ($search['fields']['author']['words'] as $word) + foreach ($search['fields'][$textfield]['words'] as $word) { - array_push($local_clauses, "author LIKE '%".$word."%'"); + array_push($local_clauses, $textfield." LIKE '%".$word."%'"); } // adds brackets around where clauses array_walk($local_clauses,create_function('&$s','$s="(".$s.")";')); array_push($clauses, - implode(' '.$search['fields']['author']['mode'].' ', + implode(' '.$search['fields'][$textfield]['mode'].' ', $local_clauses)); } + } - // All words search (author included) if (isset($search['fields']['allwords'])) { - $textfields = array('file', 'name', 'comment', 'keywords', 'author'); + $fields = 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%')) @@ -455,7 +457,7 @@ function initialize_category( $calling_page = 'category' ) foreach ($search['fields']['allwords']['words'] as $word) { $field_clauses = array(); - foreach ($textfields as $field) + foreach ($fields as $field) { array_push($field_clauses, $field." LIKE '%".$word."%'"); } |