summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-10-12 20:01:25 +0000
committerDries Buytaert <dries@buytaert.net>2004-10-12 20:01:25 +0000
commit2510f322a183acd4040748ce9905d08de59fecb1 (patch)
tree704b0d2354974f67c948441f6edbecb1b3e23f13 /modules
parent5f28d97a0f219b80df83b07f9be36c4aabd75c60 (diff)
downloadbrdo-2510f322a183acd4040748ce9905d08de59fecb1.tar.gz
brdo-2510f322a183acd4040748ce9905d08de59fecb1.tar.bz2
- Modified patch #10613 by killes: generate a 'page not found'-page when a requested node does not exist. I modified the patch to avoid duplicate 'not found'-checking in the second bulk.
Diffstat (limited to 'modules')
-rw-r--r--modules/node.module40
-rw-r--r--modules/node/node.module40
2 files changed, 42 insertions, 38 deletions
diff --git a/modules/node.module b/modules/node.module
index b6e76329a..996e7631e 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -665,25 +665,26 @@ function node_menu($may_cache) {
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(array('nid' => arg(1)));
-
- $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
- 'callback' => 'node_page',
- 'access' => node_access('view', $node),
- 'type' => MENU_CALLBACK);
- $items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
- 'callback' => 'node_page',
- 'access' => node_access('update', $node),
- 'weight' => 1,
- 'type' => MENU_LOCAL_TASK);
-
- if ($node->revisions) {
- $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ if ($node->nid) {
+ $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
'callback' => 'node_page',
- 'access' => user_access('administer nodes'),
- 'weight' => 2,
+ 'access' => node_access('view', $node),
+ 'type' => MENU_CALLBACK);
+ $items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
+ 'callback' => 'node_page',
+ 'access' => node_access('update', $node),
+ 'weight' => 1,
'type' => MENU_LOCAL_TASK);
+
+ if ($node->revisions) {
+ $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ 'callback' => 'node_page',
+ 'access' => user_access('administer nodes'),
+ 'weight' => 2,
+ 'type' => MENU_LOCAL_TASK);
+ }
}
}
}
@@ -1474,8 +1475,9 @@ function node_page() {
break;
case 'view':
if (is_numeric(arg(1))) {
- if ($node = node_load(array('nid' => arg(1)), $_GET['revision'])) {
- print theme('page', node_show($node, arg(3)), $node->title);
+ $node = node_load(array('nid' => arg(1)), $_GET['revision']);
+ if ($node->nid) {
+ print theme('page', node_show($node, arg(2)), $node->title);
}
else {
drupal_not_found();
diff --git a/modules/node/node.module b/modules/node/node.module
index b6e76329a..996e7631e 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -665,25 +665,26 @@ function node_menu($may_cache) {
else {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(array('nid' => arg(1)));
-
- $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
- 'callback' => 'node_page',
- 'access' => node_access('view', $node),
- 'type' => MENU_CALLBACK);
- $items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
- $items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
- 'callback' => 'node_page',
- 'access' => node_access('update', $node),
- 'weight' => 1,
- 'type' => MENU_LOCAL_TASK);
-
- if ($node->revisions) {
- $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ if ($node->nid) {
+ $items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
'callback' => 'node_page',
- 'access' => user_access('administer nodes'),
- 'weight' => 2,
+ 'access' => node_access('view', $node),
+ 'type' => MENU_CALLBACK);
+ $items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ $items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
+ 'callback' => 'node_page',
+ 'access' => node_access('update', $node),
+ 'weight' => 1,
'type' => MENU_LOCAL_TASK);
+
+ if ($node->revisions) {
+ $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
+ 'callback' => 'node_page',
+ 'access' => user_access('administer nodes'),
+ 'weight' => 2,
+ 'type' => MENU_LOCAL_TASK);
+ }
}
}
}
@@ -1474,8 +1475,9 @@ function node_page() {
break;
case 'view':
if (is_numeric(arg(1))) {
- if ($node = node_load(array('nid' => arg(1)), $_GET['revision'])) {
- print theme('page', node_show($node, arg(3)), $node->title);
+ $node = node_load(array('nid' => arg(1)), $_GET['revision']);
+ if ($node->nid) {
+ print theme('page', node_show($node, arg(2)), $node->title);
}
else {
drupal_not_found();