diff options
author | Dries Buytaert <dries@buytaert.net> | 2000-11-14 09:03:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2000-11-14 09:03:44 +0000 |
commit | a461e3696cb0021a9586ceaf735b0bb8cf4c9ab0 (patch) | |
tree | d05b6509b70eaa5912b6f5ffb07376735ac7dff3 | |
parent | c3e6f0014152d75d56f695f1f1cdfaee0caa2de1 (diff) | |
download | brdo-a461e3696cb0021a9586ceaf735b0bb8cf4c9ab0.tar.gz brdo-a461e3696cb0021a9586ceaf735b0bb8cf4c9ab0.tar.bz2 |
* tiny improvements (!= bug fixes)
-rw-r--r-- | discussion.php | 2 | ||||
-rw-r--r-- | error.php | 5 | ||||
-rw-r--r-- | includes/submission.inc | 6 | ||||
-rw-r--r-- | index.php | 9 | ||||
-rw-r--r-- | scripts/sql-backup | 6 |
5 files changed, 9 insertions, 19 deletions
diff --git a/discussion.php b/discussion.php index 6501874e0..21b989666 100644 --- a/discussion.php +++ b/discussion.php @@ -267,7 +267,7 @@ function comment_post($pid, $sid, $subject, $comment) { $subject = ($subject) ? $subject : substr($comment, 0, 29); ### Add watchdog entry: - watchdog("comment", "added new comment with subject '$subject'"); + watchdog("comment", "discussion: added comment with subject '$subject'"); ### Add comment to database: db_query("INSERT INTO comments (pid, sid, author, subject, comment, hostname, timestamp) VALUES ($pid, $sid, '$user->id', '". check_input($subject) ."', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); @@ -1,11 +1,6 @@ <H1>Oops, an error occured!</H1> <PRE> -<B>Temporary debug output:</B><BR> - * STATUS...: <? echo $REDIRECT_STATUS; ?><BR> - * URL......: <? echo $REDIRECT_URL; ?><BR> - * METHOD...: <? echo $REQUEST_METHOD; ?><BR> - <? switch($REDIRECT_STATUS) { case 500: diff --git a/includes/submission.inc b/includes/submission.inc index 297bb0294..1c7035069 100644 --- a/includes/submission.inc +++ b/includes/submission.inc @@ -18,7 +18,11 @@ function submission_vote($id, $vote, $comment) { db_query("UPDATE stories SET score = score $vote, votes = votes + 1 WHERE id = $id"); ### Update the comments (if required): - if ($comment) db_query("INSERT INTO comments (sid, author, subject, comment, hostname, timestamp) VALUES($id, $user->id, '". addslashes(substr($comment, 0, 29)) ." ...', '". addslashes($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); + if ($comment) { + watchdog("comment", "moderation: added comment with subject '$subject'"); + + db_query("INSERT INTO comments (sid, author, subject, comment, hostname, timestamp) VALUES($id, $user->id, '". check_input(substr($comment, 0, 29)) ." ...', '". check_input($comment) ."', '". getenv("REMOTE_ADDR") ."', '". time() ."')"); + } ### Update user's history record: user_setHistory($user, "s$id", $vote); // s = submission @@ -14,15 +14,6 @@ $date = ($date) ? $date : time(); ### Perform query: $result = db_query("SELECT stories.*, users.userid, COUNT(comments.sid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.sid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number"); - // Note on performance: - // we use a LEFT JOIN to retrieve the number of comments associated - // with each story. By retrieving this data now (outside the while- - // loop), we elimate a *lot* of individual queries that would other- - // wise be required (inside the while-loop). If there is no matching - // record for the right table in the ON-part of the LEFT JOIN, a row - // with all columns set to NULL is used for the right table. This is - // required, as not every story has a counterpart in the comments - // table (at a given time). ### Display stories: $theme->header(); diff --git a/scripts/sql-backup b/scripts/sql-backup index edca9b006..d4ab998a9 100644 --- a/scripts/sql-backup +++ b/scripts/sql-backup @@ -1,7 +1,7 @@ #!/bin/sh -username="dries" -database="dries" -hostname="dione" +username="username" +database="database" +hostname="hostname" mysqldump -h $hostname -u $username -p $database > mysql-backup |