diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-21 14:19:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-21 14:19:20 +0000 |
commit | cccb132c81e82cc01ca7f014d185c1ecce864377 (patch) | |
tree | 2814a3444025cc756968c6e273b65c6475c9012e /includes/node.inc | |
parent | 3f1979aa3cfa2d50789e88bd0a857dec6babb44b (diff) | |
download | brdo-cccb132c81e82cc01ca7f014d185c1ecce864377.tar.gz brdo-cccb132c81e82cc01ca7f014d185c1ecce864377.tar.bz2 |
- Addition: added a "promote" field to the node table, which
makes "promoting nodes" to the main page possible. Stories
and reviews could be promoted by default, but - on accasion
a good book entry could be manually promoted too. Thus all
existing content types can be shown on the main page, not
just stories.
Requires a SQL update, see 2.00-to-x.xx.sql!
- Addition: implemented "auto-post new submissions" feature
to disable or by-pass the moderation queue in addition to
"moderate new submissions".
TODO: admin moderation versus registered user moderation.
- Addition: added category and topic support to page.module.
Diffstat (limited to 'includes/node.inc')
-rw-r--r-- | includes/node.inc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/includes/node.inc b/includes/node.inc index 733c38da0..aa401cea8 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -10,6 +10,21 @@ function _node_get($field, $value) { } } +function node_comment_status($index = -1) { + $status = array("disabled", "enabled"); + return $index < 0 ? $status : $status[$index]; +} + +function node_promote_status($index = -1) { + $status = array("disabled", "enabled"); + return $index < 0 ? $status : $status[$index]; +} + +function node_submission_status($index = -1) { + $status = array("auto-post new submissions", "moderate new submissions"); + return $index < 0 ? $status : $status[$index]; +} + function node_get_object($field, $value) { return db_fetch_object(_node_get($field, $value)); } @@ -39,7 +54,7 @@ function node_get_comments($nid) { function node_save($node) { global $user, $status; - $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, timestamp); + $rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, timestamp); if ($node[nid] > 0) { $n = node_get_object("nid", $node[nid]); @@ -71,10 +86,11 @@ function node_save($node) { watchdog("warning", "node: duplicate '$node[title]'"); } else { + // verify submission rate: throttle("post node", variable_get(max_node_rate, 900)); // setup default values: - $node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => $status[queued], score => 0, votes => 0, comment => 1, timestamp => time()), $node); + $node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => (category_submission($node[cid]) ? $status[queued] : $status[posted]) , score => 0, votes => 0, comment => category_comment($node[cid]), promote => category_promote($node[cid]), timestamp => time()), $node); // prepare queries: $f1 = array(); |