From cccb132c81e82cc01ca7f014d185c1ecce864377 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 21 Apr 2001 14:19:20 +0000 Subject: - 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. --- includes/node.inc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'includes/node.inc') 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(); -- cgit v1.2.3