Commit bb08146c authored by Steven Wittens's avatar Steven Wittens
Browse files

- Fixing broken search after sql rewrite patches

- Minor code style fixes.
parent 79f6941e
......@@ -207,10 +207,10 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni
}
}
$where = empty($where) ? '' : '('. implode(') AND (',$where).')';
$join = empty($join) ? '' : implode(' ',$join);
$where = empty($where) ? '' : '('. implode(') AND (', $where) .')';
$join = empty($join) ? '' : implode(' ', $join);
return array($join, $where, $distinct );
return array($join, $where, $distinct);
}
/**
......
......@@ -590,7 +590,7 @@ function node_search($op = 'search', $keys = null) {
return array('remaining' => $remaining, 'total' => $total);
case 'search':
list($join, $where) = _db_rewrite_sql();
$find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1 AND '. $where);
$find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1'. (empty($where) ? '' : ' AND '. $where));
$results = array();
foreach ($find as $item) {
$node = node_load(array('nid' => $item));
......
......@@ -590,7 +590,7 @@ function node_search($op = 'search', $keys = null) {
return array('remaining' => $remaining, 'total' => $total);
case 'search':
list($join, $where) = _db_rewrite_sql();
$find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1 AND '. $where);
$find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join .' INNER JOIN {users} u ON n.uid = u.uid', 'n.status = 1'. (empty($where) ? '' : ' AND '. $where));
$results = array();
foreach ($find as $item) {
$node = node_load(array('nid' => $item));
......
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