diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-06-25 19:33:47 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-06-25 19:33:47 +0000 |
commit | 7b77b90c03f1d2a7c8aa4531c8c3e916348770ce (patch) | |
tree | 21e5850a4fc960b7ad0f3b1f1d0cd7cc45173101 /modules/node | |
parent | b54ff2c810b7bf9bc5240e8def48d9f4abd58466 (diff) | |
download | brdo-7b77b90c03f1d2a7c8aa4531c8c3e916348770ce.tar.gz brdo-7b77b90c03f1d2a7c8aa4531c8c3e916348770ce.tar.bz2 |
- Patch #795174 by Berdir: use %alias in SelectQuery joins and remove workarounds.
Diffstat (limited to 'modules/node')
-rw-r--r-- | modules/node/node.admin.inc | 6 | ||||
-rw-r--r-- | modules/node/node.module | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index 15c0593ad..d20f1983d 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -119,14 +119,12 @@ function node_filters() { function node_build_filter_query(SelectQueryInterface $query) { // Build query $filter_data = isset($_SESSION['node_overview_filter']) ? $_SESSION['node_overview_filter'] : array(); - $counter = 0; foreach ($filter_data as $index => $filter) { list($key, $value) = $filter; switch ($key) { case 'term': - $index = 'ti' . $counter++; - $query->join('taxonomy_index', $index, "n.nid = $index.nid"); - $query->condition($index . '.tid', $value); + $alias = $query->join('taxonomy_index', 'ti', "n.nid = %alias.nid"); + $query->condition($alias . '.tid', $value); break; case 'status': // Note: no exploitable hole as $key/$value have already been checked when submitted diff --git a/modules/node/node.module b/modules/node/node.module index fc75cd795..594df7241 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -3031,15 +3031,15 @@ function node_query_node_access_alter(QueryAlterableInterface $query) { if (!($table instanceof SelectQueryInterface) && $table == 'node') { // The node_access table has the access grants for any given node. - $access_alias = $query->join('node_access', 'na', "na.nid = {$nalias}.nid"); + $access_alias = $query->join('node_access', 'na', '%alias.nid = ' . $nalias . '.nid'); $or = db_or(); // If any grant exists for the specified user, then user has access // to the node for the specified operation. foreach ($grants as $realm => $gids) { foreach ($gids as $gid) { $or->condition(db_and() - ->condition("{$access_alias}.gid", $gid) - ->condition("{$access_alias}.realm", $realm) + ->condition($access_alias . '.gid', $gid) + ->condition($access_alias . '.realm', $realm) ); } } @@ -3048,7 +3048,7 @@ function node_query_node_access_alter(QueryAlterableInterface $query) { $query->condition($or); } - $query->condition("{$access_alias}.grant_$op", 1, '>='); + $query->condition($access_alias . '.grant_' . $op, 1, '>='); } } } |