diff options
-rw-r--r-- | database/database.mssql | 8 | ||||
-rw-r--r-- | modules/comment.module | 2 | ||||
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/forum.module | 13 | ||||
-rw-r--r-- | modules/forum/forum.module | 13 | ||||
-rw-r--r-- | modules/statistics.module | 2 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 2 |
7 files changed, 23 insertions, 19 deletions
diff --git a/database/database.mssql b/database/database.mssql index 663697e2c..f323cd207 100644 --- a/database/database.mssql +++ b/database/database.mssql @@ -113,7 +113,7 @@ GO CREATE TABLE [dbo].[forum] ( [nid] [numeric](10, 0) NOT NULL , [tid] [numeric](10, 0) NOT NULL , - [icon] [varchar] (255) NOT NULL , + [icon] [varchar] (255) NULL , [shadow] [numeric](10, 0) NOT NULL ) ON [PRIMARY] GO @@ -369,6 +369,12 @@ CREATE TABLE [dbo].[users] ( --ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO +CREATE TABLE [dbo].[users_uid_seq] ( + [id] [int] IDENTITY (1, 1) NOT NULL , + [vapor] [int] NULL +) ON [PRIMARY] +GO + CREATE TABLE [dbo].[variable] ( [name] [varchar] (32) NOT NULL , [value] [varchar] (8000) NOT NULL diff --git a/modules/comment.module b/modules/comment.module index 10ba96760..1f048fc40 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -996,7 +996,7 @@ function comment_admin_overview($status = 0) { array("data" => t("subject"), "field" => "subject"), array("data" => t("author"), "field" => "u.name"), array("data" => t("status"), "field" => "status"), - array("data" => t("time"), "field" => "timestamp", "sort" => "desc"), + array("data" => t("time"), "field" => "c.timestamp", "sort" => "desc"), array("data" => t("operations"), "colspan" => 2) ); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 10ba96760..1f048fc40 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -996,7 +996,7 @@ function comment_admin_overview($status = 0) { array("data" => t("subject"), "field" => "subject"), array("data" => t("author"), "field" => "u.name"), array("data" => t("status"), "field" => "status"), - array("data" => t("time"), "field" => "timestamp", "sort" => "desc"), + array("data" => t("time"), "field" => "c.timestamp", "sort" => "desc"), array("data" => t("operations"), "colspan" => 2) ); diff --git a/modules/forum.module b/modules/forum.module index 79a5d27d3..e23452d70 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -105,13 +105,12 @@ function forum_link($type, $node = 0, $main = 0) { if (!$main && $type == "node" && $node->type == "forum") { // get previous and next topic - $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); + $result = db_query("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); while ($topic = db_fetch_object($result)) { if ($stop == 1) { $next->nid = $topic->nid; $next->title = $topic->title; - $next->body = $topic->body; break; } if ($topic->nid == $node->nid) { @@ -120,16 +119,15 @@ function forum_link($type, $node = 0, $main = 0) { else { $prev->nid = $topic->nid; $prev->title = $topic->title; - $prev->body = $topic->body; } } if ($prev) { - $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100) ."...")); + $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title)); } if ($next) { - $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100) ."...")); + $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title)); } } @@ -339,12 +337,13 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $term = taxonomy_get_term($tid); $voc = taxonomy_get_vocabulary($term->vid); + $check_tid = $tid ? "'". check_query($tid). "'" : "NULL"; // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '". check_query($tid) ."' AND f.shadow = 1) OR f.tid = '". check_query($tid) ."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = $check_tid AND f.shadow = 1) OR f.tid = $check_tid) AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; $sql .= tablesort_sql($forum_topic_list_header); - $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; + $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = $check_tid AND f.shadow = 1) OR f.tid = $check_tid) AND n.status = 1 AND n.type = 'forum'"; $result = pager_query($sql, $forum_per_page, 0, $sql_count); $topic_num = db_num_rows($result); diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 79a5d27d3..e23452d70 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -105,13 +105,12 @@ function forum_link($type, $node = 0, $main = 0) { if (!$main && $type == "node" && $node->type == "forum") { // get previous and next topic - $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.body, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); + $result = db_query("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = f.nid AND f.tid = %d AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order", 1)), $node->tid); while ($topic = db_fetch_object($result)) { if ($stop == 1) { $next->nid = $topic->nid; $next->title = $topic->title; - $next->body = $topic->body; break; } if ($topic->nid == $node->nid) { @@ -120,16 +119,15 @@ function forum_link($type, $node = 0, $main = 0) { else { $prev->nid = $topic->nid; $prev->title = $topic->title; - $prev->body = $topic->body; } } if ($prev) { - $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title .": ". substr(strip_tags($prev->body), 0, 100) ."...")); + $links[] = l(t("previous forum topic"), "node/view/$prev->nid", array("title" => $prev->title)); } if ($next) { - $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title .": ". substr(strip_tags($next->body), 0, 100) ."...")); + $links[] = l(t("next forum topic"), "node/view/$next->nid", array("title" => $next->title)); } } @@ -339,12 +337,13 @@ function forum_get_topics($tid, $sortby, $forum_per_page) { $term = taxonomy_get_term($tid); $voc = taxonomy_get_vocabulary($term->vid); + $check_tid = $tid ? "'". check_query($tid). "'" : "NULL"; // show topics with the correct tid, or in the forum but with shadow = 1 - $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = '". check_query($tid) ."' AND f.shadow = 1) OR f.tid = '". check_query($tid) ."') AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; + $sql = "SELECT n.nid, n.title, u.name AS name, u.uid AS uid, n.created AS timestamp, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments, n.comment AS comment_mode, f.tid FROM {node} n INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid INNER JOIN {forum} f ON n.nid = f.nid WHERE n.nid = r.nid AND ((r.tid = $check_tid AND f.shadow = 1) OR f.tid = $check_tid) AND n.status = 1 AND n.type = 'forum' GROUP BY n.nid, n.title, u.name, u.uid, n.created, n.comment, f.tid"; $sql .= tablesort_sql($forum_topic_list_header); - $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = '".check_query($tid)."' AND f.shadow = 1) OR f.tid = '".check_query($tid)."') AND n.status = 1 AND n.type = 'forum'"; + $sql_count = "SELECT COUNT(DISTINCT(n.nid)) FROM {node} n INNER JOIN {forum} f ON n.nid = f.nid INNER JOIN {term_node} r ON n.nid = r.nid WHERE n.nid = r.nid AND ( (r.tid = $check_tid AND f.shadow = 1) OR f.tid = $check_tid) AND n.status = 1 AND n.type = 'forum'"; $result = pager_query($sql, $forum_per_page, 0, $sql_count); $topic_num = db_num_rows($result); diff --git a/modules/statistics.module b/modules/statistics.module index 0cd4df2a7..06cb508ae 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -326,7 +326,7 @@ function statistics_admin_topnodes_table() { array("data" => t("last hit"), "field" => "s.timestamp"), array("data" => t("operations")) ); - $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s INNER JOIN {node} n USING (nid)"; + $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s INNER JOIN {node} n ON s.nid = n.nid"; $sql .= tablesort_sql($header); $result = pager_query($sql, 20); // WHERE s.%s <> '0' diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 0cd4df2a7..06cb508ae 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -326,7 +326,7 @@ function statistics_admin_topnodes_table() { array("data" => t("last hit"), "field" => "s.timestamp"), array("data" => t("operations")) ); - $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s INNER JOIN {node} n USING (nid)"; + $sql = "SELECT s.nid, s.daycount, s.totalcount, s.timestamp, n.title FROM {statistics} s INNER JOIN {node} n ON s.nid = n.nid"; $sql .= tablesort_sql($header); $result = pager_query($sql, 20); // WHERE s.%s <> '0' |