diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-01-15 19:51:08 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-01-15 19:51:08 +0000 |
commit | 045f92d2b7eb443a044a66abd65706fb2569ea8e (patch) | |
tree | 45f628de1799836e115c68c0c3438ee968c790ec | |
parent | 6f15124748350e1726efd3ba15045b8e82e44d5a (diff) | |
download | brdo-045f92d2b7eb443a044a66abd65706fb2569ea8e.tar.gz brdo-045f92d2b7eb443a044a66abd65706fb2569ea8e.tar.bz2 |
- Fixed bug/warning when an anonymous users tries to post a node. Reported
by David.
-rw-r--r-- | modules/user.module | 25 | ||||
-rw-r--r-- | modules/user/user.module | 25 |
2 files changed, 34 insertions, 16 deletions
diff --git a/modules/user.module b/modules/user.module index cb41b40a5..8a8bd4214 100644 --- a/modules/user.module +++ b/modules/user.module @@ -303,12 +303,13 @@ function user_search($keys) { function user_block($op = "list", $delta = 0) { global $user, $edit; + if ($op == "list") { - $blocks[0]["info"] = t("Log in"); - $blocks[1]["info"] = t("User information"); - $blocks[2]["info"] = t("Who's new"); + $blocks[0]["info"] = t("Log in"); + $blocks[1]["info"] = t("User information"); + $blocks[2]["info"] = t("Who's new"); - return $blocks; + return $blocks; } else { switch ($delta) { @@ -316,9 +317,17 @@ function user_block($op = "list", $delta = 0) { if (!$user->uid) { $output = "<div align=\"center\">\n"; $output .= "<form action=\"". url("user/login") ."\" method=\"post\">\n"; - // Save the referer. We record where the user came from such that we - // can redirect him after having completed the login form. - if (!$edit["destination"]) $edit["destination"] = request_uri(); + /* + ** Save the referer. We record where the user came from such + ** that we/ can redirect him after having completed the login + ** form. + */ + + if (empty($edit)) { + $edit["destination"] = request_uri(); + } + // NOTE: special care needs to be taken because on pages with forms, such as node and comment submission pages, the $edit variable might already be set. + $output .= "<input name=\"edit[destination]\" type=\"hidden\" value=\"" . $edit["destination"] . "\" />"; $output .= "<b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\" /><br />\n"; $output .= "<b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" type=\"password\" /><br />\n"; @@ -610,7 +619,7 @@ function user_login($edit = array(), $msg = "") { ** can redirect him after having completed the login form. */ - if (!$edit["destination"]) { + if (empty($edit)) { $edit["destination"] = request_uri(); } $output .= form_hidden("destination", $edit["destination"]); diff --git a/modules/user/user.module b/modules/user/user.module index cb41b40a5..8a8bd4214 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -303,12 +303,13 @@ function user_search($keys) { function user_block($op = "list", $delta = 0) { global $user, $edit; + if ($op == "list") { - $blocks[0]["info"] = t("Log in"); - $blocks[1]["info"] = t("User information"); - $blocks[2]["info"] = t("Who's new"); + $blocks[0]["info"] = t("Log in"); + $blocks[1]["info"] = t("User information"); + $blocks[2]["info"] = t("Who's new"); - return $blocks; + return $blocks; } else { switch ($delta) { @@ -316,9 +317,17 @@ function user_block($op = "list", $delta = 0) { if (!$user->uid) { $output = "<div align=\"center\">\n"; $output .= "<form action=\"". url("user/login") ."\" method=\"post\">\n"; - // Save the referer. We record where the user came from such that we - // can redirect him after having completed the login form. - if (!$edit["destination"]) $edit["destination"] = request_uri(); + /* + ** Save the referer. We record where the user came from such + ** that we/ can redirect him after having completed the login + ** form. + */ + + if (empty($edit)) { + $edit["destination"] = request_uri(); + } + // NOTE: special care needs to be taken because on pages with forms, such as node and comment submission pages, the $edit variable might already be set. + $output .= "<input name=\"edit[destination]\" type=\"hidden\" value=\"" . $edit["destination"] . "\" />"; $output .= "<b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\" /><br />\n"; $output .= "<b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" type=\"password\" /><br />\n"; @@ -610,7 +619,7 @@ function user_login($edit = array(), $msg = "") { ** can redirect him after having completed the login form. */ - if (!$edit["destination"]) { + if (empty($edit)) { $edit["destination"] = request_uri(); } $output .= form_hidden("destination", $edit["destination"]); |