Removed node_get_node_from_nid() and modified node_load() to take an optional 2nd arguments to return a specified revision. Patch be Kjartan.
parent
5e2ce07616
commit
882c3f6d2d
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue