summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/block.module12
-rw-r--r--modules/block/block.module12
2 files changed, 18 insertions, 6 deletions
diff --git a/modules/block.module b/modules/block.module
index f507a53d5..9dfaec3ac 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -471,10 +471,12 @@ function block_list($region) {
static $blocks = array();
- if (!isset($blocks[$region])) {
- $blocks[$region] = array();
- $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 AND region = '%s' ORDER BY weight, module", $theme_key, $region);
+ if (!count($blocks)) {
+ $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 ORDER BY region, weight, module", $theme_key);
while ($block = db_fetch_array($result)) {
+ if(!isset($blocks[$block->region])) {
+ $blocks[$block->region] = array();
+ }
// Use the user's block visibility setting, if necessary
if ($block['custom'] != 0) {
if ($user->uid && isset($user->block[$block['module']][$block['delta']])) {
@@ -517,6 +519,10 @@ function block_list($region) {
}
}
}
+ // Create an empty array if there were no entries
+ if(!isset($blocks[$region])) {
+ $blocks[$region] = array();
+ }
return $blocks[$region];
}
diff --git a/modules/block/block.module b/modules/block/block.module
index f507a53d5..9dfaec3ac 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -471,10 +471,12 @@ function block_list($region) {
static $blocks = array();
- if (!isset($blocks[$region])) {
- $blocks[$region] = array();
- $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 AND region = '%s' ORDER BY weight, module", $theme_key, $region);
+ if (!count($blocks)) {
+ $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 ORDER BY region, weight, module", $theme_key);
while ($block = db_fetch_array($result)) {
+ if(!isset($blocks[$block->region])) {
+ $blocks[$block->region] = array();
+ }
// Use the user's block visibility setting, if necessary
if ($block['custom'] != 0) {
if ($user->uid && isset($user->block[$block['module']][$block['delta']])) {
@@ -517,6 +519,10 @@ function block_list($region) {
}
}
}
+ // Create an empty array if there were no entries
+ if(!isset($blocks[$region])) {
+ $blocks[$region] = array();
+ }
return $blocks[$region];
}