From 291b56c0ccbbdfc5505b6ea391153e363ff19d3b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Apr 2004 15:17:10 +0000 Subject: - Fixed problem with global session variable that caused the wrong page to be rendered after posting a comment. --- modules/comment/comment.module | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b99f7a269..0b2d1f7f7 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -164,16 +164,8 @@ function comment_access($op, $comment) { } } -function comment_referer_save() { - $_SESSION["comment_referer"] = arg(0) ."/". arg(1) ."/". arg(2); -} - -/* -** Restores the referer from a persistent variable: -*/ - -function comment_referer_load() { - return $_SESSION["comment_referer"]; +function comment_node_url() { + return arg(0) ."/". arg(1) ."/". arg(2); } function comment_edit($cid) { @@ -469,7 +461,7 @@ function comment_links($comment, $return = 1) { */ if ($return) { - $links[] = l(t("parent"), comment_referer_load(), NULL, NULL, "comment-$comment->cid"); + $links[] = l(t("parent"), comment_node_url(), NULL, NULL, "comment-$comment->cid"); } if (node_comment_mode($comment->nid) == 2) { @@ -508,13 +500,6 @@ function comment_render($node, $cid = 0) { $output = ""; if (user_access("access comments")) { - - /* - ** Save were we come from so we can go back after a reply - */ - - comment_referer_save(); - /* ** Pre-process variables: */ @@ -830,7 +815,7 @@ function comment_page() { case t("Moderate comments"): case t("Moderate comment"): comment_moderate($edit); - drupal_goto(comment_referer_load()); + drupal_goto(comment_node_url()); break; case "reply": print theme("page", comment_reply(check_query(arg(3)), check_query(arg(2))), t("Add new comment")); @@ -844,7 +829,7 @@ function comment_page() { print theme("page", $error_body, $error_title); } else { - drupal_goto(comment_referer_load()); + drupal_goto(comment_node_url()); } break; case t("Save settings"): @@ -854,7 +839,7 @@ function comment_page() { $comments_per_page = $_POST["comments_per_page"]; comment_save_settings(check_query($mode), check_query($order), check_query($threshold), check_query($comments_per_page)); - drupal_goto(comment_referer_load()); + drupal_goto(comment_node_url()); break; } } @@ -1393,7 +1378,7 @@ function theme_comment($comment, $links = 0) { function theme_comment_folded($comment) { $output = "
\n"; - $output .= " ". l($comment->subject, comment_referer_load() ."/$comment->cid", NULL, NULL, "comment-$comment->cid") . ($comment->new ? ' '. theme('mark') : '') ." "; + $output .= " ". l($comment->subject, comment_node_url() ."/$comment->cid", NULL, NULL, "comment-$comment->cid") . ($comment->new ? ' '. theme('mark') : '') ." "; $output .= "". t("by") ." ". format_name($comment) ."\n"; $output .= "
\n"; return $output; -- cgit v1.2.3