From 23ca7a2d8832aa16107cf7002c35170ae2b87a1c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 1 Nov 2001 17:04:20 +0000 Subject: - Another batch of updates/improvements: + introduced basic node permissions ("create", "delete", "update" and "view") at the node level: it's up to the "<$node->type>_module" to hide gory details (if any). + made the "blog it"-feature in the blog and import module work with the new node system, in specific with the new centralized forms. + made it possible to update blogs. + made the page module work with the new node system. + various smaller improvements. --- includes/node.inc | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) (limited to 'includes') diff --git a/includes/node.inc b/includes/node.inc index a42cc0232..01f5c17a0 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -1,31 +1,10 @@ status == 1) || user_access("administer nodes"); -} - function node_get_comments($nid) { $comment = db_fetch_object(db_query("SELECT COUNT(c.lid) AS number FROM node n LEFT JOIN comments c ON n.nid = c.lid WHERE n.nid = '$nid' GROUP BY n.nid")); return $comment->number ? $comment->number : 0; @@ -210,21 +189,21 @@ function node_save($node, $filter) { } -function node_delete($conditions) { +function node_delete($node) { - if ($node = node_load($conditions)) { - - // delete the node and its comments: - db_query("DELETE FROM node WHERE nid = '$node->nid'"); - db_query("DELETE FROM comments WHERE lid = '$node->nid'"); - db_query("DELETE FROM moderate WHERE nid = '$node->nid'"); + if (is_array($node)) { + $node = node_object($node); + } - // call the node specific callback (if any): - module_invoke($node->type, "delete", &$node); + // delete the node and its comments: + db_query("DELETE FROM node WHERE nid = '$node->nid'"); + db_query("DELETE FROM comments WHERE lid = '$node->nid'"); + db_query("DELETE FROM moderate WHERE nid = '$node->nid'"); - watchdog("special", "node: deleted '$node->title'"); - } + // call the node specific callback (if any): + module_invoke($node->type, "delete", &$node); + watchdog("special", "node: deleted '$node->title'"); } function node_view($node, $main = 0) { -- cgit v1.2.3