diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-02 23:54:05 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-02 23:54:05 +0000 |
commit | 78601c3635d0569a71835743d2d2c6e850e4cc39 (patch) | |
tree | 39fdf9ae3f1a1baf69f2865472a122234ad2fb97 /modules/comment/comment.pages.inc | |
parent | 8ae6dc4b2ecaa669e061aac7879435be01021c33 (diff) | |
download | brdo-78601c3635d0569a71835743d2d2c6e850e4cc39.tar.gz brdo-78601c3635d0569a71835743d2d2c6e850e4cc39.tar.bz2 |
#754760 by sun, chx, dmitrig01, manarth, EvanDonovan, derjochenmeyer, joachim: Fixed all possible problems with comment links, using new generatePermutations testing function.
Diffstat (limited to 'modules/comment/comment.pages.inc')
-rw-r--r-- | modules/comment/comment.pages.inc | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc index 03722e6dc..726795a41 100644 --- a/modules/comment/comment.pages.inc +++ b/modules/comment/comment.pages.inc @@ -33,26 +33,26 @@ function comment_reply($node, $pid = NULL) { $op = isset($_POST['op']) ? $_POST['op'] : ''; $build = array(); - if (user_access('access comments')) { - // The user is previewing a comment prior to submitting it. - if ($op == t('Preview')) { - if (user_access('post comments')) { - $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) array('pid' => $pid, 'nid' => $node->nid)); - } - else { - drupal_set_message(t('You are not authorized to post comments.'), 'error'); - drupal_goto("node/$node->nid"); - } + // The user is previewing a comment prior to submitting it. + if ($op == t('Preview')) { + if (user_access('post comments')) { + $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) array('pid' => $pid, 'nid' => $node->nid)); } else { - // $pid indicates that this is a reply to a comment. - if ($pid) { + drupal_set_message(t('You are not authorized to post comments.'), 'error'); + drupal_goto("node/$node->nid"); + } + } + else { + // $pid indicates that this is a reply to a comment. + if ($pid) { + if (user_access('access comments')) { // Load the comment whose cid = $pid $comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array( ':cid' => $pid, ':status' => COMMENT_PUBLISHED, ))->fetchObject(); - if ( $comment ) { + if ($comment) { // If that comment exists, make sure that the current comment and the // parent comment both belong to the same parent node. if ($comment->nid != $node->nid) { @@ -71,29 +71,29 @@ function comment_reply($node, $pid = NULL) { drupal_goto("node/$node->nid"); } } - // This is the case where the comment is in response to a node. Display the node. - elseif (user_access('access content')) { - $build['comment_node'] = node_view($node); - } - - // Should we show the reply box? - if ($node->comment != COMMENT_NODE_OPEN) { - drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error'); - drupal_goto("node/$node->nid"); - } - elseif (user_access('post comments')) { - $edit = array('nid' => $node->nid, 'pid' => $pid); - $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) $edit); - } else { - drupal_set_message(t('You are not authorized to post comments.'), 'error'); + drupal_set_message(t('You are not authorized to view comments.'), 'error'); drupal_goto("node/$node->nid"); } } - } - else { - drupal_set_message(t('You are not authorized to view comments.'), 'error'); - drupal_goto("node/$node->nid"); + // This is the case where the comment is in response to a node. Display the node. + elseif (user_access('access content')) { + $build['comment_node'] = node_view($node); + } + + // Should we show the reply box? + if ($node->comment != COMMENT_NODE_OPEN) { + drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error'); + drupal_goto("node/$node->nid"); + } + elseif (user_access('post comments')) { + $edit = array('nid' => $node->nid, 'pid' => $pid); + $build['comment_form'] = drupal_get_form("comment_node_{$node->type}_form", (object) $edit); + } + else { + drupal_set_message(t('You are not authorized to post comments.'), 'error'); + drupal_goto("node/$node->nid"); + } } return $build; |