summaryrefslogtreecommitdiff
path: root/modules/account.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-17 19:14:50 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-17 19:14:50 +0000
commit6c387962199f3b57aff1df4bc0c79ded4935f2a1 (patch)
tree7e547ce9e8455c8154ec722b8c1c0da26999945d /modules/account.module
parente2f051b3854a72e2c7f1af1506f7c3eed6504891 (diff)
downloadbrdo-6c387962199f3b57aff1df4bc0c79ded4935f2a1.tar.gz
brdo-6c387962199f3b57aff1df4bc0c79ded4935f2a1.tar.bz2
- Fixed bug in account.module.
- Simplified field_set() API. - Made UnConeD's cool common timestamp format conform with the general coding style. Sorry to be so picky about this but I really can't help it. ;)
Diffstat (limited to 'modules/account.module')
-rw-r--r--modules/account.module30
1 files changed, 21 insertions, 9 deletions
diff --git a/modules/account.module b/modules/account.module
index 28faf1fe3..22f3a43f5 100644
--- a/modules/account.module
+++ b/modules/account.module
@@ -138,9 +138,20 @@ function account_delete($name) {
}
function account_edit_save($name, $edit) {
- foreach ($edit as $key=>$value) if ($key != "access") $query .= "$key = '". addslashes($value) ."', ";
+ foreach ($edit as $key=>$value) {
+ if ($key != "access") {
+ $query .= "$key = '". addslashes($value) ."', ";
+ }
+ }
db_query("UPDATE users SET $query access = '' WHERE userid = '$name'");
- if ($edit[access]) foreach ($edit[access] as $key=>$value) db_query("UPDATE users SET access = '". field_set(user_load($name), "access", $value, 1) ."'");
+
+ if ($edit[access]) {
+ foreach ($edit[access] as $key=>$value) {
+ $account = user_load($name);
+ db_query("UPDATE users SET access = '". field_set($account->access, $value, 1) ."' WHERE id = $account->id");
+ }
+ }
+
watchdog("message", "account: modified user '$name'");
}
@@ -169,7 +180,7 @@ function account_edit($name) {
$form .= form_textfield(t("Homepage"), "url", $account->url, 30, 55);
$form .= form_textarea(t("Bio"), "bio", $account->bio, 35, 5);
$form .= form_textarea(t("Signature"), "signature", $account->signature, 35, 5);
- $form .= form_hidden("userid", $account->userid);
+ $form .= form_hidden("name", $account->userid);
$form .= form_submit("View account");
$form .= form_submit("Save account");
@@ -183,7 +194,7 @@ function account_view($name) {
$result = db_query("SELECT * FROM users WHERE userid = '$name'");
if ($account = db_fetch_object($result)) {
- $form .= form_hidden("userid", $account->userid);
+ $form .= form_hidden("name", $account->userid);
$form .= form_submit("Edit account");
$form .= form_submit("Delete account");
@@ -222,7 +233,8 @@ function account_admin() {
print "<SMALL><A HREF=\"admin.php?mod=account&op=access\">access control</A> | <A HREF=\"admin.php?mod=account&op=listing\">account listings</A> | <A HREF=\"admin.php?mod=account&op=search\">search account</A> | <A HREF=\"admin.php?mod=account\">overview</A> | <A HREF=\"admin.php?mod=account&op=help\">help</A></SMALL><HR>";
- $type = ($type ? $type : 0);
+ $type = $type ? $type : 0;
+ $name = $name ? $name : $edit[name];
switch ($op) {
case "access":
@@ -241,12 +253,12 @@ function account_admin() {
print account_ac();
break;
case "Delete account":
- print status(account_delete($edit[userid]));
+ print status(account_delete($name));
print account_overview(account_query($type));
break;
case "Edit account":
case "edit":
- print account_edit(check_input($name));
+ print account_edit($name);
break;
case "help":
print account_help();
@@ -259,8 +271,8 @@ function account_admin() {
print search_data($keys, $mod);
break;
case "Save account":
- print status(account_edit_save(check_input($edit[userid]), $edit));
- print account_view(check_input($edit[userid]));
+ print status(account_edit_save($name, $edit));
+ print account_view($name);
break;
case "View account":
case "view":