diff options
author | Dries Buytaert <dries@buytaert.net> | 2006-03-08 15:13:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2006-03-08 15:13:20 +0000 |
commit | 7add598ee2105dbe022cf859f851ada4790d1c4e (patch) | |
tree | 5a824d7c17793cacf51ebf4fde1430fcccc0654d /modules/forum | |
parent | 46ad261902db33f3f2407e1157f5ccc27f87b7e2 (diff) | |
download | brdo-7add598ee2105dbe022cf859f851ada4790d1c4e.tar.gz brdo-7add598ee2105dbe022cf859f851ada4790d1c4e.tar.bz2 |
- Patch #51850 by chx, webchick et al: fixed various problems with db_rewrite_sql, made db_rewrite_sql slightly more robust.
Diffstat (limited to 'modules/forum')
-rw-r--r-- | modules/forum/forum.module | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 9168f0819..4ccfa53f7 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -686,7 +686,7 @@ function forum_get_forums($tid = 0) { // This query does not use full ANSI syntax since MySQL 3.x does not support // table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria // used to join node_comment_statistics to users. - $sql = "SELECT n.nid, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) as last_comment_name, l.last_comment_uid FROM {node} n, {node_comment_statistics} l, {users} cu, {term_node} r WHERE n.nid = r.nid AND r.tid = %d AND n.status = 1 AND n.type = 'forum' AND l.last_comment_uid = cu.uid AND n.nid = l.nid ORDER BY l.last_comment_timestamp DESC"; + $sql = "SELECT n.nid, f.tid, n.title, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {forum} f ON n.vid = f.vid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid WHERE n.status = 1 AND r.tid = %d"; $sql = db_rewrite_sql($sql); $topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1)); |