Commit 30230392 authored by Nigel McNie's avatar Nigel McNie
Browse files

Properly quote the "group" field as MySQL thinks that it's a keyword. Fixes #1796.

parent eed4bd45
...@@ -410,11 +410,11 @@ class PluginSearchInternal extends PluginSearch { ...@@ -410,11 +410,11 @@ class PluginSearchInternal extends PluginSearch {
)"; )";
$values = array($query_string, $query_string); $values = array($query_string, $query_string);
if (!$all) { if (!$all) {
$sql .= "AND ( $sql .= 'AND (
owner = ? OR id IN ( owner = ? OR id IN (
SELECT group FROM {group_member} WHERE member = ? SELECT "group" FROM {group_member} WHERE member = ?
) )
)"; )';
$values[] = $USER->get('id'); $values[] = $USER->get('id');
$values[] = $USER->get('id'); $values[] = $USER->get('id');
} }
...@@ -430,12 +430,12 @@ class PluginSearchInternal extends PluginSearch { ...@@ -430,12 +430,12 @@ class PluginSearchInternal extends PluginSearch {
OR description LIKE '%' || ? || '%' OR description LIKE '%' || ? || '%'
)"; )";
if (!$all) { if (!$all) {
$sql .= "AND ( $sql .= 'AND (
owner = ? OR id IN ( owner = ? OR id IN (
SELECT group FROM {group_member} WHERE member = ? SELECT "group" FROM {group_member} WHERE member = ?
) )
) )
"; ';
} }
$count = get_field_sql($sql, $values); $count = get_field_sql($sql, $values);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment