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 | |
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')
-rw-r--r-- | includes/comment.inc | 5 | ||||
-rw-r--r-- | includes/node.inc | 20 | ||||
-rw-r--r-- | includes/structure.inc | 14 |
3 files changed, 31 insertions, 8 deletions
diff --git a/includes/comment.inc b/includes/comment.inc index 6d6290f1e..0d1003530 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -145,11 +145,6 @@ function comment_post($pid, $id, $subject, $comment) { } } -function comment_status($index = -1) { - $status = array("disabled", "enabled"); - return $index < 0 ? $status : $status[$index]; -} - function comment_score($comment) { $value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0); return ((strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00"); 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(); diff --git a/includes/structure.inc b/includes/structure.inc index 94c14ad6d..aabb9d34a 100644 --- a/includes/structure.inc +++ b/includes/structure.inc @@ -50,7 +50,19 @@ function category_expire_threshold($cid) { // return default comment status of category $cid: function category_comment($cid) { $category = category_get_object("cid", $cid); - return $category->comment; + return $category->comment ? $category->comment : 0; +} + +// return default promote status of category $cid: +function category_promote($cid) { + $category = category_get_object("cid", $cid); + return $category->promote ? $category->promote : 0; +} + +// return default submission status of category $cid: +function category_submission($cid) { + $category = category_get_object("cid", $cid); + return $category->submission ? $category->submission : 0; } // return linked string with name of category $cid: |