summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-06-01 06:32:55 +0000
committerDries Buytaert <dries@buytaert.net>2003-06-01 06:32:55 +0000
commit882c3f6d2d6d82513b94cf6b719e01e803a33cf1 (patch)
treeef43683ea614e30e6fd23acf4dc87adede4c2945 /modules/node
parent5e2ce07616eea5dc4abde78a00370aed529e056b (diff)
downloadbrdo-882c3f6d2d6d82513b94cf6b719e01e803a33cf1.tar.gz
brdo-882c3f6d2d6d82513b94cf6b719e01e803a33cf1.tar.bz2
Removed node_get_node_from_nid() and modified node_load() to take an optional 2nd arguments to return a specified revision. Patch be Kjartan.
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.module22
1 files changed, 9 insertions, 13 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 4709410c1..5d916d04e 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -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);