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

- Committed Al's rollback fixes and the title improvements.  Thanks again.
parent c5637a0a
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
...@@ -373,16 +373,20 @@ function node_view($node, $main = 0) { ...@@ -373,16 +373,20 @@ function node_view($node, $main = 0) {
} }
} }
function node_get_node_from_nid($nid) {
function node_show($nid, $cid) { $revision = $_GET["revision"];
global $revision;
$node = node_load(array("status" => 1, "nid" => $nid)); $node = node_load(array("status" => 1, "nid" => $nid));
if (node_access("view", $node)) {
if (isset($revision)) { if (isset($revision)) {
$node = $node->revisions[$revision]["node"]; $node = $node->revisions[$revision]["node"];
} }
return $node;
}
function node_show($node, $cid) {
if (node_access("view", $node)) {
node_view($node); node_view($node);
...@@ -795,7 +799,6 @@ function node_admin() { ...@@ -795,7 +799,6 @@ function node_admin() {
/* /*
** Compile a list of the administrative links: ** Compile a list of the administrative links:
*/ */
switch ($op) { switch ($op) {
case "search": case "search":
print search_type("node", url("admin/node/search")); print search_type("node", url("admin/node/search"));
...@@ -806,13 +809,13 @@ function node_admin() { ...@@ -806,13 +809,13 @@ function node_admin() {
case "delete": case "delete":
print node_delete(array("nid" => arg(3))); print node_delete(array("nid" => arg(3)));
break; break;
case "rollback+revision": case "rollback revision":
print node_revision_rollback(node_load(array("nid" => arg(3))), arg(5)); print node_revision_rollback(node_load(array("nid" => arg(3))), arg(4));
print node_admin_edit(arg(4)); print node_admin_edit(arg(3));
break; break;
case "delete+revision": case "delete revision":
print node_revision_delete(node_load(array("nid" => arg(3))), arg(5)); print node_revision_delete(node_load(array("nid" => arg(3))), arg(4));
print node_admin_edit(arg(4)); print node_admin_edit(arg(3));
break; break;
case t("Preview"): case t("Preview"):
$edit = node_validate($edit, $error); $edit = node_validate($edit, $error);
...@@ -1399,7 +1402,11 @@ function node_page() { ...@@ -1399,7 +1402,11 @@ function node_page() {
return; return;
} }
theme("header"); if ($op == "view") {
$node = node_get_node_from_nid(arg(2));
}
theme("header", $node->title);
$name = module_invoke(arg(2), "node", "name"); $name = module_invoke(arg(2), "node", "name");
...@@ -1411,7 +1418,7 @@ function node_page() { ...@@ -1411,7 +1418,7 @@ function node_page() {
theme("box", t("Edit $name"), node_edit(arg(2))); theme("box", t("Edit $name"), node_edit(arg(2)));
break; break;
case "view": case "view":
print node_show(arg(2), arg(3)); print node_show($node, arg(3));
break; break;
case t("Preview"): case t("Preview"):
$edit = node_validate($edit, $error); $edit = node_validate($edit, $error);
......
...@@ -373,16 +373,20 @@ function node_view($node, $main = 0) { ...@@ -373,16 +373,20 @@ function node_view($node, $main = 0) {
} }
} }
function node_get_node_from_nid($nid) {
function node_show($nid, $cid) { $revision = $_GET["revision"];
global $revision;
$node = node_load(array("status" => 1, "nid" => $nid)); $node = node_load(array("status" => 1, "nid" => $nid));
if (node_access("view", $node)) {
if (isset($revision)) { if (isset($revision)) {
$node = $node->revisions[$revision]["node"]; $node = $node->revisions[$revision]["node"];
} }
return $node;
}
function node_show($node, $cid) {
if (node_access("view", $node)) {
node_view($node); node_view($node);
...@@ -795,7 +799,6 @@ function node_admin() { ...@@ -795,7 +799,6 @@ function node_admin() {
/* /*
** Compile a list of the administrative links: ** Compile a list of the administrative links:
*/ */
switch ($op) { switch ($op) {
case "search": case "search":
print search_type("node", url("admin/node/search")); print search_type("node", url("admin/node/search"));
...@@ -806,13 +809,13 @@ function node_admin() { ...@@ -806,13 +809,13 @@ function node_admin() {
case "delete": case "delete":
print node_delete(array("nid" => arg(3))); print node_delete(array("nid" => arg(3)));
break; break;
case "rollback+revision": case "rollback revision":
print node_revision_rollback(node_load(array("nid" => arg(3))), arg(5)); print node_revision_rollback(node_load(array("nid" => arg(3))), arg(4));
print node_admin_edit(arg(4)); print node_admin_edit(arg(3));
break; break;
case "delete+revision": case "delete revision":
print node_revision_delete(node_load(array("nid" => arg(3))), arg(5)); print node_revision_delete(node_load(array("nid" => arg(3))), arg(4));
print node_admin_edit(arg(4)); print node_admin_edit(arg(3));
break; break;
case t("Preview"): case t("Preview"):
$edit = node_validate($edit, $error); $edit = node_validate($edit, $error);
...@@ -1399,7 +1402,11 @@ function node_page() { ...@@ -1399,7 +1402,11 @@ function node_page() {
return; return;
} }
theme("header"); if ($op == "view") {
$node = node_get_node_from_nid(arg(2));
}
theme("header", $node->title);
$name = module_invoke(arg(2), "node", "name"); $name = module_invoke(arg(2), "node", "name");
...@@ -1411,7 +1418,7 @@ function node_page() { ...@@ -1411,7 +1418,7 @@ function node_page() {
theme("box", t("Edit $name"), node_edit(arg(2))); theme("box", t("Edit $name"), node_edit(arg(2)));
break; break;
case "view": case "view":
print node_show(arg(2), arg(3)); print node_show($node, arg(3));
break; break;
case t("Preview"): case t("Preview"):
$edit = node_validate($edit, $error); $edit = node_validate($edit, $error);
......
...@@ -22,8 +22,9 @@ function title_page() { ...@@ -22,8 +22,9 @@ function title_page() {
else if (db_num_rows($result) == 1) { else if (db_num_rows($result) == 1) {
$node = db_fetch_object($result); $node = db_fetch_object($result);
$node = get_node_from_nid($node->nid);
theme("header"); theme("header");
print node_show($node->nid, NULL); print node_show($node, NULL);
theme("footer"); theme("footer");
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment