diff --git a/details.php b/details.php
index db42acd..3969ef4 100644
--- a/details.php
+++ b/details.php
@@ -785,8 +785,15 @@
'lastpagedefault' => 1
), "page");
- $subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
$allrows = array();
+ // 取出置顶贴
+ $subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id AND is_top > 0 ORDER BY is_top DESC, id ASC") or sqlerr(__FILE__, __LINE__);
+ while ($subrow = mysql_fetch_array($subres)) {
+ $allrows [] = $subrow;
+ }
+
+ // 取出非置顶
+ $subres = sql_query("SELECT id, text, user, added, editedby, editdate FROM comments WHERE torrent = $id AND is_top = 0 ORDER BY id $limit") or sqlerr(__FILE__, __LINE__);
while ($subrow = mysql_fetch_array($subres)) {
$allrows [] = $subrow;
}
diff --git a/include/functions.php b/include/functions.php
index 5adca89..ec61db4 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -3365,6 +3365,8 @@ function commenttable($rows, $type, $parent_id, $review = false)
begin_main_frame();
begin_frame();
+ $stickyicon = "";
+
$count = 0;
if ($Advertisement->enable_ad())
$commentad = $Advertisement->get_ad('comment');
@@ -3376,7 +3378,7 @@ function commenttable($rows, $type, $parent_id, $review = false)
echo "
";
}
}
- print ("#" . $row ["id"] . " " . $lang_functions ['text_by'] . "");
+ print ("" . ($row['is_top'] > 0 ? $stickyicon . " " : "") . "#" . $row ["id"] . " " . $lang_functions ['text_by'] . "");
print (get_username($row ["user"], false, true, true, false, false, true));
print (" " . $lang_functions ['text_at'] . "" . gettime($row ["added"]) . ($row ["editedby"] && get_user_class() >= $commanage_class ? " - [" . $lang_functions ['text_view_original'] . "]" : "") . " | |
");
$avatar = ($CURUSER ["avatars"] == "yes" ? htmlspecialchars(trim($userRow ["avatar"])) : "");
diff --git a/sql/pt.sql b/sql/pt.sql
index 0722fe9..a156dfa 100755
--- a/sql/pt.sql
+++ b/sql/pt.sql
@@ -4378,6 +4378,13 @@ ALTER TABLE `usercss`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
+
+--
+-- 增加种子评论置顶功能
+--
+ALTER TABLE `comments` ADD COLUMN is_top tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '评论置顶';
+ALTER TABLE `comments` ADD INDEX idx_ttid(`torrent`,`is_top`,`id`);
+
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
diff --git a/sql/update_nova_v1.0.2.sql b/sql/update_nova_v1.0.2.sql
new file mode 100644
index 0000000..fdc8f69
--- /dev/null
+++ b/sql/update_nova_v1.0.2.sql
@@ -0,0 +1,2 @@
+ALTER TABLE comments ADD COLUMN is_top tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '评论置顶';
+ALTER TABLE comments ADD INDEX idx_ttid(`torrent`,`is_top`,`id`);
\ No newline at end of file
|