";
return form($output);
}
@@ -814,12 +814,12 @@ function user_logout() {
function user_pass($edit = array()) {
if ($edit["name"]) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '". check_input($edit["name"]) . "'"));
- if (!$account) $error = strtr(t("Sorry. The username %s is not recognized."), array("%s" => $edit["name"]));
+ $account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE name = '%s'", $edit["name"]));
+ if (!$account) $error = t("Sorry. The username %s is not recognized.", array("%s" => $edit["name"]));
}
else if ($edit["mail"]) {
- $account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE mail = '". check_input($edit["mail"]) ."'"));
- if (!$account) $error = strtr(t("Sorry. The e-mail address %s is not recognized."), array("%s" => $edit["mail"]));
+ $account = db_fetch_object(db_query("SELECT uid, name, mail FROM users WHERE mail = '%s'", $edit["mail"]));
+ if (!$account) $error = t("Sorry. The e-mail address %s is not recognized.", array("%s" => $edit["mail"]));
}
if ($account) {
@@ -839,7 +839,7 @@ function user_pass($edit = array()) {
global $HTTP_HOST;
$variables = array("%username" => $account->name, "%site" => variable_get("site_name", "drupal"), "%password" => $pass, "%uri" => path_uri(), "%uri_brief" => $HTTP_HOST, "%mailto" => $account->mail);
$subject = strtr(variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
$headers = "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from";
user_mail($account->mail, $subject, $body, $headers);
@@ -862,8 +862,8 @@ function user_pass($edit = array()) {
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64);
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64);
$output .= form_submit(t("E-mail new password"));
- $output .= "
";
return form($output);
}
@@ -877,7 +877,7 @@ function user_register($edit = array()) {
*/
if ($user->uid) {
- drupal_goto("module.php?mod=user&op=edit");
+ drupal_goto(drupal_url(array("mod" => "user", "op" => "edit"), "module"));
}
if ($edit["name"] && $edit["mail"]) {
@@ -888,16 +888,16 @@ function user_register($edit = array()) {
// do nothing
}
else if (user_deny("user", $edit["name"])) {
- $error = strtr(t("The name '%s' has been denied access."), array("%s" => $edit["name"]));
+ $error = t("The name '%s' has been denied access.", array("%s" => $edit["name"]));
}
else if (user_deny("mail", $edit["mail"])) {
- $error = strtr(t("The e-mail address '%s' has been denied access."), array("%s" => $edit["mail"]));
+ $error = t("The e-mail address '%s' has been denied access.", array("%s" => $edit["mail"]));
}
- else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
- $error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
+ $error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
}
- else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
- $error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
+ $error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
else if (variable_get("user_register", 1) == 0) {
$error = t("Public registrations have been disabled by the site administrator.");
@@ -940,7 +940,7 @@ function user_register($edit = array()) {
//the first user may login immediately, and receives a customized welcome email.
if ($user->uid == 1) {
- user_mail($edit["mail"], strtr(t("drupal user account details for %s"), array("%s" => $edit["name"])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %utimodule.php?mod=user&op=edit\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
+ user_mail($edit["mail"], t("drupal user account details for %s", array("%s" => $edit["name"])), t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\nAfter logging in, you may wish to visit the following pages:\n\nAdministration: %uriadmin.php\nEdit user account: %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\n--drupal"), $variables, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// This should not be t()'ed. No point as its only shown once in the sites lifetime, and it would be bad to store the password
$output .= "
Welcome to Drupal. You are user #1, which gives you full and immediate access. All future registrants will receive their passwords via email, so please configure your email settings using the Administration pages.
Your password is $pass. You may change your password on the next page.
Please login below.
";
$output .= form_hidden("name", $user->name);
@@ -951,7 +951,7 @@ function user_register($edit = array()) {
else {
global $HTTP_HOST;
$subject = strtr(variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), $variables);
- $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
+ $body = strtr(variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), $variables);
user_mail($edit["mail"], $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
return t("Your password and further instructions have been sent to your e-mail address.");
}
@@ -966,7 +966,7 @@ function user_register($edit = array()) {
$affiliates = user_auth_help_links();
if (array_count_values($affiliates) > 1) {
$affiliates = implode(", ", $affiliates);
- $output .= "
" . strtr(t("Note: If you have an account with one of our affiliates (%s), you may login now instead of registering."), array("%s" => $affiliates)) ."
";
+ $output .= "
" . t("Note: If you have an account with one of our affiliates (%s), you may ".lm("login now", array("mod" => "user", "op" => "login"))." instead of registering.", array("%s" => $affiliates)) ."
";
}
$output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your prefered username: only letters, numbers and spaces are allowed."));
$output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate."));
@@ -1009,11 +1009,11 @@ function user_edit($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
- $error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
+ else if (db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
+ $error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
}
- else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
- $error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
+ else if ($edit["mail"] && db_num_rows(db_query("SELECT uid FROM users WHERE uid != '$user->uid' AND LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
+ $error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
else if ($user->uid) {
foreach (module_list() as $module) {
@@ -1089,9 +1089,9 @@ function user_edit($edit = array()) {
}
function user_menu() {
- $links[] = "". t("view user information") ."";
- $links[] = "". t("edit user information") ."";
- $links[] = "". t("delete account") ."";
+ $links[] = lm(t("view user information"), array("mod" => "user", "op" => "view"));
+ $links[] = lm(t("edit user information"), array("mod" => "user", "op" => "edit"));
+ $links[] = lm(t("delete account"), array("mod" => "user", "op" => "delete"));
return "
". implode(" · ", $links) ."
";
}
@@ -1208,9 +1208,9 @@ function user_conf_options() {
$output .= form_select("Public registrations", "user_register", variable_get("user_register", 1), array("Only site administrators can create new user accounts.", "Visitors can create accounts and no administrator approval is required.", "Visitors can create accounts but administrator approval is required."));
$output .= form_textfield("Password words", "user_password", variable_get("user_password", "foo,bar,guy,neo,tux,moo,sun,asm,dot,god,axe,geek,nerd,fish,hack,star,mice,warp,moon,hero,cola,girl,fish,java,perl,boss,dark,sith,jedi,drop,mojo"), 55, 256, "A comma separated list of short words that can be concatenated to generate human-readable passwords.");
$output .= form_textfield("Welcome e-mail subject", "user_mail_welcome_subject", variable_get("user_mail_welcome_subject", t("User account details for %username at %site")), 80, 180, "Customize the Subject of your welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
- $output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea("Welcome e-mail body", "user_mail_welcome_body", variable_get("user_mail_welcome_body", t("%username,\n\nThank you for registering at %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the welcome email, which is sent to new members upon registering. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
$output .= form_textfield("Forgotten password e-mail subject", "user_mail_pass_subject", variable_get("user_mail_pass_subject", t("Replacement login information for %username at %site")), 80, 180, "Customize the Subject of your Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
- $output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %urimodule.php?mod=login using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %urimodule.php?mod=user&op=edit\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
+ $output .= form_textarea("Forgotten password e-mail body", "user_mail_pass_body", variable_get("user_mail_pass_body", t("%username,\n\nHere is your new password for %site. You may now login to %uri".drupal_url(array("mod" => "login"), "module")." using the following username and password:\n\nusername: %username\npassword: %password\n\nAfter logging in, you may wish to change your password at %uri".drupal_url(array("mod" => "user", "op" => "edit"), "module")."\n\nYour new %site membership also enables to you to login to other Drupal powered web sites (e.g. http://www.drop.org) without registering. Just use the following Drupal ID and password:\n\nDrupal ID: %username@%uri_brief\npassword: %password\n\n\n-- %site team")), 70, 10, "Customize the Body of the Forgotten Password email. Available variables are: %username, %site, %password, %uri, %uri_brief, %mailto");
return $output;
}
@@ -1250,11 +1250,11 @@ function user_admin_create($edit = array()) {
else if ($error = user_validate_mail($edit["mail"])) {
// do nothing
}
- else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('". $edit["name"] ."')")) > 0) {
- $error = strtr(t("The name '%s' is already taken."), array("%s" => $edit["name"]));
+ else if (db_num_rows(db_query("SELECT name FROM users WHERE LOWER(name) = LOWER('%s')", $edit["name"])) > 0) {
+ $error = t("The name '%s' is already taken.", array("%s" => $edit["name"]));
}
- else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('". $edit["mail"] ."')")) > 0) {
- $error = strtr(t("The e-mail address '%s' is already taken."), array("%s" => $edit["mail"]));
+ else if (db_num_rows(db_query("SELECT mail FROM users WHERE LOWER(mail) = LOWER('%s')", $edit["mail"])) > 0) {
+ $error = t("The e-mail address '%s' is already taken.", array("%s" => $edit["mail"]));
}
else {
$success = 1;
@@ -1287,7 +1287,7 @@ function user_admin_create($edit = array()) {
function user_admin_access($edit = array()) {
global $op, $id, $type;
- $output .= "e-mail rules :: username rules";
+ $output .= "".la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail"))." :: ".la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user")).""; // irc rules, too!
if ($type != "user") {
$output .= "
";
- $result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '1' ORDER BY mask");
+ $result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '1' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $output .= "
";
}
- $result = db_query("SELECT * FROM access WHERE type = '". check_input($type) ."' AND status = '0' ORDER BY mask");
+ $result = db_query("SELECT * FROM access WHERE type = '%s' AND status = '0' ORDER BY mask", $type);
while ($rule = db_fetch_object($result)) {
- $output .= "
";
@@ -1365,7 +1365,7 @@ function user_admin_perm($edit = array()) {
$result = db_query("SELECT * FROM role");
while ($role = db_fetch_object($result)) {
$perm = $edit[$role->name] ? implode(", ", array_keys($edit[$role->name])) : "";
- db_query("UPDATE role SET perm = '$perm' WHERE name = '$role->name'");
+ db_query("UPDATE role SET perm = '%s' WHERE name = '$role->name'", $perm);
}
}
@@ -1415,13 +1415,13 @@ function user_admin_role($edit = array()) {
global $op, $id;
if ($op == "Save role") {
- db_query("UPDATE role SET name = '". $edit["name"] ."' WHERE rid = '$id'");
+ db_query("UPDATE role SET name = '%s' WHERE rid = '%s'", $edit["name"], $id);
}
else if ($op == "Delete role") {
- db_query("DELETE FROM role WHERE rid = '$id'");
+ db_query("DELETE FROM role WHERE rid = '%s'", $id);
}
else if ($op == "Add role") {
- db_query("INSERT INTO role (name) VALUES ('". $edit["name"] ."')");
+ db_query("INSERT INTO role (name) VALUES ('%s')", $edit["name"]);
}
else if ($id) {
@@ -1429,7 +1429,7 @@ function user_admin_role($edit = array()) {
** Display role form:
*/
- $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '$id'"));
+ $role = db_fetch_object(db_query("SELECT * FROM role WHERE rid = '%s'", $id));
$output .= form_textfield("Role name", "name", $role->name, 32, 64, "The name for this role. Example: 'moderator', 'editorial board', 'site architect'.");
$output .= form_submit("Save role");
@@ -1448,7 +1448,7 @@ function user_admin_role($edit = array()) {
$output .= "
";
$output .= "
name
operations
";
while ($role = db_fetch_object($result)) {
- $output .= "