summaryrefslogtreecommitdiff
path: root/includes/submission.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2000-10-19 13:31:23 +0000
committerDries Buytaert <dries@buytaert.net>2000-10-19 13:31:23 +0000
commit11ee95dadc408e16e9832af9fd0b41495e78b0a6 (patch)
treea8f5ca3387e360b37d0eafc4edfdc5fdc52d3b87 /includes/submission.inc
parent43af5a7389265891770e4a283e4748678754797f (diff)
downloadbrdo-11ee95dadc408e16e9832af9fd0b41495e78b0a6.tar.gz
brdo-11ee95dadc408e16e9832af9fd0b41495e78b0a6.tar.bz2
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
Diffstat (limited to 'includes/submission.inc')
-rw-r--r--includes/submission.inc14
1 files changed, 10 insertions, 4 deletions
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'");
+ }
}
}
}