From 48805032c8bbcf45f65687c592438e2cc960ece8 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Tue, 12 Aug 2003 20:37:16 +0000 Subject: - Applied modified version of almaw's 0064 patch: form item attributes. - Applied modified version of mathias' 0073 patch: node form name. $params["options"] is now an array so some contrib modules might need minor changes. - Applied mathhias' 0074 patch: missing access check on who is new block. --- includes/common.inc | 40 ++++++++++++++++++++++------------------ modules/node.module | 3 +-- modules/node/node.module | 3 +-- modules/user.module | 18 ++++++++++-------- modules/user/user.module | 18 ++++++++++-------- themes/marvin/marvin.theme | 2 +- 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 "
\n$form\n
\n"; + return "
\n$form\n
\n"; } function form_item($title, $value, $description = 0) { return "
". ($title ? "
$title:
" : "") . $value . ($description ? "
$description
" : "") ."
\n"; } -function form_radio($title, $name, $value = 1, $checked = 0, $description = 0) { - return form_item(0, " $title", $description); +function form_radio($title, $name, $value = 1, $checked = 0, $description = 0, $attributes = 0) { + return form_item(0, " $title", $description); } -function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0) { - return form_hidden($name, 0) . form_item(0, " $title", $description); +function form_checkbox($title, $name, $value = 1, $checked = 0, $description = 0, $attributes = 0) { + return form_hidden($name, 0) . form_item(0, " $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, "", $description); + return form_item($title, "", $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, "", $description); + return form_item($title, "", $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, "", $description); + return form_item($title, "", $description); } function form_select($title, $name, $value, $options, $description = 0, $extra = 0, $multiple = 0) { @@ -905,7 +905,7 @@ function form_hidden($name, $value) { return "\n"; } -function form_submit($value, $name = "op") { +function form_submit($value, $name = "op", $attributes = 0) { return "\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 "$text"; +function l($text, $url, $attributes = array(), $query = NULL) { + return "$text"; } 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 .= ""; - 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 .= ""; - 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\n"; -- cgit v1.2.3