diff --git a/account.php b/account.php index a9cd9850e2d..08af23bee4a 100644 --- a/account.php +++ b/account.php @@ -222,23 +222,16 @@ function account_content_edit() { if ($user->id) { $output .= "
\n"; $theme->header(); @@ -257,8 +250,8 @@ function account_content_save($edit) { global $user; if ($user->id) { db_query("DELETE FROM layout WHERE user = $user->id"); - foreach ($edit as $block=>$weight) { - db_query("INSERT INTO layout (user, block, weight) VALUES ('". check_input($user->id) ."', '". check_input($block) ."', '". check_input($weight) ."')"); + foreach (($edit ? $edit : array()) as $block=>$weight) { + db_query("INSERT INTO layout (user, block) VALUES ('". check_input($user->id) ."', '". check_input($block) ."')"); } } } diff --git a/database/database.mysql b/database/database.mysql index ab3685850a1..699407a45a3 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -8,6 +8,16 @@ CREATE TABLE affiliates ( PRIMARY KEY (id) ); +CREATE TABLE blocks ( + name varchar(64) DEFAULT '' NOT NULL, + module varchar(64) DEFAULT '' NOT NULL, + offset tinyint(2) DEFAULT '0' NOT NULL, + status tinyint(2) DEFAULT '0' NOT NULL, + weight tinyint(1) DEFAULT '0' NOT NULL, + region tinyint(1) DEFAULT '0' NOT NULL, + PRIMARY KEY (name) +); + CREATE TABLE boxes ( id tinyint(4) DEFAULT '0' NOT NULL auto_increment, subject varchar(64) DEFAULT '' NOT NULL, @@ -30,13 +40,6 @@ CREATE TABLE bans ( PRIMARY KEY (id) ); -CREATE TABLE blocks ( - name varchar(64) DEFAULT '' NOT NULL, - module varchar(64) DEFAULT '' NOT NULL, - offset tinyint(2) DEFAULT '0' NOT NULL, - status tinyint(2) DEFAULT '0' NOT NULL, - PRIMARY KEY (name) -); CREATE TABLE channel ( id int(11) DEFAULT '0' NOT NULL auto_increment, @@ -100,8 +103,7 @@ CREATE TABLE headlines ( CREATE TABLE layout ( user int(11) DEFAULT '0' NOT NULL, - block varchar(64) DEFAULT '' NOT NULL, - weight int(11) DEFAULT '0' NOT NULL + block varchar(64) DEFAULT '' NOT NULL ); CREATE TABLE modules ( diff --git a/includes/theme.inc b/includes/theme.inc index d6a4dd3e459..4a39bc107c9 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"]); - } } } diff --git a/modules/account.module b/modules/account.module index efcbc9ac181..4d382ccf49c 100644 --- a/modules/account.module +++ b/modules/account.module @@ -1,8 +1,17 @@ -$module = array("cron" => "account_cron", +$module = array("help" => "account_help", + "cron" => "account_cron", "admin" => "account_admin"); +function account_help() { + ?> +The account-module is responsible for maintaining the user database. It automatically handles tasks like registration, authentication, access rights, password retrieval, user settings and much more.
+The required administration can be accomplished through the "account" interface of the administration section. From here administrators can get a quick overview of all registered users and view/edit specific accounts using the links provided. Some useful operations include blocking specific accounts (e.g. a troublesome user) and giving/taking administration permissions. Note that you should only give these permissions to people you trust!
+Check the documentation page for detailed information about user management.
+ +} + function account_cron() { // clean-up user database } @@ -173,10 +182,15 @@ function account_view($name) { function account_admin() { global $op, $edit, $order, $name; + print "overview | helpThis is a small module to manage related and/or affiliate sites. The module exports 2 different blocks with links to the affiliate sites.
+ +} + function affiliate_block() { global $site_url; @@ -77,6 +84,8 @@ function affiliate_admin_display() { function affiliate_admin() { global $op, $id, $name, $link, $contact; + print "overview | helpThe ban module keeps a list of bans in four categories:
+The ban system allows you to use a flexible wild-card ban system. This means you can block all email addresses from a certain domain name, block every username starting with "guest", etc. To do this, you can use the following wild-card characters:
+Examples:
+%@hotmail.com
, %@altavista.%
, %@usa.net
, etc. Used to prevent users from using free-email accounts, which might be used to cause trouble.root
, webmaster
, admin%
, etc. Used to prevent administrator impersonators.Blocks are the boxes visible in the side bars on the left and the right-hand side of the website. They are either exported by the engine or by any of the available modules. To really get your teeth in a drupal website, you are going to have to deal with blocks and administrating blocks in a fairly sophisticated fashion. This means you are going to have to be sensitive to the way the block placement strategy works.
+The placement of blocks is delegated to the administrator but for most blocks, i.e. those called "custom blocks", the sole force behind enabling and disabling them is the user itself.
+An administrator can lay out and arrange the available blocks to fit in two regions: "left" and "right". Regions simply contain blocks. In addition, an administrator can assign each block (within a region) a weight to sort them vertically. The heavy blocks will sink down whereas the light blocks will be positioned at the top.
+As mentioned above, blocks can be arranged to fit in two regions: left and right. For theme builders, each region is identified by a corresponding constant: "left" and "right".
+ +} + function block_page() { global $theme; @@ -25,7 +35,7 @@ function block_page() { function block_admin_save($edit) { foreach ($edit as $key=>$value) { - db_query("UPDATE blocks SET status = '$value' WHERE name = '$key'"); + db_query("UPDATE blocks SET region = '$value[region]', status = '$value[status]', weight = '$value[weight]' WHERE name = '$key'"); } } @@ -37,20 +47,33 @@ function block_admin_display() { // Generate output: $output .= "