aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/functions.inc.php32
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();