From 61668e4cf7627f3f2d56d92c6e80ff72b38965fa Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 27 Jan 2006 22:40:51 +0000 Subject: 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 --- include/functions.inc.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'include') 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 '
';
-//   print_r($search);
-//   echo '
'; + 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(); -- cgit v1.2.3