Commit 2510f322 authored by Dries's avatar Dries

- Modified patch #10613 by killes: generate a 'page not found'-page when a...

- 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.
parent 5f28d97a
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment