Skip to content
Snippets Groups Projects
Commit c1c612b1 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- 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.
parent 64d11e1c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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")) {
......
......@@ -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")) {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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();
}
......
......@@ -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();
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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();
......
......@@ -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
......
......@@ -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
......
......@@ -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();
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment