diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-09-16 13:53:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-09-16 13:53:45 +0000 |
commit | 64a6fbc790f02a80b32682456a24a45afe8c50a5 (patch) | |
tree | 2f3c013d4786604b2441978dfc80fd11cbb94720 /modules/user.module | |
parent | 22b8be2c9ef6117a480695ae21758433dbece73b (diff) | |
download | brdo-64a6fbc790f02a80b32682456a24a45afe8c50a5.tar.gz brdo-64a6fbc790f02a80b32682456a24a45afe8c50a5.tar.bz2 |
- added the search functionality
Diffstat (limited to 'modules/user.module')
-rw-r--r-- | modules/user.module | 127 |
1 files changed, 74 insertions, 53 deletions
diff --git a/modules/user.module b/modules/user.module index 1a531be22..132328bcc 100644 --- a/modules/user.module +++ b/modules/user.module @@ -207,6 +207,19 @@ function user_help() { <?php } +function account_perm() { + return array("administer users"); +} + +function user_search($keys) { + global $PHP_SELF; + $result = db_query("SELECT * FROM user WHERE name LIKE '%$keys%' LIMIT 20"); + while ($account = db_fetch_object($result)) { + $find[$i++] = array("title" => $account->name, "link" => ($PHP_SELF == "/admin.php" ? "admin.php?mod=user&op=edit&id=$account->uid" : "module.php?mod=user&op=view&id=$account->uid"), "user" => $account->name); + } + return $find; +} + function user_link($type) { if ($type == "page") { $links[] = "<a href=\"module.php?mod=user\">". t("user account") ."</a>"; @@ -479,7 +492,7 @@ function user_login($edit = array()) { ** Display login form: */ - $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter yourlocal username, a Drupal ID or a Jabber ID.")); + $output .= form_textfield(t("Username"), "name", $edit["name"], 20, 64, t("Enter your local username, a Drupal ID or a Jabber ID.")); $output .= form_password(t("Password"), "pass", $pass, 20, 64, t("Enter the password that accompanies your username.")); $output .= form_hidden("type", "local"); $output .= form_submit(t("Log in")); @@ -1115,63 +1128,71 @@ function admin_access_init() { function user_admin() { - global $edit, $id, $op, $user; + global $edit, $id, $keys, $op, $user; - /* - ** Initialize all the roles and permissions: - */ - - admin_access_init(); + if (user_access("administer users")) { - /* - ** Compile all the administrative links: - */ + /* + ** Initialize all the roles and permissions: + */ - $links[] = "<a href=\"admin.php?mod=user&op=create\">add new user</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=access\">access rules</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=account\">user accounts</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=role\">user roles</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=permission\">user permissions</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=settings\">settings</a>"; - $links[] = "<a href=\"admin.php?mod=user&op=help\">help</a>"; + admin_access_init(); - print "<small>". implode(" · ", $links) ."</small><hr />"; + /* + ** Compile all the administrative links: + */ - switch ($op) { - case "help": - print user_help(); - break; - case "Save configuration": - case "Reset to defaults": - case "settings": - print user_admin_settings($edit); - break; - case "Add rule": - case "Check": - case "access": - print user_admin_access($edit); - break; - case "Save permissions": - case "permission": - print user_admin_perm($edit); - break; - case "Create account": - case "create": - print user_admin_create($edit); - break; - case "Add role": - case "Delete role": - case "Save role": - case "role": - print user_admin_role($edit); - break; - case "Delete account": - case "Save account": - case "edit": - print user_admin_edit($edit); - break; - default: - print user_admin_account(); + $links[] = "<a href=\"admin.php?mod=user&op=create\">add new user</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=access\">access rules</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=account\">user accounts</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=role\">user roles</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=permission\">user permissions</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=search\">search account</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=settings\">settings</a>"; + $links[] = "<a href=\"admin.php?mod=user&op=help\">help</a>"; + + print "<small>". implode(" · ", $links) ."</small><hr />"; + + switch ($op) { + case "help": + print user_help(); + break; + case "search": + print search_form($keys); + print search_data($keys, "user"); + break; + case "Save configuration": + case "Reset to defaults": + case "settings": + print user_admin_settings($edit); + break; + case "Add rule": + case "Check": + case "access": + print user_admin_access($edit); + break; + case "Save permissions": + case "permission": + print user_admin_perm($edit); + break; + case "Create account": + case "create": + print user_admin_create($edit); + break; + case "Add role": + case "Delete role": + case "Save role": + case "role": + print user_admin_role($edit); + break; + case "Delete account": + case "Save account": + case "edit": + print user_admin_edit($edit); + break; + default: + print user_admin_account(); + } } } |