summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG2
-rw-r--r--includes/common.inc19
-rw-r--r--includes/theme.inc74
-rw-r--r--index.php2
-rw-r--r--modules/aggregator.module2
-rw-r--r--modules/aggregator/aggregator.module2
-rw-r--r--modules/blog.module4
-rw-r--r--modules/blog/blog.module4
-rw-r--r--modules/comment.module6
-rw-r--r--modules/comment/comment.module6
-rw-r--r--modules/forum.module3
-rw-r--r--modules/forum/forum.module3
-rw-r--r--modules/import.module2
-rw-r--r--modules/node.module2
-rw-r--r--modules/node/node.module2
-rw-r--r--modules/user.module55
-rw-r--r--modules/user/user.module55
-rw-r--r--themes/xtemplate/xtemplate.theme11
-rw-r--r--themes/xtemplate/xtemplate.xtmpl3
19 files changed, 103 insertions, 154 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 7d1fb3335..2e442cbd9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Drupal x.x.x, xxxx-xx-xx (to be released)
+Drupal 4.3.0, xxxx-xx-xx (to be released)
------------------------
- added support for configurable URLs.
diff --git a/includes/common.inc b/includes/common.inc
index 8ebbc1c26..435318165 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -81,12 +81,25 @@ function throttle($type, $rate) {
}
}
-function check_php_setting($name, $value) {
- if (ini_get($name) != $value) {
- print "<p>Note that the value of PHP's configuration option <code><b>$name</b></code> is incorrect. It should be set to '$value' for Drupal to work properly. Either configure your webserver to support <code>.htaccess</code> files so Drupal's <code>.htaccess</code> file can set it to the proper value, or edit your <code>php.ini</code> file directly. This message will automatically dissapear when the problem has been fixed.</p>";
+function _fix_gpc_magic_array(&$items) {
+ foreach ($items as $k => $i) {
+ if (is_array($i)) _fix_gpc_magic_array($items[$k]);
+ else $items[$k] = stripslashes($i);
}
}
+function fix_gpc_magic() {
+ static $fixed = false;
+ if ($fixed) return;
+ if (ini_get("magic_quotes_gpc") == 0) return;
+
+ _fix_gpc_magic_array($_GET);
+ _fix_gpc_magic_array($_POST);
+ _fix_gpc_magic_array($_COOKIE);
+
+ $fixed = true;
+}
+
function arg($index) {
static $arguments;
diff --git a/includes/theme.inc b/includes/theme.inc
index ac97674c0..5e3aa53bb 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -2,10 +2,10 @@
// $Id$
/**
-* Basic theme
-*
-* @package theme system
-*/
+ * Basic theme
+ *
+ * @package theme system
+ */
class BaseTheme {
var $background = "#ffffff";
var $foreground = "#000000";
@@ -76,10 +76,26 @@ class BaseTheme {
print $output;
}
- function block($subject, $content, $region = "main") {
- global $theme;
-
- $theme->box($subject, $content, $region);
+ /**
+ * Render a block.
+ *
+ * You can style your blocks by defining .block (all blocks),
+ * .block-<i>module</i> (all blocks of module <i>module</i>),
+ * and \#block-<i>module</i>-<i>delta</i> (specific block of
+ * module <i>module</i> with delta <i>delta</i>) in your
+ * theme's CSS.
+ *
+ * @param $block object "indexed with" fields from database
+ * table 'blocks' ($block->module, $block->delta, $block->region,
+ * ...) and fields returned by <i>module</i>_block("view")
+ * ($block->subject, $block->content, ...).
+ */
+ function block($block) {
+ $output = "<div class=\"block block-$block->module\" id=\"block-$block->module-$block->delta\">";
+ $output .= " <div class=\"subject\">$block->subject</div>";
+ $output .= " <div class=\"content\">$block->content</div>";
+ $output .= "</div>";
+ print $output;
}
function footer() {
@@ -91,18 +107,18 @@ class BaseTheme {
} // End of BaseTheme class //
+/**
+ * Return a marker. Used to indicate new comments or required form
+ * fields.
+ */
function theme_mark() {
- /*
- ** Return a marker. Used to indicate new comments or required form
- ** fields.
- */
return "<span class=\"marker\">*</span>";
}
+/**
+ * Return a formatted array of items.
+ */
function theme_item_list($items = array(), $title = NULL) {
- /*
- ** Return a formatted array of items.
- */
$output .= "<div class=\"item-list\">";
if (isset($title)) {
$output .= "<div class=\"title\">$title</div>";
@@ -119,10 +135,10 @@ function theme_item_list($items = array(), $title = NULL) {
return $output;
}
+/**
+ * Return an error message.
+ */
function theme_error($message) {
- /*
- ** Return an error message.
- */
return "<div class=\"error\">$message</div>";
}
@@ -158,9 +174,9 @@ function theme_head($main = 0) {
return $output;
}
-/*
- * Execute hook _footer() which is run at the end of the page right before
- * the </body> tag
+/**
+ * Execute hook _footer() which is run at the end of the page right
+ * before the </body> tag
*/
function theme_footer($main = 0) {
$footer = module_invoke_all("footer", $main);
@@ -187,20 +203,20 @@ function theme_init() {
}
/**
- * Render blocks available for $user and $region calling $theme->block($region).
+ * Render blocks available for (global) $user and $region calling $theme->block($block).
*
- * @param string $region main|left|right
+ * @param $region main|left|right
*/
function theme_blocks($region) {
global $user;
$result = db_query("SELECT * FROM {blocks} WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = %d " : "") ."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->module][$block->delta])) && (!$block->path || preg_match($block->path, str_replace("?q=", "", request_uri())))) {
- $block_data = module_invoke($block->module, "block", "view", $block->delta);
- if ($block_data["content"]) {
- theme("block", $block_data["subject"], $block_data["content"], $region);
+ while ($result && ($block = db_fetch_array($result))) {
+ if ((($block['status'] && (!$user->uid || !$block['custom'])) || ($block['custom'] && $user->block[$block['module']][$block['delta']])) && (!$block['path'] || preg_match($block['path'], str_replace("?q=", "", request_uri())))) {
+ $block = array_merge($block, module_invoke($block['module'], 'block', 'view', $block['delta']));
+ if ($block['content']) {
+ theme('block', (object) $block);
}
}
}
@@ -220,7 +236,7 @@ function theme() {
}
}
-/*
+/**
* Call _onload hook in all modules to enable modules to insert javascript
* that will get run once the page has been loaded by the browser
*/
diff --git a/index.php b/index.php
index fc58571b3..35f865a00 100644
--- a/index.php
+++ b/index.php
@@ -5,7 +5,7 @@ include_once "includes/common.inc";
drupal_page_header();
-check_php_setting("magic_quotes_gpc", 0);
+fix_gpc_magic();
menu_build("system");
diff --git a/modules/aggregator.module b/modules/aggregator.module
index f5ec428c4..fd932f3cb 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -748,7 +748,7 @@ function import_page_sources() {
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
+ $output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
theme("header");
theme("box", t("News feeds"), import_page_info());
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index f5ec428c4..fd932f3cb 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -748,7 +748,7 @@ function import_page_sources() {
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
+ $output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
theme("header");
theme("box", t("News feeds"), import_page_info());
diff --git a/modules/blog.module b/modules/blog.module
index b72bb7719..a8a54c4b3 100644
--- a/modules/blog.module
+++ b/modules/blog.module
@@ -126,7 +126,7 @@ function blog_page_user($uid) {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, variable_get("default_nodes_main", 10));
- print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>";
+ print "<div class=\"xml-icon\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>";
}
function blog_page_last() {
@@ -143,7 +143,7 @@ function blog_page_last() {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, variable_get("default_nodes_main", 10));
- print "<div style=\"text-align: right;\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed", array("title" => t("Read the XML version of all blogs."))) ."</div>";
+ print "<div class=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed", array("title" => t("Read the XML version of all blogs."))) ."</div>";
}
function blog_validate(&$node) {
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index b72bb7719..a8a54c4b3 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -126,7 +126,7 @@ function blog_page_user($uid) {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, variable_get("default_nodes_main", 10));
- print "<div style=\"text-align: right\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>";
+ print "<div class=\"xml-icon\">" . l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed/$account->uid", array("title" => t("View the XML version of %username's blog", array("%username" => $account->name)))) . "</div>";
}
function blog_page_last() {
@@ -143,7 +143,7 @@ function blog_page_last() {
node_view(node_load(array("nid" => $node->nid)), 1);
}
print pager_display(NULL, variable_get("default_nodes_main", 10));
- print "<div style=\"text-align: right;\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed", array("title" => t("Read the XML version of all blogs."))) ."</div>";
+ print "<div class=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed", array("title" => t("Read the XML version of all blogs."))) ."</div>";
}
function blog_validate(&$node) {
diff --git a/modules/comment.module b/modules/comment.module
index d5513965a..4f81d029f 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -123,8 +123,8 @@ function comment_settings() {
$output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These thresholds are useful for busy sites which want to hide poor comments from most users."));
$output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?"));
- $output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?"));
- $output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Above comments"), t("Below comments"), t("Above and below")), t("Position of the comment controls box."));
+ $output .= form_select(t("Location of comment submission form"), "comment_form_location", variable_get("comment_form_location", 0), array(t("Display below post or comments"), t("Display on separate page")), t("The location of the comment submission form."));
+ $output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Display above the comments"), t("Display below the comments"), t("Display above and below the comments"), t("Do not display")), t("Position of the comment controls box."));
return $output;
}
@@ -773,7 +773,7 @@ function comment_render($node, $cid = 0) {
** If enabled, show new comment form
*/
- if (user_access("post comments") && node_comment_mode($nid) == 2 && variable_get("comment_new_form", 0)) {
+ if (user_access("post comments") && node_comment_mode($nid) == 2 && variable_get("comment_form_location", 0)) {
theme("box", t("Post new comment"), comment_form(array("nid" => $nid)));
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index d5513965a..4f81d029f 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -123,8 +123,8 @@ function comment_settings() {
$output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These thresholds are useful for busy sites which want to hide poor comments from most users."));
$output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?"));
- $output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?"));
- $output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Above comments"), t("Below comments"), t("Above and below")), t("Position of the comment controls box."));
+ $output .= form_select(t("Location of comment submission form"), "comment_form_location", variable_get("comment_form_location", 0), array(t("Display below post or comments"), t("Display on separate page")), t("The location of the comment submission form."));
+ $output .= form_select(t("Comment controls"), "comment_controls", variable_get("comment_controls", 0), array(t("Display above the comments"), t("Display below the comments"), t("Display above and below the comments"), t("Do not display")), t("Position of the comment controls box."));
return $output;
}
@@ -773,7 +773,7 @@ function comment_render($node, $cid = 0) {
** If enabled, show new comment form
*/
- if (user_access("post comments") && node_comment_mode($nid) == 2 && variable_get("comment_new_form", 0)) {
+ if (user_access("post comments") && node_comment_mode($nid) == 2 && variable_get("comment_form_location", 0)) {
theme("box", t("Post new comment"), comment_form(array("nid" => $nid)));
}
diff --git a/modules/forum.module b/modules/forum.module
index 60691455f..032a6cc73 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -415,9 +415,6 @@ function forum_page() {
if (user_access("access content")) {
if (module_exist("taxonomy")) {
$tid = arg(1);
- if ($op == t("Update settings") && $user->uid) {
- $user = user_save($user, array("sortby" => $sortby, "forum_per_page" => $forum_per_page));
- }
if (arg(2) == "new") {
if ($nid = _forum_new($tid)) {
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 60691455f..032a6cc73 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -415,9 +415,6 @@ function forum_page() {
if (user_access("access content")) {
if (module_exist("taxonomy")) {
$tid = arg(1);
- if ($op == t("Update settings") && $user->uid) {
- $user = user_save($user, array("sortby" => $sortby, "forum_per_page" => $forum_per_page));
- }
if (arg(2) == "new") {
if ($nid = _forum_new($tid)) {
diff --git a/modules/import.module b/modules/import.module
index f5ec428c4..fd932f3cb 100644
--- a/modules/import.module
+++ b/modules/import.module
@@ -748,7 +748,7 @@ function import_page_sources() {
$output .= "<div style=\"margin-left: 20px;\">$feed->description</div><br />";
}
- $output .= "<div style=\"text-align: right\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
+ $output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
theme("header");
theme("box", t("News feeds"), import_page_info());
diff --git a/modules/node.module b/modules/node.module
index 3049a7514..e611697ea 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -927,7 +927,7 @@ function node_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Syndicate");
- $block["content"] = "<div style=\"text-align: center;\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"XML\" title=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
+ $block["content"] = "<div class=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"XML\" title=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
return $block;
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 3049a7514..e611697ea 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -927,7 +927,7 @@ function node_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Syndicate");
- $block["content"] = "<div style=\"text-align: center;\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"XML\" title=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
+ $block["content"] = "<div class=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"XML\" title=\"XML\" />", "node/feed", array("title" => t("Read the XML version of this page."))) ."</div>";
return $block;
}
diff --git a/modules/user.module b/modules/user.module
index 15efff2fe..56a2326f4 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -496,9 +496,11 @@ function user_link($type) {
if ($type == "system") {
global $user;
if ($user->uid) {
- menu("user/edit", t("my account"), "user_page", 8);
+ menu("user", t("my account"), "user_page", 8);
+ menu("user/edit", t("edit account"), "user_page", 0);
menu("user/logout", t("log out"), "user_page", 10);
}
+
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
menu("admin/user/create", t("new user"), "user_admin", 1);
@@ -951,26 +953,6 @@ function user_register($edit = array()) {
return form($output);
}
-
-function user_delete() {
- global $user;
-
- $edit = $_POST["edit"];
-
- if ($edit["confirm"]) {
- watchdog("user", "$user->name deactivated her own account.");
- db_query("UPDATE {users} SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid);
- $output .= t("Your account has been deactivated.");
- }
- else {
- $output .= form_item(t("Confirm Deletion"), t("You are about to deactivate your own user account. In addition, your e-mail address will be removed from the database."));
- $output .= form_hidden("confirm", 1);
- $output .= form_submit(t("Delete account"));
- $output = form($output);
- }
- return $output;
-}
-
function user_edit($edit = array()) {
global $user;
@@ -1075,16 +1057,6 @@ function user_edit($edit = array()) {
return $output;
}
-function user_menu() {
- global $theme;
-
- $links[] = l(t("view user information"), "user/view");
- $links[] = l(t("edit user information"), "user/edit");
- $links[] = l(t("delete account"), "user/delete");
-
- return "<div class=\"user-page-menu\">". theme("links", $links) ."</div>";
-}
-
function user_view($uid = 0) {
global $user;
@@ -1099,7 +1071,6 @@ function user_view($uid = 0) {
$output .= implode("\n", module_invoke_all("user", "view_private", "", $user));
theme("header", $user->name);
- theme("box", t("User account"), user_menu());
theme("box", $user->name, $output);
theme("footer");
}
@@ -1163,20 +1134,11 @@ function user_page() {
theme("box", t("Log in"), $output);
theme("footer");
break;
- case t("Delete account"):
- case "delete":
- $output = user_delete();
- theme("header", t("Delete account"));
- theme("box", t("User account"), user_menu());
- theme("box", t("Delete account"), $output);
- theme("footer");
- break;
case t("Save user information"):
case "edit":
$output = user_edit($edit);
$GLOBALS["theme"] = theme_init();
theme("header", t("Edit user information"));
- theme("box", t("User account"), user_menu());
theme("box", t("Edit user information"), $output);
theme("footer");
break;
@@ -1493,9 +1455,6 @@ function user_admin_edit($edit = array()) {
}
// TODO: this display/edit/validate should be moved to a new profile module implementing the _user hooks
- if ($error) {
- // do nothing
- }
if ($error = user_validate_name($edit["name"])) {
// do nothing
}
@@ -1526,7 +1485,7 @@ function user_admin_edit($edit = array()) {
unset($edit["pass1"], $edit["pass2"]);
if (!$error) {
$account = user_save($account, array_merge($edit, $data));
- $output .= status(t("your user information changes have been saved."));
+ $output .= status(t("user information changes have been saved."));
}
else {
$output .= theme("theme_error", $error);
@@ -1544,6 +1503,10 @@ function user_admin_edit($edit = array()) {
}
}
+ if (!$edit) {
+ $edit = object2array($account);
+ }
+
/*
** Display user form:
*/
@@ -1692,7 +1655,7 @@ function user_help($section = "admin/help#user") {
$output .= t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the %role). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => l(t("user roles page"), "admin/user/role")));
break;
case 'admin/user/role':
- $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles:";
+ $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\".<br />By default, Drupal comes with two user roles:";
$output .= "<ul>";
$output .= "<li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li>";
$output .= "<li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>";
diff --git a/modules/user/user.module b/modules/user/user.module
index 15efff2fe..56a2326f4 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -496,9 +496,11 @@ function user_link($type) {
if ($type == "system") {
global $user;
if ($user->uid) {
- menu("user/edit", t("my account"), "user_page", 8);
+ menu("user", t("my account"), "user_page", 8);
+ menu("user/edit", t("edit account"), "user_page", 0);
menu("user/logout", t("log out"), "user_page", 10);
}
+
if (user_access("administer users")) {
menu("admin/user", t("accounts"), "user_admin", 2);
menu("admin/user/create", t("new user"), "user_admin", 1);
@@ -951,26 +953,6 @@ function user_register($edit = array()) {
return form($output);
}
-
-function user_delete() {
- global $user;
-
- $edit = $_POST["edit"];
-
- if ($edit["confirm"]) {
- watchdog("user", "$user->name deactivated her own account.");
- db_query("UPDATE {users} SET mail = 'deleted', status = '0' WHERE uid = %d", $user->uid);
- $output .= t("Your account has been deactivated.");
- }
- else {
- $output .= form_item(t("Confirm Deletion"), t("You are about to deactivate your own user account. In addition, your e-mail address will be removed from the database."));
- $output .= form_hidden("confirm", 1);
- $output .= form_submit(t("Delete account"));
- $output = form($output);
- }
- return $output;
-}
-
function user_edit($edit = array()) {
global $user;
@@ -1075,16 +1057,6 @@ function user_edit($edit = array()) {
return $output;
}
-function user_menu() {
- global $theme;
-
- $links[] = l(t("view user information"), "user/view");
- $links[] = l(t("edit user information"), "user/edit");
- $links[] = l(t("delete account"), "user/delete");
-
- return "<div class=\"user-page-menu\">". theme("links", $links) ."</div>";
-}
-
function user_view($uid = 0) {
global $user;
@@ -1099,7 +1071,6 @@ function user_view($uid = 0) {
$output .= implode("\n", module_invoke_all("user", "view_private", "", $user));
theme("header", $user->name);
- theme("box", t("User account"), user_menu());
theme("box", $user->name, $output);
theme("footer");
}
@@ -1163,20 +1134,11 @@ function user_page() {
theme("box", t("Log in"), $output);
theme("footer");
break;
- case t("Delete account"):
- case "delete":
- $output = user_delete();
- theme("header", t("Delete account"));
- theme("box", t("User account"), user_menu());
- theme("box", t("Delete account"), $output);
- theme("footer");
- break;
case t("Save user information"):
case "edit":
$output = user_edit($edit);
$GLOBALS["theme"] = theme_init();
theme("header", t("Edit user information"));
- theme("box", t("User account"), user_menu());
theme("box", t("Edit user information"), $output);
theme("footer");
break;
@@ -1493,9 +1455,6 @@ function user_admin_edit($edit = array()) {
}
// TODO: this display/edit/validate should be moved to a new profile module implementing the _user hooks
- if ($error) {
- // do nothing
- }
if ($error = user_validate_name($edit["name"])) {
// do nothing
}
@@ -1526,7 +1485,7 @@ function user_admin_edit($edit = array()) {
unset($edit["pass1"], $edit["pass2"]);
if (!$error) {
$account = user_save($account, array_merge($edit, $data));
- $output .= status(t("your user information changes have been saved."));
+ $output .= status(t("user information changes have been saved."));
}
else {
$output .= theme("theme_error", $error);
@@ -1544,6 +1503,10 @@ function user_admin_edit($edit = array()) {
}
}
+ if (!$edit) {
+ $edit = object2array($account);
+ }
+
/*
** Display user form:
*/
@@ -1692,7 +1655,7 @@ function user_help($section = "admin/help#user") {
$output .= t("In this area you will define the <b>permissions</b> for each user role (role names are defined on the %role). Each permission describes a fine-grained logical operation, such as being able to access the administration pages, or adding/modifying a user account. You could say a permission represents access granted to a user to perform a set of operations.", array("%role" => l(t("user roles page"), "admin/user/role")));
break;
case 'admin/user/role':
- $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\"<br />By default, Drupal comes with two user roles:";
+ $output .= "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users that have certain privileges as defined in %permission. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. In this area you will define the <b>names</b> of the various roles. To delete a role choose \"edit role\".<br />By default, Drupal comes with two user roles:";
$output .= "<ul>";
$output .= "<li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li>";
$output .= "<li>Authenticated user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li>";
diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme
index ab96fa1d8..b850459ca 100644
--- a/themes/xtemplate/xtemplate.theme
+++ b/themes/xtemplate/xtemplate.theme
@@ -126,12 +126,11 @@ class Theme_xtemplate extends BaseTheme {
print $this->template->text("header");
}
- function block($title, $content, $region = "main") {
- $this->template->assign(array(
- "subject" => $title,
- "content" => $content
- ));
-
+ function block(&$block) {
+ // create template variables for all block variables (module, delta, region, subject, content, ...)
+ foreach ($block as $key => $value) {
+ $this->template->assign($key, $value);
+ }
$this->template->parse("block");
print $this->template->text("block");
$this->template->reset("block");
diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl
index 17ca06269..2d74a1ba8 100644
--- a/themes/xtemplate/xtemplate.xtmpl
+++ b/themes/xtemplate/xtemplate.xtmpl
@@ -32,6 +32,7 @@
</td>
</tr>
</table>
+
<table border="0" cellpadding="0" cellspacing="0" id="content">
<tr>
<!-- BEGIN: blocks -->
@@ -83,7 +84,7 @@
<!-- END: box -->
<!-- BEGIN: block -->
- <div class="block">
+ <div class="block block-{module}" id="block-{module}-{delta}">
<div class="title">{subject}</div>
<div class="content">{content}</div>
</div>