summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-01-31 20:23:44 +0000
committerDries Buytaert <dries@buytaert.net>2002-01-31 20:23:44 +0000
commitc1c612b12826ab9bf65283f5430f4c7558e24699 (patch)
treea77fe6d40f7412e8aa89102c3ff25460c8c3540e
parent64d11e1cc2a330778bb57dff2daf3e5bec29f5ee (diff)
downloadbrdo-c1c612b12826ab9bf65283f5430f4c7558e24699.tar.gz
brdo-c1c612b12826ab9bf65283f5430f4c7558e24699.tar.bz2
- Made the calendar module accept a $date parameter such that you
can jump directly to a certain date in the archives. Also made the calendar link to itself such that it is self-contained. - Code beautifications: quoted a lot of arrays, removed dead code and simplified a few things. - Replaced the Calendar class by one function "calendar_display": using a class (or class instance, or object) doesn't make sense in the archives' case. - Renamed "calendar.module" to "archive.module". - Fixed a /problem/ with node settings not always being saved like expected. - Reorganized the user menu: renamed a couple of links for clarity and structure. - Fixed a few typos.
-rw-r--r--modules/blog.module26
-rw-r--r--modules/blog/blog.module26
-rw-r--r--modules/book.module33
-rw-r--r--modules/book/book.module33
-rw-r--r--modules/forum.module4
-rw-r--r--modules/forum/forum.module4
-rw-r--r--modules/node.module4
-rw-r--r--modules/node/node.module4
-rw-r--r--modules/page.module12
-rw-r--r--modules/page/page.module12
-rw-r--r--modules/queue.module2
-rw-r--r--modules/story.module10
-rw-r--r--modules/story/story.module10
-rw-r--r--modules/tracker.module2
-rw-r--r--modules/tracker/tracker.module2
15 files changed, 101 insertions, 83 deletions
diff --git a/modules/blog.module b/modules/blog.module
index 1674394a1..0791a2237 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 1674394a1..0791a2237 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 7bcb0d2ef..76e7fd3d5 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 7bcb0d2ef..76e7fd3d5 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 139f04dd7..658f45f78 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 139f04dd7..658f45f78 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 57fe3ad8c..983dcfd2b 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 57fe3ad8c..983dcfd2b 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 03925a1e3..20cdcc2c7 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 03925a1e3..20cdcc2c7 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 d03ea647b..57d8c88b6 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 9ca781de0..fcffb42ab 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 9ca781de0..fcffb42ab 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 c61f17fac..27e1579be 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 c61f17fac..27e1579be 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();