summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-01-31 10:39:35 +0000
committerDries Buytaert <dries@buytaert.net>2004-01-31 10:39:35 +0000
commit252cf676ae747aa5597cb359cb9315632581032a (patch)
treeb4ae0e6a840e633d6fb2d572d0cd18d786982328
parentfcb9011d880d7d3793425102a6f06b4678866abc (diff)
downloadbrdo-252cf676ae747aa5597cb359cb9315632581032a.tar.gz
brdo-252cf676ae747aa5597cb359cb9315632581032a.tar.bz2
- Patch #5526 by Kjartan: cleaned up node_page(), show a 404 when the node
could not be found.
-rw-r--r--modules/node.module42
-rw-r--r--modules/node/node.module42
2 files changed, 32 insertions, 52 deletions
diff --git a/modules/node.module b/modules/node.module
index b966bec09..44fdda8a7 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1270,6 +1270,7 @@ function node_add($type) {
}
}
$output = node_form($node);
+ drupal_set_title(t("Submit %name", array("%name" => node_invoke($node, 'node_name'))));
drupal_set_breadcrumb(array(l(t("Home"), NULL), l(t("create content"), "node/add")));
}
else {
@@ -1299,6 +1300,8 @@ function node_edit($id) {
$node = node_load(array("nid" => $id));
+ drupal_set_title(t("Edit %name", array("%name" => node_invoke($node, "node_name"))));
+
if (node_access("update", $node)) {
$output = node_form($node);
}
@@ -1486,40 +1489,27 @@ function node_delete($edit) {
}
function node_page() {
- $op = $_POST["op"];
- $edit = $_POST["edit"];
-
if (user_access("access content")) {
- if (empty($op)) {
- $op = arg(1);
- }
-
- if ($op == "feed") {
- node_feed();
- return;
- }
-
- if ($op == "view") {
- $node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
- }
-
- if ($op == "add" && arg(3)) {
- $type = arg(2) . "/" . arg(3);
- }
- else {
- $type = arg(2);
- }
- $name = node_invoke($type, "node_name");
+ $op = $_POST['op'] ? $_POST['op'] : arg(1);
+ $edit = $_POST['edit'];
switch ($op) {
+ case 'feed':
+ node_feed();
+ return;
case "add":
- print theme("page", node_add($type), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
+ print theme("page", node_add(arg(2)));
break;
case "edit":
- print theme("page", node_edit(arg(2)), t("Edit %name", array("%name" => $name)));
+ print theme("page", node_edit(arg(2)));
break;
case "view":
- print theme("page", node_show($node, arg(3)), $node->title);
+ if ($node = node_load(array('nid' => arg(2)), $_GET["revision"])) {
+ print theme("page", node_show($node, arg(3)), $node->title);
+ }
+ else {
+ drupal_not_found();
+ }
break;
case "revisions":
print theme("page", node_revision_overview(arg(2)), t("Revisions"));
diff --git a/modules/node/node.module b/modules/node/node.module
index b966bec09..44fdda8a7 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1270,6 +1270,7 @@ function node_add($type) {
}
}
$output = node_form($node);
+ drupal_set_title(t("Submit %name", array("%name" => node_invoke($node, 'node_name'))));
drupal_set_breadcrumb(array(l(t("Home"), NULL), l(t("create content"), "node/add")));
}
else {
@@ -1299,6 +1300,8 @@ function node_edit($id) {
$node = node_load(array("nid" => $id));
+ drupal_set_title(t("Edit %name", array("%name" => node_invoke($node, "node_name"))));
+
if (node_access("update", $node)) {
$output = node_form($node);
}
@@ -1486,40 +1489,27 @@ function node_delete($edit) {
}
function node_page() {
- $op = $_POST["op"];
- $edit = $_POST["edit"];
-
if (user_access("access content")) {
- if (empty($op)) {
- $op = arg(1);
- }
-
- if ($op == "feed") {
- node_feed();
- return;
- }
-
- if ($op == "view") {
- $node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
- }
-
- if ($op == "add" && arg(3)) {
- $type = arg(2) . "/" . arg(3);
- }
- else {
- $type = arg(2);
- }
- $name = node_invoke($type, "node_name");
+ $op = $_POST['op'] ? $_POST['op'] : arg(1);
+ $edit = $_POST['edit'];
switch ($op) {
+ case 'feed':
+ node_feed();
+ return;
case "add":
- print theme("page", node_add($type), arg(2) ? t("Submit %name", array("%name" => $name)) : t("create content"));
+ print theme("page", node_add(arg(2)));
break;
case "edit":
- print theme("page", node_edit(arg(2)), t("Edit %name", array("%name" => $name)));
+ print theme("page", node_edit(arg(2)));
break;
case "view":
- print theme("page", node_show($node, arg(3)), $node->title);
+ if ($node = node_load(array('nid' => arg(2)), $_GET["revision"])) {
+ print theme("page", node_show($node, arg(3)), $node->title);
+ }
+ else {
+ drupal_not_found();
+ }
break;
case "revisions":
print theme("page", node_revision_overview(arg(2)), t("Revisions"));