summaryrefslogtreecommitdiff
path: root/modules/block
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-09-14 21:37:11 +0000
committerDries Buytaert <dries@buytaert.net>2005-09-14 21:37:11 +0000
commitda74bce9bc791809dd5b0bd16385ae3f06e6058a (patch)
treedc76fbc6225c191a9a3f33ac5bf5536ab13d9891 /modules/block
parent4005922332b3f51f86e29507ea1e19e179119493 (diff)
downloadbrdo-da74bce9bc791809dd5b0bd16385ae3f06e6058a.tar.gz
brdo-da74bce9bc791809dd5b0bd16385ae3f06e6058a.tar.bz2
- Patch #30801 by Allie Micka, m3avrck, 1uv4t4r et al: fixed block problems.
Diffstat (limited to 'modules/block')
-rw-r--r--modules/block/block.module34
1 files changed, 18 insertions, 16 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 9dfaec3ac..576ca1a10 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -473,17 +473,17 @@ function block_list($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)) {
+ while ($block = db_fetch_object($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']])) {
- $enabled = $user->block[$block['module']][$block['delta']];
+ if ($block->custom != 0) {
+ if ($user->uid && isset($user->block[$block->module][$block->delta])) {
+ $enabled = $user->block[$block->module][$block->delta];
}
else {
- $enabled = ($block['custom'] == 1);
+ $enabled = ($block->custom == 1);
}
}
else {
@@ -491,30 +491,32 @@ function block_list($region) {
}
// Match path if necessary
- if ($block['pages']) {
- if ($block['visibility'] < 2) {
+ if ($block->pages) {
+ if ($block->visibility < 2) {
$path = drupal_get_path_alias($_GET['q']);
- $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block['pages'], '/')) .')$/';
- $page_match = !($block['visibility'] xor preg_match($regexp, $path));
+ $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block->pages, '/')) .')$/';
+ $page_match = !($block->visibility xor preg_match($regexp, $path));
}
else {
- $page_match = drupal_eval($block['pages']);
+ $page_match = drupal_eval($block->pages);
}
}
else {
$page_match = TRUE;
}
+
if ($enabled && $page_match) {
// Check the current throttle status and see if block should be displayed
// based on server load.
- if (!($block['throttle'] && (module_invoke('throttle', 'status') > 0))) {
- $array = module_invoke($block['module'], 'block', 'view', $block['delta']);
- if (is_array($array)) {
- $block = array_merge($block, $array);
+ if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
+ if (is_array($array = module_invoke($block->module, 'block', 'view', $block->delta))) {
+ foreach ($array as $k => $v) {
+ $block->$k = $v;
+ }
}
}
- if (isset($block['content']) && $block['content']) {
- $blocks[$region]["$block[module]_$block[delta]"] = (object) $block;
+ if (isset($block->content) && $block->content) {
+ $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
}
}
}