summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-11-01 17:04:20 +0000
committerDries Buytaert <dries@buytaert.net>2001-11-01 17:04:20 +0000
commit23ca7a2d8832aa16107cf7002c35170ae2b87a1c (patch)
tree7878082b9e4bd2b0d20380d11c6404b72cd44d32 /includes
parent3d47ad359ded4cb947b7ada9b3418640cfb3c642 (diff)
downloadbrdo-23ca7a2d8832aa16107cf7002c35170ae2b87a1c.tar.gz
brdo-23ca7a2d8832aa16107cf7002c35170ae2b87a1c.tar.bz2
- 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.
Diffstat (limited to 'includes')
-rw-r--r--includes/node.inc43
1 files changed, 11 insertions, 32 deletions
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 @@
<?php
// $Id$
-/*
-** Loading and storing nodes:
-** - load: called when a node is being loaded
-** - save: called before a node gets saved and used to define default
-** values
-** - insert: called when inserting a node to the node table
-** - delete: called when deleting a node from the node table
-** - update: called when updating a node in the noe table
-**
-** Viewing and editing nodes:
-** - view: called to display a node on the screen
-** - form: called to display a node's form
-**
-** - status
-*/
-
// TODO: still used by themes, yet doesn't return anything at the moment
function node_index() {
}
-function node_access($node) {
- global $user;
- return ($node->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) {