--- lbbs/src/article_post.c 2025/06/15 00:02:40 1.13 +++ lbbs/src/article_post.c 2025/06/15 02:24:45 1.15 @@ -623,7 +623,7 @@ int article_modify(const SECTION_LIST *p // Update article snprintf(sql, sizeof(sql), - "UPDATE bbs SET CID = %d, length = %ld WHERE AID = %d", + "UPDATE bbs SET CID = %d, length = %ld, excerption = 0 WHERE AID = %d", // Set excerption = 0 explictly in case of rare condition p_article_new->cid, len_content, p_article->aid); if (mysql_query(db, sql) != 0) @@ -705,6 +705,7 @@ int article_reply(const SECTION_LIST *p_ long quote_content_lines; long i; long ret = 0; + int topic_locked = 0; if (p_section == NULL || p_article == NULL) { @@ -721,16 +722,6 @@ int article_reply(const SECTION_LIST *p_ return 0; } - if (p_article->lock) // Reply is not allowed - { - clearscr(); - moveto(1, 1); - prints("该文章谢绝回复"); - press_any_key(); - - return 0; - } - p_article_new->title[0] = '\0'; snprintf(title_input, sizeof(title_input), "Re: %s", p_article->title); len = split_line(title_input, TITLE_INPUT_MAX_LEN, &eol, &display_len); @@ -744,6 +735,41 @@ int article_reply(const SECTION_LIST *p_ } snprintf(sql, sizeof(sql), + "SELECT `lock` FROM bbs WHERE AID = %d", + (p_article->tid == 0 ? p_article->aid : p_article->tid)); + + if (mysql_query(db, sql) != 0) + { + log_error("Query article status error: %s\n", mysql_error(db)); + return -2; + } + if ((rs = mysql_store_result(db)) == NULL) + { + log_error("Get article status data failed\n"); + return -2; + } + + if ((row = mysql_fetch_row(rs))) + { + if (atoi(row[0]) != 0) + { + topic_locked = 1; + } + } + mysql_free_result(rs); + rs = NULL; + + if (topic_locked) // Reply is not allowed + { + clearscr(); + moveto(1, 1); + prints("该主题谢绝回复"); + press_any_key(); + + goto cleanup; + } + + snprintf(sql, sizeof(sql), "SELECT bbs_content.CID, bbs_content.content " "FROM bbs INNER JOIN bbs_content ON bbs.CID = bbs_content.CID " "WHERE bbs.AID = %d",