diff options
author | plegall <plg@piwigo.org> | 2006-01-27 22:40:51 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2006-01-27 22:40:51 +0000 |
commit | 61668e4cf7627f3f2d56d92c6e80ff72b38965fa (patch) | |
tree | 052c70867a98c6fb8a0e8d721c0e317e2e0d68ad /include | |
parent | a8fd5ee6cf5cf061ed0ff789d6030290b3418be5 (diff) |
Search engine redesign, second part :
improvement: in category.php, an icon opening a popup display the list of
search rules.
modification: function get_search_array is responsible of search rules
retrieving from database. This function is called from get_sql_search_clause
and from search_rules.php
modification: ability to search multiple authors. Warning: this version of
search tool can't search author names including any blank space.
git-svn-id: http://piwigo.org/svn/trunk@1015 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/functions.inc.php | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index 9586dfc7f..511da391a 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -773,15 +773,13 @@ function prepend_append_array_items($array, $prepend_str, $append_str) } /** - * returns the SQL clause from a search identifier - * - * Search rules are stored in search table as a serialized array. This array - * need to be transformed into an SQL clause to be used in queries. + * returns search rules stored into a serialized array in "search" + * table. Each search rules set is numericaly identified. * * @param int search_id - * @return string + * @return array */ -function get_sql_search_clause($search_id) +function get_search_array($search_id) { if (!is_numeric($search_id)) { @@ -791,16 +789,26 @@ function get_sql_search_clause($search_id) $query = ' SELECT rules FROM '.SEARCH_TABLE.' - WHERE id = '.$_GET['search'].' + WHERE id = '.$search_id.' ;'; list($serialized_rules) = mysql_fetch_row(pwg_query($query)); - $search = unserialize($serialized_rules); - -// echo '<pre>'; -// print_r($search); -// echo '</pre>'; + return unserialize($serialized_rules); +} +/** + * returns the SQL clause from a search identifier + * + * Search rules are stored in search table as a serialized array. This array + * need to be transformed into an SQL clause to be used in queries. + * + * @param int search_id + * @return string + */ +function get_sql_search_clause($search_id) +{ + $search = get_search_array($search_id); + // SQL where clauses are stored in $clauses array during query // construction $clauses = array(); |