diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-01-21 19:41:11 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-01-21 19:41:11 +0000 |
commit | ea9788853352750389307d94999ebe58991929b1 (patch) | |
tree | 50634b44ac6bf11dd346d9b6f034e415bea4b8c2 /includes/submission.inc | |
parent | 7cc7b405e323f36037dab894b69d6fd739915d5d (diff) | |
download | brdo-ea9788853352750389307d94999ebe58991929b1.tar.gz brdo-ea9788853352750389307d94999ebe58991929b1.tar.bz2 |
I know, I know, it is getting nasty lately but I have another large commit after nothing but code.
This time I redid the "category"-stuff. Categories - from now on called sections - are now maintained from the admin pages, can have their own post, dump and timout thresholds as discussed earlier (some weeks ago). By tomorrow evening users will be able to enable or disable section as well - i.e. to customize the content of drop.org.
Diffstat (limited to 'includes/submission.inc')
-rw-r--r-- | includes/submission.inc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/includes/submission.inc b/includes/submission.inc index 628aeae75..609dc06d9 100644 --- a/includes/submission.inc +++ b/includes/submission.inc @@ -11,7 +11,7 @@ function submission_score($id) { } function submission_vote($id, $vote, $comment) { - global $submission_post_threshold, $submission_dump_threshold, $user; + global $user; if (!user_getHistory($user->history, "s$id")) { // Update submission's score- and votes-field: @@ -19,27 +19,30 @@ function submission_vote($id, $vote, $comment) { // Update the comments (if required): if ($comment) { - watchdog("comment", "moderation: added comment with subject '$subject'"); - db_query("INSERT INTO comments (lid, link, author, subject, comment, hostname, timestamp, score) VALUES($id, 'story', $user->id, '". check_input(substr($comment, 0, 29)) ." ...', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."', '1')"); + watchdog("comment", "moderation: added comment with subject '$subject'"); } // Update user's history record: - user_setHistory($user, "s$id", $vote); // s = submission + user_setHistory($user, "s$id", $vote); // Update story table (if required): $result = db_query("SELECT * FROM stories WHERE id = $id"); if ($submission = db_fetch_object($result)) { - if ($submission->score >= $submission_post_threshold) { + if ($submission->score >= section_post_threshold($submission->section)) { db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id"); - watchdog("message", "posted story `$submission->subject'"); + watchdog("message", "posted story '$submission->subject'"); + } + else if ($submission->score <= section_dump_threshold($submission->section)) { + db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id"); + watchdog("message", "dumped story '$submission->subject'"); } - if ($submission->score <= $submission_dump_threshold) { + else if ($submission->votes >= section_timout_threshold($submission->section)) { db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id"); - watchdog("message", "dumped story `$submission->subject'"); + watchdog("message", "expired story '$submission->subject'"); } } } } -?> +?>
\ No newline at end of file |