Patch by Moshe:
- comment.module: fixed an ambigous 'timestamp' query - forum.module: prev/next links no longer excerpt from the title+body in their title attribute. they now excerpt from only their title. this is more consistent with rest of drupal, and GROUP BY on node.body which isn't appreciated by MSSQL. also replaced some '' with NULL which caused errors in MSSQL - statistics.module: replaced a USING join with a standard ON join. USING is not as widely supported, and functionally equivalent.4.3.x
parent
3c3c556c55
commit
d64bc008fd
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in New Issue