diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2002-05-02 19:13:45 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2002-05-02 19:13:45 +0000 |
commit | a4b5005640228b8f5cec843e46c152080f9ff523 (patch) | |
tree | d94ebdbc76f5c238d34220685256274d810375a3 /includes/theme.inc | |
parent | c3a36313aca1468b0e224f47d7f22d0025a8c798 (diff) | |
download | brdo-a4b5005640228b8f5cec843e46c152080f9ff523.tar.gz brdo-a4b5005640228b8f5cec843e46c152080f9ff523.tar.bz2 |
- merged block and box modules. modules/box.module should be removed
or disabled as it will cause errors otherwise.
- split status into status and custom. Status will turn the block
on/off, and custom defined if the user can change the status.
Requires sql update.
- reintroduced user page to configure blocks.
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index f83d545af..63af790bc 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -115,16 +115,14 @@ function theme_init() { function theme_blocks($region, &$theme) { global $id, $PHP_SELF, $user; - if ($user->uid) { - $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status = 1 AND l.uid = '$user->uid'))". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." AND (b.path = '' OR '". strrchr(request_uri(), "/") ."' RLIKE b.path) ORDER BY weight"); - } - else { - $result = db_query("SELECT * FROM blocks WHERE status = 2". (($region == "left" OR $region == "right") ? ($region == "left" ? " AND region = 0" : " AND region = 1") : "") ." ORDER BY weight"); - } + $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); + while ($result && ($block = db_fetch_object($result))) { - $blocks = module_invoke($block->module, "block"); - if ($blocks[$block->delta]["content"]) { - $theme->box(t($blocks[$block->delta]["subject"]), $blocks[$block->delta]["content"], $region); + 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(t($blocks[$block->delta]["subject"]), $blocks[$block->delta]["content"], $region); + } } } } |