summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-10-13 18:44:09 +0000
committerDries Buytaert <dries@buytaert.net>2002-10-13 18:44:09 +0000
commit4ad8996ff72177cd02b64d9cf3501f294704a9d9 (patch)
treec885db8e86c33bfe6626f28f3c29c8f374bdc7cd
parent904a6172b08ab0900f34a1b8cfd22452920d2f61 (diff)
downloadbrdo-4ad8996ff72177cd02b64d9cf3501f294704a9d9.tar.gz
brdo-4ad8996ff72177cd02b64d9cf3501f294704a9d9.tar.bz2
- Fixed bug in user_save().
- Added "Who's new" block. I accidentically removed it.
-rw-r--r--modules/user.module41
-rw-r--r--modules/user/user.module41
2 files changed, 54 insertions, 28 deletions
diff --git a/modules/user.module b/modules/user.module
index 8489958f8..d2c4d1734 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -89,20 +89,6 @@ function user_load($array = array()) {
}
function user_save($account, $array = array()) {
-
- /*
- ** Validate input fields to make sure users don't submit
- ** invalid form data.
- */
-
- if (!user_access("administer users")) {
- if (array_intersect(array_keys($array), array("rid", "init", "rating", "session"))) {
- watchdog("warning", "detected malicious attempt to alter a protected user field");
- }
-
- unset($array["rid"], $array["init"], $array["rating"], $array["session"]);
- }
-
/*
** Dynamically compose a SQL query:
*/
@@ -358,9 +344,21 @@ function user_block() {
$block[1]["info"] = t("Log in");
$block[1]["link"] = drupal_url(array("mod" => "user"), "module");
+ $block[2]["subject"] = t("Who's new");
+ $block[2]["info"] = t("Who's new");
+ $block[2]["content"] = user_new_users();
+
return $block;
}
+function user_new_users() {
+ $result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5");
+ while ($account = db_fetch_object($result)) {
+ $output .= lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid)) ."<br />";
+ }
+ return $output;
+}
+
function user_link($type) {
if ($type == "page") {
$links[] = lm(t("user account"), array("mod" => "user"), "", array("title" => t("Create a user account, request a new password or edit your account settings.")));
@@ -890,6 +888,21 @@ function user_edit($edit = array()) {
}
unset($edit["pass1"], $edit["pass2"]);
+ /*
+ ** Validate input fields to make sure users don't submit
+ ** invalid form data.
+ */
+
+ if (!user_access("administer users")) {
+ if (array_intersect(array_keys($edit), array("rid", "init", "rating", "session"))) {
+ watchdog("warning", "detected malicious attempt to alter a protected database field");
+ }
+
+ $edit["rid"] = $user->rid;
+ $edit["init"] = $user->init;
+ $edit["rating"] = $user->rating;
+ $edit["session"] = $user->session;
+ }
if (!$error) {
/*
diff --git a/modules/user/user.module b/modules/user/user.module
index 8489958f8..d2c4d1734 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -89,20 +89,6 @@ function user_load($array = array()) {
}
function user_save($account, $array = array()) {
-
- /*
- ** Validate input fields to make sure users don't submit
- ** invalid form data.
- */
-
- if (!user_access("administer users")) {
- if (array_intersect(array_keys($array), array("rid", "init", "rating", "session"))) {
- watchdog("warning", "detected malicious attempt to alter a protected user field");
- }
-
- unset($array["rid"], $array["init"], $array["rating"], $array["session"]);
- }
-
/*
** Dynamically compose a SQL query:
*/
@@ -358,9 +344,21 @@ function user_block() {
$block[1]["info"] = t("Log in");
$block[1]["link"] = drupal_url(array("mod" => "user"), "module");
+ $block[2]["subject"] = t("Who's new");
+ $block[2]["info"] = t("Who's new");
+ $block[2]["content"] = user_new_users();
+
return $block;
}
+function user_new_users() {
+ $result = db_query("SELECT uid, name FROM users WHERE status != '0' ORDER BY uid DESC LIMIT 5");
+ while ($account = db_fetch_object($result)) {
+ $output .= lm((strlen($account->name) > 15 ? substr($account->name, 0, 15) . '...' : $account->name), array("mod" =>user, "op" => "view", "id" => $account->uid)) ."<br />";
+ }
+ return $output;
+}
+
function user_link($type) {
if ($type == "page") {
$links[] = lm(t("user account"), array("mod" => "user"), "", array("title" => t("Create a user account, request a new password or edit your account settings.")));
@@ -890,6 +888,21 @@ function user_edit($edit = array()) {
}
unset($edit["pass1"], $edit["pass2"]);
+ /*
+ ** Validate input fields to make sure users don't submit
+ ** invalid form data.
+ */
+
+ if (!user_access("administer users")) {
+ if (array_intersect(array_keys($edit), array("rid", "init", "rating", "session"))) {
+ watchdog("warning", "detected malicious attempt to alter a protected database field");
+ }
+
+ $edit["rid"] = $user->rid;
+ $edit["init"] = $user->init;
+ $edit["rating"] = $user->rating;
+ $edit["session"] = $user->session;
+ }
if (!$error) {
/*