diff --git a/modules/blog.module b/modules/blog.module index 1674394a1f03f744692143c83089afa26b81f729..0791a22376706632e4bab4a74affe7389908ef38 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -47,7 +47,7 @@ function blog_save($op, $node) { } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array(); } else { @@ -60,27 +60,21 @@ function blog_save($op, $node) { } if ($op == "update") { - if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) { + if (user_access("administer nodes")) { /* - ** Updating your own blog entry will demote it (if promoted), - ** and will queue it in the moderation queue for promotion. - ** If a node administrator updates his own blog entry through - ** the blog update mechanism that regular users use, then he - ** will be treated as a regular user and his blog entry will - ** be demoted. We use the $REQUEST_URI field to dectect this - ** as we don't want to interfer with the updating of blog - ** entries through the admin pages. + ** When an administrator updates blog entries through the admin + ** pages, they will not be changed unless explicitly specified. */ - return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); + return array(); } - else if (user_access("adminster nodes")) { + else { /* - ** When an administrator updates blog entries through the admin - ** pages, they will not be changed unless explicitly specified. + ** Updating your own blog entry will demote it (if promoted), + ** and will queue it in the moderation queue for promotion. */ - return array(); + return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); } } @@ -315,7 +309,7 @@ function blog_link($type, $node = 0) { } if ($type == "menu.create" && user_access("post content")) { - $links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Post a new entry to your personal blog.") ."\">". t("create blog entry") ."</a>"; + $links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Add a new personal blog entry.") ."\">". t("create blog entry") ."</a>"; } if ($type == "menu.view" && user_access("access content")) { diff --git a/modules/blog/blog.module b/modules/blog/blog.module index 1674394a1f03f744692143c83089afa26b81f729..0791a22376706632e4bab4a74affe7389908ef38 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -47,7 +47,7 @@ function blog_save($op, $node) { } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array(); } else { @@ -60,27 +60,21 @@ function blog_save($op, $node) { } if ($op == "update") { - if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) { + if (user_access("administer nodes")) { /* - ** Updating your own blog entry will demote it (if promoted), - ** and will queue it in the moderation queue for promotion. - ** If a node administrator updates his own blog entry through - ** the blog update mechanism that regular users use, then he - ** will be treated as a regular user and his blog entry will - ** be demoted. We use the $REQUEST_URI field to dectect this - ** as we don't want to interfer with the updating of blog - ** entries through the admin pages. + ** When an administrator updates blog entries through the admin + ** pages, they will not be changed unless explicitly specified. */ - return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); + return array(); } - else if (user_access("adminster nodes")) { + else { /* - ** When an administrator updates blog entries through the admin - ** pages, they will not be changed unless explicitly specified. + ** Updating your own blog entry will demote it (if promoted), + ** and will queue it in the moderation queue for promotion. */ - return array(); + return array("body" => filter($node->body), "promote" => 0, "moderate" => 1, "score" => 0, "teaser" => filter($node->teaser), "votes" => 0, "users" => 0); } } @@ -315,7 +309,7 @@ function blog_link($type, $node = 0) { } if ($type == "menu.create" && user_access("post content")) { - $links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Post a new entry to your personal blog.") ."\">". t("create blog entry") ."</a>"; + $links[] = "<a href=\"module.php?mod=node&op=add&type=blog\" title=\"". t("Add a new personal blog entry.") ."\">". t("create blog entry") ."</a>"; } if ($type == "menu.view" && user_access("access content")) { diff --git a/modules/book.module b/modules/book.module index 7bcb0d2efea7f6897bfd88e0476d8d54b3a80343..76e7fd3d525c1cafaa47bbb0d0eedfbd73cb206a 100644 --- a/modules/book.module +++ b/modules/book.module @@ -49,14 +49,14 @@ function book_access($op, $node) { } function book_save($op, $node) { - global $user, $REQUEST_URI; + global $user; if ($op == "approve") { return array("status" => 1); } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array("format", "parent", "weight"); } else { @@ -69,25 +69,22 @@ function book_save($op, $node) { } if ($op == "update") { - if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) { + if (user_access("administer nodes")) { /* - ** If a regular user updates a book page, we always create a new - ** revision. All new revisions have to be approved (moderation) - ** and are not promoted by default. See also: book_load(). + ** If a node administrator updates a book page, we don't create a + ** new revision unless we are explicitly instructed to. */ - return array("created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight"); + return array("format", "parent", "weight"); } - else if (user_access("adminster nodes")) { + else { /* - ** If a node administrator updates a book page, we don't create a - ** new revision unless we are explicitly instructed to. If a node - ** administrator updates a book page using the "edit this page" - ** link (like regular users do) then he'll be treated as a regular - ** user. + ** If a regular user updates a book page, we always create a new + ** revision. All new revisions have to be approved (moderation) + ** and are not promoted by default. See also: book_load(). */ - return array("format", "parent", "weight"); + return array("created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight"); } } @@ -95,7 +92,11 @@ function book_save($op, $node) { function book_link($type, $node = 0, $main = 0) { if ($type == "page" && user_access("access content")) { - $links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to our collaborative books.") ."\">". t("collaborative book") ."</a>"; + $links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to the collaborative books.") ."\">". t("collaborative book") ."</a>"; + } + + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=book\" title=\"". t("Add a new book page.") ."\">". t("create book page") ."</a>"; } if ($type == "admin" && user_access("administer nodes")) { @@ -316,7 +317,7 @@ function book_body($node) { */ if ($op == t("Preview")) { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { $node->body = stripslashes($node->body); // see also book_form() } else { diff --git a/modules/book/book.module b/modules/book/book.module index 7bcb0d2efea7f6897bfd88e0476d8d54b3a80343..76e7fd3d525c1cafaa47bbb0d0eedfbd73cb206a 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -49,14 +49,14 @@ function book_access($op, $node) { } function book_save($op, $node) { - global $user, $REQUEST_URI; + global $user; if ($op == "approve") { return array("status" => 1); } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array("format", "parent", "weight"); } else { @@ -69,25 +69,22 @@ function book_save($op, $node) { } if ($op == "update") { - if (strstr($REQUEST_URI, "module.php?mod=node&op=edit")) { + if (user_access("administer nodes")) { /* - ** If a regular user updates a book page, we always create a new - ** revision. All new revisions have to be approved (moderation) - ** and are not promoted by default. See also: book_load(). + ** If a node administrator updates a book page, we don't create a + ** new revision unless we are explicitly instructed to. */ - return array("created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight"); + return array("format", "parent", "weight"); } - else if (user_access("adminster nodes")) { + else { /* - ** If a node administrator updates a book page, we don't create a - ** new revision unless we are explicitly instructed to. If a node - ** administrator updates a book page using the "edit this page" - ** link (like regular users do) then he'll be treated as a regular - ** user. + ** If a regular user updates a book page, we always create a new + ** revision. All new revisions have to be approved (moderation) + ** and are not promoted by default. See also: book_load(). */ - return array("format", "parent", "weight"); + return array("created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight"); } } @@ -95,7 +92,11 @@ function book_save($op, $node) { function book_link($type, $node = 0, $main = 0) { if ($type == "page" && user_access("access content")) { - $links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to our collaborative books.") ."\">". t("collaborative book") ."</a>"; + $links[] = "<a href=\"module.php?mod=book\" title=\"". t("Read and contribute to the collaborative books.") ."\">". t("collaborative book") ."</a>"; + } + + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=book\" title=\"". t("Add a new book page.") ."\">". t("create book page") ."</a>"; } if ($type == "admin" && user_access("administer nodes")) { @@ -316,7 +317,7 @@ function book_body($node) { */ if ($op == t("Preview")) { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { $node->body = stripslashes($node->body); // see also book_form() } else { diff --git a/modules/forum.module b/modules/forum.module index 139f04dd76fb8b2eb64002f771d3eb5c15777a2a..658f45f78ea23aa784b93f5f8048887cfda3681c 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -38,6 +38,10 @@ function forum_link($type) { $links[] = "<a href=\"module.php?mod=forum\" title=\"". t("Read and participate in the discussion forums.") ."\">". t("forum") ."</a>"; } + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=forum\" title=\"". t("Add a new discussion forum.") ."\">". t("create forum") ."</a>"; + } + return $links ? $links : array(); } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 139f04dd76fb8b2eb64002f771d3eb5c15777a2a..658f45f78ea23aa784b93f5f8048887cfda3681c 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -38,6 +38,10 @@ function forum_link($type) { $links[] = "<a href=\"module.php?mod=forum\" title=\"". t("Read and participate in the discussion forums.") ."\">". t("forum") ."</a>"; } + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=forum\" title=\"". t("Add a new discussion forum.") ."\">". t("create forum") ."</a>"; + } + return $links ? $links : array(); } diff --git a/modules/node.module b/modules/node.module index 57fe3ad8c881fb95967a40e6cb92eba615247bae..983dcfd2b7c9e9a15111e5f29945eef4ea30450a 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1127,7 +1127,7 @@ function node_delete($edit) { } function node_page() { - global $op, $id, $user, $edit, $type, $theme, $meta, $date; + global $op, $id, $user, $edit, $type, $theme, $meta; if ($op == "feed") { node_feed(); @@ -1167,7 +1167,7 @@ function node_page() { $theme->box($title, node_delete($edit)); break; default: - $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND (static = '1' OR created <= '". ($date > 0 ? check_input($date) : time()) ."') ORDER BY static DESC,created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); + $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' ORDER BY static DESC, created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); while ($node = db_fetch_object($result)) { node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1); } diff --git a/modules/node/node.module b/modules/node/node.module index 57fe3ad8c881fb95967a40e6cb92eba615247bae..983dcfd2b7c9e9a15111e5f29945eef4ea30450a 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1127,7 +1127,7 @@ function node_delete($edit) { } function node_page() { - global $op, $id, $user, $edit, $type, $theme, $meta, $date; + global $op, $id, $user, $edit, $type, $theme, $meta; if ($op == "feed") { node_feed(); @@ -1167,7 +1167,7 @@ function node_page() { $theme->box($title, node_delete($edit)); break; default: - $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' AND (static = '1' OR created <= '". ($date > 0 ? check_input($date) : time()) ."') ORDER BY static DESC,created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); + $result = db_query("SELECT nid, type FROM node WHERE ". ($meta ? "attributes LIKE '%". check_input($meta) ."%' AND " : "") ." promote = '1' AND status = '1' ORDER BY static DESC, created DESC LIMIT ". ($user->nodes ? $user->nodes : variable_get("default_nodes_main", 10))); while ($node = db_fetch_object($result)) { node_view(node_load(array("nid" => $node->nid, "type" => $node->type)), 1); } diff --git a/modules/page.module b/modules/page.module index 03925a1e36b62d154e9688e8cdc0d6224fb10902..20cdcc2c77278d0ea6439a773f9f64934372dc5a 100644 --- a/modules/page.module +++ b/modules/page.module @@ -2,8 +2,8 @@ // $Id$ function page_node($field) { - $info["name"] = t("page"); - $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); + $info["name"] = t("site page"); + $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a site page by-passes the submission queue."); return $info[$field]; } @@ -59,14 +59,16 @@ function page_link($type) { } } + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=page\" title=\"". t("Add a new site page.") ."\">". t("create site page") ."</a>"; + } + return $links ? $links : array(); } function page_body($node) { global $theme, $op; - - if ($node->format) { /* ** Make sure only authorized users can preview static (PHP) @@ -74,7 +76,7 @@ function page_body($node) { */ if ($op == t("Preview")) { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { $node->body = stripslashes($node->body); // see also page_form() } else { diff --git a/modules/page/page.module b/modules/page/page.module index 03925a1e36b62d154e9688e8cdc0d6224fb10902..20cdcc2c77278d0ea6439a773f9f64934372dc5a 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -2,8 +2,8 @@ // $Id$ function page_node($field) { - $info["name"] = t("page"); - $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a page by-passes the submission queue."); + $info["name"] = t("site page"); + $info["description"] = t("If you just want to add a page with a link in the menu to your site, this would be the best choice. Unlike a story, a site page by-passes the submission queue."); return $info[$field]; } @@ -59,14 +59,16 @@ function page_link($type) { } } + if ($type == "menu.create" && user_access("administer nodes")) { + $links[] = "<a href=\"module.php?mod=node&op=add&type=page\" title=\"". t("Add a new site page.") ."\">". t("create site page") ."</a>"; + } + return $links ? $links : array(); } function page_body($node) { global $theme, $op; - - if ($node->format) { /* ** Make sure only authorized users can preview static (PHP) @@ -74,7 +76,7 @@ function page_body($node) { */ if ($op == t("Preview")) { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { $node->body = stripslashes($node->body); // see also page_form() } else { diff --git a/modules/queue.module b/modules/queue.module index d03ea647bcd01127c9b5cd2a621ead3c6c413267..57d8c88b69ee73d22a5fe7d8d7510bdfbc4ada50 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -20,7 +20,7 @@ function queue_perm() { function queue_link($type) { if ($type == "menu.view" && user_access("access submission queue")) { - $links[] = "<a href=\"module.php?mod=queue\" title=\"". t("Moderate the content in the submission queue.") ."\">". t("submission queue") ."</a> (<span style=\"color: red;\">". queue_count() ."</span>)"; + $links[] = "<a href=\"module.php?mod=queue\" title=\"". t("Moderate the content in the submission queue.") ."\">". t("view submissions") ."</a> (<span style=\"color: red;\">". queue_count() ."</span>)"; } return $links ? $links : array(); diff --git a/modules/story.module b/modules/story.module index 9ca781de008f6d643560905c63864e4011ff9936..fcffb42ab9bda29c4750cf000028694581debac4 100644 --- a/modules/story.module +++ b/modules/story.module @@ -32,7 +32,7 @@ function story_save($op, $node) { } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array(); } else { @@ -49,6 +49,14 @@ function story_save($op, $node) { } } +function story_link($type) { + if ($type == "menu.create") { + $links[] = "<a href=\"module.php?mod=node&op=add&type=story\" title=\"". t("Add a new story.") ."\">". t("create story") ."</a>"; + } + + return $links ? $links : array(); +} + function story_help() { ?> // TODO: update documentation, outdated diff --git a/modules/story/story.module b/modules/story/story.module index 9ca781de008f6d643560905c63864e4011ff9936..fcffb42ab9bda29c4750cf000028694581debac4 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -32,7 +32,7 @@ function story_save($op, $node) { } if ($op == "create") { - if (user_access("adminster nodes")) { + if (user_access("administer nodes")) { return array(); } else { @@ -49,6 +49,14 @@ function story_save($op, $node) { } } +function story_link($type) { + if ($type == "menu.create") { + $links[] = "<a href=\"module.php?mod=node&op=add&type=story\" title=\"". t("Add a new story.") ."\">". t("create story") ."</a>"; + } + + return $links ? $links : array(); +} + function story_help() { ?> // TODO: update documentation, outdated diff --git a/modules/tracker.module b/modules/tracker.module index c61f17fac7e94329985cd3b2b73ea54e0f7aefe1..27e1579bebf766ddc71cfbd44006925b765fae10 100644 --- a/modules/tracker.module +++ b/modules/tracker.module @@ -4,7 +4,7 @@ function tracker_link($type) { if ($type == "menu.view") { - $links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("recent comments") ."</a>"; + $links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("view new comments") ."</a>"; } return $links ? $links : array(); diff --git a/modules/tracker/tracker.module b/modules/tracker/tracker.module index c61f17fac7e94329985cd3b2b73ea54e0f7aefe1..27e1579bebf766ddc71cfbd44006925b765fae10 100644 --- a/modules/tracker/tracker.module +++ b/modules/tracker/tracker.module @@ -4,7 +4,7 @@ function tracker_link($type) { if ($type == "menu.view") { - $links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("recent comments") ."</a>"; + $links[] = "<a href=\"module.php?mod=tracker\" title=\"". t("Display an overview of the recent comments.") ."\">". t("view new comments") ."</a>"; } return $links ? $links : array();