diff options
Diffstat (limited to 'node.php')
-rw-r--r-- | node.php | 98 |
1 files changed, 53 insertions, 45 deletions
@@ -5,56 +5,64 @@ include_once "includes/common.inc"; page_header(); function node_render($node) { - global $id, $cid, $op, $moderate, $pid, $edit, $theme, $mode, $order, $threshold, $PHP_SELF; + global $user, $id, $cid, $op, $moderate, $pid, $edit, $theme, $mode, $order, $threshold, $PHP_SELF; - if ($node->comment) { - switch($op) { - case t("Preview comment"): - $theme->header(); - comment_preview($edit); - $theme->footer(); - break; - case t("Post comment"): - comment_post($edit); - $theme->header(); - node_view($node); - comment_render($edit[id], $cid); - $theme->footer(); - break; - case t("Add comment"): - $theme->header(); - comment_reply(check_input($cid), check_input($id)); - $theme->footer(); - break; - case "reply": - $theme->header(); - comment_reply(check_input($pid), check_input($id)); - $theme->footer(); - break; - case t("Update settings"): - comment_settings(check_input($mode), check_input($order), check_input($threshold)); - $theme->header(); - node_view($node); - comment_render($id, $cid); - $theme->footer(); - break; - case t("Moderate comments"): - comment_moderate($moderate); - $theme->header(); - node_view($node); - comment_render($id, $cid); - $theme->footer(); - break; - default: - $theme->header(); - node_view($node); - comment_render($id, $cid); - $theme->footer(); + if (user_access($node, "view content")) { + + if ($node->comment) { + switch($op) { + case t("Preview comment"): + $theme->header(); + comment_preview($edit); + $theme->footer(); + break; + case t("Post comment"): + comment_post($edit); + $theme->header(); + node_view($node); + comment_render($edit[id], $cid); + $theme->footer(); + break; + case t("Add comment"): + $theme->header(); + comment_reply(check_input($cid), check_input($id)); + $theme->footer(); + break; + case "reply": + $theme->header(); + comment_reply(check_input($pid), check_input($id)); + $theme->footer(); + break; + case t("Update settings"): + comment_settings(check_input($mode), check_input($order), check_input($threshold)); + $theme->header(); + node_view($node); + comment_render($id, $cid); + $theme->footer(); + break; + case t("Moderate comments"): + comment_moderate($moderate); + $theme->header(); + node_view($node); + comment_render($id, $cid); + $theme->footer(); + break; + default: + $theme->header(); + node_view($node); + comment_render($id, $cid); + $theme->footer(); + } + } + else { + $theme->header(); + node_view($node); + $theme->footer(); } } else { $theme->header(); - node_view($node); + $theme->box(t("Access denied"), message_access()); $theme->footer(); } } |