summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc19
1 files changed, 3 insertions, 16 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index d6a4dd3e4..4a39bc107 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -58,7 +58,7 @@ function theme_account($theme) {
}
-function theme_main_blocks($theme) {
+function theme_blocks($region, $theme) {
global $id, $PHP_SELF, $user;
switch (strtok($PHP_SELF, ".")) {
@@ -68,26 +68,13 @@ function theme_main_blocks($theme) {
else theme_new_headlines($theme);
break;
case "/index":
- theme_account($theme);
- $result = db_query("SELECT * FROM blocks WHERE status = 2");
+ if ($user->id) $result = db_query("SELECT * FROM blocks b LEFT JOIN layout l ON b.name = l.block WHERE (b.status = 2 OR (b.status AND l.user = '$user->id'))". (($region == "left" || $region == "right") ? ($region == "left" ? " AND b.region = 0" : " AND b.region = 1") : "") ." ORDER BY weight");
+ else $result = db_query("SELECT * FROM blocks WHERE status = 2 ORDER BY weight");
while ($block = db_fetch_object($result)) {
$blocks = module_execute($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
}
break;
- default:
- theme_account($theme);
- }
-}
-
-function theme_user_blocks($theme) {
- global $PHP_SELF, $repository, $user;
- if ($user->id && strstr($PHP_SELF, "index.php")) {
- $result = db_query("SELECT * FROM layout l LEFT JOIN blocks b ON l.block = b.name WHERE l.user = '$user->id' AND l.weight > 0 AND b.status = '1' ORDER BY weight");
- while ($block = db_fetch_object($result)) {
- $blocks = module_execute($block->module, "block");
- $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
- }
}
}