From 11ee95dadc408e16e9832af9fd0b41495e78b0a6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 19 Oct 2000 13:31:23 +0000 Subject: A big, fat commit with a shitload of internal changes. Not that much visual changes: - removed redundant files user.class.php, calendar.class.php and backend.class.php. - converted *all* mysql queries to queries supported by the database abstraction layer. - expanded the watchdog to record more information on what actually happened. - bugfix: anonymous readers where not able to view comments. - bugfix: anonymous readers could gain read-only access to the submission queue. - bugfix: invalid includes in backend.php - bugfix: invalid use of '$user->block' and last but not least: - redid 50% of the user account system --- includes/submission.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'includes/submission.inc') diff --git a/includes/submission.inc b/includes/submission.inc index 376c84059..23f608f7d 100644 --- a/includes/submission.inc +++ b/includes/submission.inc @@ -2,12 +2,12 @@ function submission_count() { $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); - return ($result) ? mysql_result($result, 0) : 0; + return ($result) ? db_result($result, 0) : 0; } function submission_score($id) { $result = db_query("SELECT score FROM stories WHERE id = $id"); - return ($result) ? mysql_result($result, 0) : 0; + return ($result) ? db_result($result, 0) : 0; } function submission_vote($id, $vote, $comment) { @@ -26,8 +26,14 @@ function submission_vote($id, $vote, $comment) { ### 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) db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id"); - if ($submission->score <= $submission_dump_threshold) db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id"); + if ($submission->score >= $submission_post_threshold) { + db_query("UPDATE stories SET status = 2, timestamp = '". time() ."' WHERE id = $id"); + watchdog(1, "posted story `$submission->subject'"); + } + if ($submission->score <= $submission_dump_threshold) { + db_query("UPDATE stories SET status = 0, timestamp = '". time() ."' WHERE id = $id"); + watchdog(1, "dumped story `$submission->subject'"); + } } } } -- cgit v1.2.3