summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc40
-rw-r--r--modules/node.module3
-rw-r--r--modules/node/node.module3
-rw-r--r--modules/user.module18
-rw-r--r--modules/user/user.module18
-rw-r--r--themes/marvin/marvin.theme2
6 files changed, 45 insertions, 39 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 78eab6609..375754994 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -848,35 +848,35 @@ function form($form, $method = "post", $action = 0, $options = 0) {
if (!$action) {
$action = request_uri();
}
- return "<form action=\"$action\" method=\"$method\"". ($options ? " $options" : "") .">\n$form\n</form>\n";
+ return "<form action=\"$action\" method=\"$method\"". drupal_attributes($options) .">\n$form\n</form>\n";
}
function form_item($title, $value, $description = 0) {
return "<div class=\"form-item\">". ($title ? "<div class=\"title\">$title:</div>" : "") . $value . ($description ? "<div class=\"description\">$description</div>" : "") ."</div>\n";
}
-function form_radio($title, $name, $value = 1, $checked = 0, $description = 0) {
- return form_item(0, "<input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") ." /> $title", $description);
+function form_radio($title, $name, $value = 1, $checked = 0, $description = 0, $attributes = 0) {
+ return form_item(0, "<input type=\"radio\" class=\"form-radio\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) ." /> $title", $description);
}
-function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0) {
- return form_hidden($name, 0) . form_item(0, "<input type=\"checkbox\" class=\"form-checkbox\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") ." /> $title", $description);
+function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0, $attributes = 0) {
+ return form_hidden($name, 0) . form_item(0, "<input type=\"checkbox\" class=\"form-checkbox\" name=\"edit[$name]\" value=\"". $value ."\"". ($checked ? " checked=\"checked\"" : "") . drupal_attributes($attributes) ." /> $title", $description);
}
-function form_textfield($title, $name, $value, $size, $maxlength, $description = 0) {
+function form_textfield($title, $name, $value, $size, $maxlength, $description = 0, $attributes = 0) {
$size = $size ? " size=\"$size\"" : "";
- return form_item($title, "<input type=\"text\" maxlength=\"$maxlength\" class=\"form-text\" name=\"edit[$name]\"$size value=\"". check_form($value) ."\" />", $description);
+ return form_item($title, "<input type=\"text\" maxlength=\"$maxlength\" class=\"form-text\" name=\"edit[$name]\"$size value=\"". check_form($value) ."\"". drupal_attributes($attributes) ." />", $description);
}
-function form_password($title, $name, $value, $size, $maxlength, $description = 0) {
+function form_password($title, $name, $value, $size, $maxlength, $description = 0, $attributes = 0) {
$size = $size ? " size=\"$size\"" : "";
- return form_item($title, "<input type=\"password\" class=\"form-password\" maxlength=\"$maxlength\" name=\"edit[$name]\"$size value=\"". check_form($value) ."\" />", $description);
+ return form_item($title, "<input type=\"password\" class=\"form-password\" maxlength=\"$maxlength\" name=\"edit[$name]\"$size value=\"". check_form($value) ."\"". drupal_attributes($attributes) ." />", $description);
}
-function form_textarea($title, $name, $value, $cols, $rows, $description = 0) {
+function form_textarea($title, $name, $value, $cols, $rows, $description = 0, $attributes = 0) {
$cols = $cols ? " cols=\"$cols\"" : "";
module_invoke_all("textarea", $name); // eg. optionally plug in a WYSIWYG editor
- return form_item($title, "<textarea wrap=\"virtual\"$cols rows=\"$rows\" name=\"edit[$name]\" id=\"edit[$name]\">". check_form($value) ."</textarea>", $description);
+ return form_item($title, "<textarea wrap=\"virtual\"$cols rows=\"$rows\" name=\"edit[$name]\" id=\"edit[$name]\"". drupal_attributes($attributes) .">". check_form($value) ."</textarea>", $description);
}
function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) {
@@ -905,7 +905,7 @@ function form_hidden($name, $value) {
return "<input type=\"hidden\" name=\"edit[$name]\" value=\"". check_form($value) ."\" />\n";
}
-function form_submit($value, $name = "op") {
+function form_submit($value, $name = "op", $attributes = 0) {
return "<input type=\"submit\" class=\"form-submit\" name=\"$name\" value=\"". check_form($value) ."\" />\n";
}
@@ -973,14 +973,18 @@ function url($url = NULL, $query = NULL) {
}
}
-function l($text, $url, $attributes = array(), $query = NULL) {
-
- $t = array();
- foreach ($attributes as $key => $value) {
- $t[] = "$key=\"$value\"";
+function drupal_attributes($attributes = 0) {
+ if (is_array($attributes)) {
+ $t = array();
+ foreach ($attributes as $key => $value) {
+ $t[] = "$key=\"$value\"";
+ }
+ return " ". implode($t, " ");
}
+}
- return "<a href=\"". url($url, $query) ."\" ". implode($t, " ") .">$text</a>";
+function l($text, $url, $attributes = array(), $query = NULL) {
+ return "<a href=\"". url($url, $query) ."\"". drupal_attributes($attributes) .">$text</a>";
}
function field_get($string, $name) {
diff --git a/modules/node.module b/modules/node.module
index 91516c0a2..e87cbff53 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -360,7 +360,6 @@ function node_save($node) {
function node_view($node, $main = 0) {
-
$node = array2object($node);
/*
@@ -1259,7 +1258,7 @@ function node_form($edit, $error = NULL) {
$output .= "</div></div>";
- return form($output, ($param["method"] ? $param["method"] : "post"), $param["action"], $param["options"]);
+ return form($output, ($param["method"] ? $param["method"] : "post"), $param["action"], array_merge($param["options"], array("id" => "node-form")));
}
function node_add($type) {
diff --git a/modules/node/node.module b/modules/node/node.module
index 91516c0a2..e87cbff53 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -360,7 +360,6 @@ function node_save($node) {
function node_view($node, $main = 0) {
-
$node = array2object($node);
/*
@@ -1259,7 +1258,7 @@ function node_form($edit, $error = NULL) {
$output .= "</div></div>";
- return form($output, ($param["method"] ? $param["method"] : "post"), $param["action"], $param["options"]);
+ return form($output, ($param["method"] ? $param["method"] : "post"), $param["action"], array_merge($param["options"], array("id" => "node-form")));
}
function node_add($type) {
diff --git a/modules/user.module b/modules/user.module
index 9c51bd043..bd29d03cd 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -413,16 +413,18 @@ function user_block($op = "list", $delta = 0) {
}
break;
case 2:
- $result = db_query_range("SELECT uid, name FROM {users} WHERE status != '0' ORDER BY uid DESC", 0, 5);
- while ($account = db_fetch_object($result)) {
- $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
- }
+ if (user_access("access content")) {
+ $result = db_query_range("SELECT uid, name FROM {users} WHERE status != '0' ORDER BY uid DESC", 0, 5);
+ while ($account = db_fetch_object($result)) {
+ $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
+ }
- $output = theme("theme_user_list", $items);
+ $output = theme("theme_user_list", $items);
- $block["subject"] = t("Who's new");
- $block["content"] = $output;
- return $block;
+ $block["subject"] = t("Who's new");
+ $block["content"] = $output;
+ return $block;
+ }
}
}
}
diff --git a/modules/user/user.module b/modules/user/user.module
index 9c51bd043..bd29d03cd 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -413,16 +413,18 @@ function user_block($op = "list", $delta = 0) {
}
break;
case 2:
- $result = db_query_range("SELECT uid, name FROM {users} WHERE status != '0' ORDER BY uid DESC", 0, 5);
- while ($account = db_fetch_object($result)) {
- $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
- }
+ if (user_access("access content")) {
+ $result = db_query_range("SELECT uid, name FROM {users} WHERE status != '0' ORDER BY uid DESC", 0, 5);
+ while ($account = db_fetch_object($result)) {
+ $items[] = l((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), "user/view/$account->uid");
+ }
- $output = theme("theme_user_list", $items);
+ $output = theme("theme_user_list", $items);
- $block["subject"] = t("Who's new");
- $block["content"] = $output;
- return $block;
+ $block["subject"] = t("Who's new");
+ $block["content"] = $output;
+ return $block;
+ }
}
}
}
diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme
index 4bce3d3a5..5ba285383 100644
--- a/themes/marvin/marvin.theme
+++ b/themes/marvin/marvin.theme
@@ -59,7 +59,7 @@
function node($node, $main = 0) {
if (module_exist("taxonomy")) {
- $terms = taxonomy_link("taxonomy terms", $node);
+ $terms = taxonomy_link("taxonomy terms", $node);
}
print "\n<!-- node: \"$node->title\" -->\n";