diff options
-rw-r--r-- | includes/database.inc | 4 | ||||
-rw-r--r-- | modules/block/block.module | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/includes/database.inc b/includes/database.inc index 593a4f329..b4bda22b4 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -194,7 +194,9 @@ define('DB_QUERY_REGEXP', '/(%d|%s|%%|%f|%b)/'); * @param $query * Query to be rewritten. * @param $primary_table - * Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary. + * Name or alias of the table which has the primary key field for this query. + * Possible values are: blocks, comments, forum, node, menu, term_data, + * vocabulary. * @param $primary_field * Name of the primary field. * @param $args diff --git a/modules/block/block.module b/modules/block/block.module index 10f3bf1a5..e77dd5637 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -683,7 +683,7 @@ function block_list($region) { static $blocks = array(); if (!count($blocks)) { - $result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (%s) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", $theme_key, implode(',', array_keys($user->roles))); + $result = db_query(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (%s) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", 'b', 'bid'), $theme_key, implode(',', array_keys($user->roles))); while ($block = db_fetch_object($result)) { if (!isset($blocks[$block->region])) { $blocks[$block->region] = array(); |