Removed node_get_node_from_nid() and modified node_load() to take an optional 2nd arguments to return a specified revision. Patch be Kjartan.

4.2.x
Dries Buytaert 2003-06-01 06:32:55 +00:00
parent 5e2ce07616
commit 882c3f6d2d
2 changed files with 18 additions and 26 deletions

View File

@ -216,7 +216,7 @@ function node_invoke_all(&$node, $hook, $op, $arg = 0) {
return $return;
}
function node_load($conditions) {
function node_load($conditions, $revision = -1) {
/*
** Turn the conditions into a query:
@ -251,6 +251,13 @@ function node_load($conditions) {
}
}
/*
** Return the desired revision
*/
if ($revision != -1 && isset($node->revisions[$revision])) {
$node = $node->revisions[$revision]["node"];
}
return $node;
}
@ -373,17 +380,6 @@ function node_view($node, $main = 0) {
}
}
function node_get_node_from_nid($nid) {
$revision = $_GET["revision"];
$node = node_load(array("status" => 1, "nid" => $nid));
if (isset($revision)) {
$node = $node->revisions[$revision]["node"];
}
return $node;
}
function node_show($node, $cid) {
if (node_access("view", $node)) {
@ -1403,7 +1399,7 @@ function node_page() {
}
if ($op == "view") {
$node = node_get_node_from_nid(arg(2));
$node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
}
theme("header", $node->title);

View File

@ -216,7 +216,7 @@ function node_invoke_all(&$node, $hook, $op, $arg = 0) {
return $return;
}
function node_load($conditions) {
function node_load($conditions, $revision = -1) {
/*
** Turn the conditions into a query:
@ -251,6 +251,13 @@ function node_load($conditions) {
}
}
/*
** Return the desired revision
*/
if ($revision != -1 && isset($node->revisions[$revision])) {
$node = $node->revisions[$revision]["node"];
}
return $node;
}
@ -373,17 +380,6 @@ function node_view($node, $main = 0) {
}
}
function node_get_node_from_nid($nid) {
$revision = $_GET["revision"];
$node = node_load(array("status" => 1, "nid" => $nid));
if (isset($revision)) {
$node = $node->revisions[$revision]["node"];
}
return $node;
}
function node_show($node, $cid) {
if (node_access("view", $node)) {
@ -1403,7 +1399,7 @@ function node_page() {
}
if ($op == "view") {
$node = node_get_node_from_nid(arg(2));
$node = node_load(array("nid" => arg(2), "status" => 1), $_GET["revision"]);
}
theme("header", $node->title);