aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_search.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2014-03-25 12:53:10 +0000
committerplegall <plg@piwigo.org>2014-03-25 12:53:10 +0000
commit9ce59f1af3895ea827e90ceb3f6a9a27ec4357fb (patch)
tree70aaf45b8fbafcd6ce8a5172151f3d6e11d874b8 /include/functions_search.inc.php
parent3e09f3ea83f4203cbb7f76fd1b9fb086073a353e (diff)
merge r26825 from trunk to branch 2.5
bug 3020 and bug 3021 fixed: additionnal checks in search inputs git-svn-id: http://piwigo.org/svn/branches/2.5@27933 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_search.inc.php')
-rw-r--r--include/functions_search.inc.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index 66be23bb4..8e474019a 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -117,9 +117,13 @@ function get_sql_search_clause($search)
create_function('&$s','$s="(".$s.")";')
);
- array_push(
- $clauses,
- "\n ".
+ // make sure the "mode" is either OR or AND
+ if ($search['fields']['allwords']['mode'] != 'AND' and $search['fields']['allwords']['mode'] != 'OR')
+ {
+ $search['fields']['allwords']['mode'] = 'AND';
+ }
+
+ $clauses[] = "\n ".
implode(
"\n ".
$search['fields']['allwords']['mode'].
@@ -797,4 +801,4 @@ function get_search_results($search_id, $super_order_by, $images_where='')
return get_quick_search_results($search['q'], $super_order_by, $images_where);
}
}
-?> \ No newline at end of file
+?>