summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-10-26 15:17:26 +0000
committerDries Buytaert <dries@buytaert.net>2002-10-26 15:17:26 +0000
commit8d103a08984ac2de72d756eb5c5c8d23061ab028 (patch)
treee8cb8b9b2f071a9b7bd2e222d8183e5c27ad6683 /includes/theme.inc
parent2ec14f35ac7d5600e6d03b5cf79f717f43d1cfab (diff)
downloadbrdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.gz
brdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.bz2
- Committed Marco's block rewrite:
+ Blocks are not longer called if not rendered: major performance improvement. + Fixed some bugs (preview option was broken, path option was broken). + Removed "ascii"-type blocks. + Added permission to for "PHP blocks" + ... NOTES: + You'll want to run "update.php": ALTER TABLE blocks DROP remove; ALTER TABLE blocks DROP name; + You'll want to update your custom modules as well as the modules in the contrib repository. Block function should now read: function *_block($op = "list", $delta = 0) { if ($op == "list") { return array of block infos } else { return subject and content of $delta block } }
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc12
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 62239da12..da4d3ca06 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -123,15 +123,15 @@ function theme_init() {
}
function theme_blocks($region, &$theme) {
- global $id, $PHP_SELF, $user;
+ global $user, $PHP_SELF;
- $result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = '%s' " : "") ."ORDER BY weight, name", $region == "left" ? 0 : 1);
+ $result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = '%s' " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1);
while ($result && ($block = db_fetch_object($result))) {
- if (($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->name])) {
- $blocks = module_invoke($block->module, "block");
- if ($blocks[$block->delta]["content"]) {
- $theme->box($blocks[$block->delta]["subject"], $blocks[$block->delta]["content"], $region);
+ if ((($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->module][$block->delta])) && (!$block->path || preg_match("|$block->path|", $PHP_SELF))) {
+ $block_data = module_invoke($block->module, "block", "view", $block->delta);
+ if ($block_data["content"]) {
+ $theme->box($block_data["subject"], $block_data["content"], $region);
}
}
}