summaryrefslogtreecommitdiff
path: root/modules/comment.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment.module')
-rw-r--r--modules/comment.module67
1 files changed, 34 insertions, 33 deletions
diff --git a/modules/comment.module b/modules/comment.module
index 0b2d1f7f7..08afd3c18 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -716,10 +716,13 @@ function comment_perm() {
return array("access comments", "post comments", "administer comments", "moderate comments", "post comments without approval", "administer moderation");
}
+/**
+ * Implementation of hook_link().
+ */
function comment_link($type, $node = 0, $main = 0) {
$links = array();
- if ($type == "node" && $node->comment) {
+ if ($type == 'node' && $node->comment) {
if ($main) {
@@ -727,24 +730,24 @@ function comment_link($type, $node = 0, $main = 0) {
** Main page: display the number of comments that have been posted.
*/
- if (user_access("access comments")) {
+ if (user_access('access comments')) {
$all = comment_num_all($node->nid);
$new = comment_num_new($node->nid);
if ($all) {
- $links[] = l(format_plural($all, "1 comment", "%count comments"), "node/view/$node->nid", array("title" => t("Jump to the first comment of this posting.")), NULL, "comment");
+ $links[] = l(format_plural($all, '1 comment', '%count comments'), "node/view/$node->nid", array('title' => t('Jump to the first comment of this posting.')), NULL, 'comment');
if ($new) {
- $links[] = l(format_plural($new, "1 new comment", "%count new comments"), "node/view/$node->nid", array("title" => t("Jump to the first new comment of this posting.")), NULL, "new");
+ $links[] = l(format_plural($new, '1 new comment', '%count new comments'), "node/view/$node->nid", array('title' => t('Jump to the first new comment of this posting.')), NULL, 'new');
}
}
else {
if ($node->comment == 2) {
- if (user_access("post comments")) {
- $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Add a new comment to this page.")));
+ if (user_access('post comments')) {
+ $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Add a new comment to this page.')));
}
else {
- $links[] = theme("comment_post_forbidden");
+ $links[] = theme('comment_post_forbidden');
}
}
}
@@ -757,44 +760,42 @@ function comment_link($type, $node = 0, $main = 0) {
*/
if ($node->comment == 2) {
- if (user_access("post comments")) {
- $links[] = l(t("add new comment"), "comment/reply/$node->nid", array("title" => t("Share your thoughts and opinions related to this posting.")), NULL, "comment");
+ if (user_access('post comments')) {
+ $links[] = l(t('add new comment'), "comment/reply/$node->nid", array('title' => t('Share your thoughts and opinions related to this posting.')), NULL, 'comment');
}
else {
- $links[] = theme("comment_post_forbidden");
+ $links[] = theme('comment_post_forbidden');
}
}
}
}
- if ($type == "comment") {
+ if ($type == 'comment') {
$links = comment_links($node, $main);
}
- if ($type == "system") {
- if (user_access("administer comments")) {
+ if ($type == 'system') {
+ $access = user_access('administer comments');
+ menu('admin/comment', t('comments'), $access ? 'comment_admin' : MENU_DENIED, 1);
+ menu('admin/comment/comments', t('overview'), $access ? 'comment_admin' : MENU_DENIED, 2);
+ menu('admin/comment/comments/0', t('new/updated'), $access ? 'comment_admin' : MENU_DENIED, 1);
+ menu('admin/comment/comments/1', t('approval queue'), $access ? 'comment_admin' : MENU_DENIED, 2);
+ menu('admin/comment/help', t('help'), $access ? 'comment_help_page' : MENU_DENIED, 9);
+ menu('admin/comment/edit', t('edit comment'), $access ? 'comment_admin' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
+ menu('admin/comment/delete', t('delete comment'), $access ? 'comment_admin' : MENU_DENIED, 0, MENU_HIDE, MENU_LOCKED);
+ if (module_exist('search')) {
+ menu('admin/comment/search', t('search'), $access ? 'comment_admin' : MENU_DENIED, 8);
+ }
- menu("admin/comment", t("comments"), "comment_admin", 1);
- menu("admin/comment/comments", t("overview"), "comment_admin", 2);
- menu("admin/comment/comments/0", t("new/updated"), "comment_admin", 1);
- menu("admin/comment/comments/1", t("approval queue"), "comment_admin", 2);
- menu("admin/comment/help", t("help"), "comment_help_page", 9);
- menu("admin/comment/edit", t("edit comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
- menu("admin/comment/delete", t("delete comment"), "comment_admin", 0, MENU_HIDE, MENU_LOCKED);
- if (module_exist('search')) {
- menu("admin/comment/search", t("search"), "comment_admin", 8);
- }
+ // comment settings:
+ $access = user_access('administer comments') && user_access('administer moderation');
+ menu('admin/comment/moderation', t('moderation'), $access ? 'comment_admin' : MENU_DENIED, 3);
+ menu('admin/comment/moderation/votes', t('votes'), $access ? 'comment_admin' : MENU_DENIED);
+ menu('admin/comment/moderation/matrix', t('matrix'), $access ? 'comment_admin' : MENU_DENIED);
+ menu('admin/comment/moderation/filters', t('thresholds'), $access ? 'comment_admin' : MENU_DENIED);
+ menu('admin/comment/moderation/roles', t('initial scores'), $access ? 'comment_admin' : MENU_DENIED, 6);
- // comment settings:
- if (user_access("administer moderation")) {
- menu("admin/comment/moderation", t("moderation"), "comment_admin", 3);
- menu("admin/comment/moderation/votes", t("votes"), "comment_admin");
- menu("admin/comment/moderation/matrix", t("matrix"), "comment_admin");
- menu("admin/comment/moderation/filters", t("thresholds"), "comment_admin");
- menu("admin/comment/moderation/roles", t("initial scores"), "comment_admin", 6);
- }
- }
- menu("comment", t("comments"), "comment_page", 0, MENU_HIDE, MENU_LOCKED);
+ menu('comment', t('comments'), 'comment_page', 0, MENU_HIDE, MENU_LOCKED);
}
return $links;