From 045f92d2b7eb443a044a66abd65706fb2569ea8e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 15 Jan 2003 19:51:08 +0000 Subject: [PATCH] - Fixed bug/warning when an anonymous users tries to post a node. Reported by David. --- modules/user.module | 27 ++++++++++++++++++--------- modules/user/user.module | 27 ++++++++++++++++++--------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/modules/user.module b/modules/user.module index cb41b40a5af..8a8bd421416 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"); - return $blocks; + if ($op == "list") { + $blocks[0]["info"] = t("Log in"); + $blocks[1]["info"] = t("User information"); + $blocks[2]["info"] = t("Who's new"); + + return $blocks; } else { switch ($delta) { @@ -316,9 +317,17 @@ function user_block($op = "list", $delta = 0) { if (!$user->uid) { $output = "
\n"; $output .= "
\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 .= ""; $output .= "". t("Username") .":

\n"; $output .= "". t("Password") .":

\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 cb41b40a5af..8a8bd421416 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"); - return $blocks; + if ($op == "list") { + $blocks[0]["info"] = t("Log in"); + $blocks[1]["info"] = t("User information"); + $blocks[2]["info"] = t("Who's new"); + + return $blocks; } else { switch ($delta) { @@ -316,9 +317,17 @@ function user_block($op = "list", $delta = 0) { if (!$user->uid) { $output = "
\n"; $output .= "\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 .= ""; $output .= "". t("Username") .":

\n"; $output .= "". t("Password") .":

\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"]);