diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 21:39:07 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-07-01 21:39:07 +0000 |
commit | a1a556b8c1904e624650059e7091f6864119cf65 (patch) | |
tree | 33eb4310ea411a63a7e03b1156039d0837ff7e62 | |
parent | b33070d1762aa9f29bea0d6b286713dfad3bc461 (diff) | |
download | brdo-a1a556b8c1904e624650059e7091f6864119cf65.tar.gz brdo-a1a556b8c1904e624650059e7091f6864119cf65.tar.bz2 |
#155282 by Jose A Reyero: apply db_rewrite_sql() to the block listing query to allow for multilingual blocks
-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(); |