--- lbbs/src/article_post.c 2025/10/30 11:15:12 1.36 +++ lbbs/src/article_post.c 2026/01/03 10:27:14 1.45 @@ -1,22 +1,19 @@ -/*************************************************************************** - article_post.c - description - ------------------- - copyright : (C) 2004-2025 by Leaflet - email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * article_post + * - user interactive feature to post / modify / reply article + * + * Copyright (C) 2004-2026 Leaflet + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "article_cache.h" #include "article_post.h" #include "bbs.h" +#include "bwf.h" #include "database.h" #include "editor.h" #include "io.h" @@ -29,11 +26,12 @@ #include #include -#define TITLE_INPUT_MAX_LEN 72 -#define ARTICLE_CONTENT_MAX_LEN 1024 * 1024 * 4 // 4MB -#define ARTICLE_QUOTE_MAX_LINES 20 - -#define MODIFY_DT_MAX_LEN 50 +enum _article_post_constant_t +{ + TITLE_INPUT_MAX_LEN = 72, + ARTICLE_QUOTE_DEFAULT_LINES = 20, + MODIFY_DT_MAX_LEN = 50, +}; int article_post(const SECTION_LIST *p_section, ARTICLE *p_article_new) { @@ -59,7 +57,7 @@ int article_post(const SECTION_LIST *p_s if (p_section == NULL || p_article_new == NULL) { - log_error("NULL pointer error\n"); + log_error("NULL pointer error"); } if (!checkpriv(&BBS_priv, p_section->sid, S_POST)) @@ -79,7 +77,7 @@ int article_post(const SECTION_LIST *p_s p_editor_data = editor_data_load(""); if (p_editor_data == NULL) { - log_error("editor_data_load() error\n"); + log_error("editor_data_load() error"); ret = -1; goto cleanup; } @@ -89,7 +87,7 @@ int article_post(const SECTION_LIST *p_s { clearscr(); moveto(21, 1); - prints("发表文章于 %s[%s] 讨论区,类型: %s,回复通知:%s", + prints("发表文章于 %s[%s] 讨论区,类型: %s,回复通知: %s", p_section->stitle, p_section->sname, (p_article_new->transship ? "转载" : "原创"), (reply_note ? "开启" : "关闭")); @@ -110,7 +108,7 @@ int article_post(const SECTION_LIST *p_s ch = 0; } - for (; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) + while (!SYS_server_exit) { switch (toupper(ch)) { @@ -129,6 +127,15 @@ int article_post(const SECTION_LIST *p_s len = q - p; if (*p != '\0') { + if ((ret = check_badwords(p, '*')) < 0) + { + log_error("check_badwords(title) error"); + } + else if (ret > 0) + { + memcpy(title_input, p, (size_t)len + 1); + continue; + } memcpy(p_article_new->title, p, (size_t)len + 1); memcpy(title_input, p_article_new->title, (size_t)len + 1); } @@ -153,6 +160,7 @@ int article_post(const SECTION_LIST *p_s sign_id = ch - '0'; break; default: // Invalid selection + ch = igetch_t(BBS_max_user_idle_time); continue; } @@ -173,7 +181,7 @@ int article_post(const SECTION_LIST *p_s prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); iflush(); - for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) + for (ch = 0; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) { switch (toupper(ch)) { @@ -215,7 +223,7 @@ int article_post(const SECTION_LIST *p_s content = malloc(ARTICLE_CONTENT_MAX_LEN); if (content == NULL) { - log_error("malloc(content) error: OOM\n"); + log_error("malloc(content) error: OOM"); ret = -1; goto cleanup; } @@ -223,7 +231,14 @@ int article_post(const SECTION_LIST *p_s len_content = editor_data_save(p_editor_data, content, ARTICLE_CONTENT_MAX_LEN); if (len_content < 0) { - log_error("editor_data_save() error\n"); + log_error("editor_data_save() error"); + ret = -1; + goto cleanup; + } + + if (check_badwords(content, '*') < 0) + { + log_error("check_badwords(content) error"); ret = -1; goto cleanup; } @@ -231,7 +246,7 @@ int article_post(const SECTION_LIST *p_s db = db_open(); if (db == NULL) { - log_error("db_open() error: %s\n", mysql_error(db)); + log_error("db_open() error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -244,13 +259,13 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql) != 0) { - log_error("Query sign error: %s\n", mysql_error(db)); + log_error("Query sign error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_use_result(db)) == NULL) { - log_error("Get sign data failed\n"); + log_error("Get sign data failed"); ret = -1; goto cleanup; } @@ -271,14 +286,14 @@ int article_post(const SECTION_LIST *p_s // Begin transaction if (mysql_query(db, "SET autocommit=0") != 0) { - log_error("SET autocommit=0 error: %s\n", mysql_error(db)); + log_error("SET autocommit=0 error: %s", mysql_error(db)); ret = -1; goto cleanup; } if (mysql_query(db, "BEGIN") != 0) { - log_error("Begin transaction error: %s\n", mysql_error(db)); + log_error("Begin transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -287,7 +302,7 @@ int article_post(const SECTION_LIST *p_s content_f = malloc((size_t)len_content * 2 + 1); if (content_f == NULL) { - log_error("malloc(content_f) error: OOM\n"); + log_error("malloc(content_f) error: OOM"); ret = -1; goto cleanup; } @@ -303,7 +318,7 @@ int article_post(const SECTION_LIST *p_s sql_content = malloc(SQL_BUFFER_LEN + (size_t)len_content * 2 + 1); if (sql_content == NULL) { - log_error("malloc(sql_content) error: OOM\n"); + log_error("malloc(sql_content) error: OOM"); ret = -1; goto cleanup; } @@ -317,7 +332,7 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql_content) != 0) { - log_error("Add article content error: %s\n", mysql_error(db)); + log_error("Add article content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -338,7 +353,7 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql) != 0) { - log_error("Add article error: %s\n", mysql_error(db)); + log_error("Add article error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -352,7 +367,7 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql) != 0) { - log_error("Update content error: %s\n", mysql_error(db)); + log_error("Update content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -366,7 +381,7 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql) != 0) { - log_error("Update exp error: %s\n", mysql_error(db)); + log_error("Update exp error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -380,7 +395,7 @@ int article_post(const SECTION_LIST *p_s if (mysql_query(db, sql) != 0) { - log_error("Add log error: %s\n", mysql_error(db)); + log_error("Add log error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -388,7 +403,7 @@ int article_post(const SECTION_LIST *p_s // Commit transaction if (mysql_query(db, "COMMIT") != 0) { - log_error("Commit transaction error: %s\n", mysql_error(db)); + log_error("Commit transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -437,7 +452,7 @@ int article_modify(const SECTION_LIST *p if (p_section == NULL || p_article == NULL) { - log_error("NULL pointer error\n"); + log_error("NULL pointer error"); } if (p_article->excerption) // Modify is not allowed @@ -453,7 +468,7 @@ int article_modify(const SECTION_LIST *p db = db_open(); if (db == NULL) { - log_error("db_open() error: %s\n", mysql_error(db)); + log_error("db_open() error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -466,13 +481,13 @@ int article_modify(const SECTION_LIST *p if (mysql_query(db, sql) != 0) { - log_error("Query article content error: %s\n", mysql_error(db)); + log_error("Query article content error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_use_result(db)) == NULL) { - log_error("Get article content data failed\n"); + log_error("Get article content data failed"); ret = -1; goto cleanup; } @@ -482,7 +497,7 @@ int article_modify(const SECTION_LIST *p content = malloc(ARTICLE_CONTENT_MAX_LEN); if (content == NULL) { - log_error("malloc(content) error: OOM\n"); + log_error("malloc(content) error: OOM"); ret = -1; goto cleanup; } @@ -496,7 +511,7 @@ int article_modify(const SECTION_LIST *p p_editor_data = editor_data_load(content); if (p_editor_data == NULL) { - log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0])); + log_error("editor_data_load(aid=%d, cid=%d) error", p_article->aid, atoi(row[0])); ret = -1; goto cleanup; } @@ -524,7 +539,7 @@ int article_modify(const SECTION_LIST *p (reply_note ? "关闭" : "开启")); iflush(); - ch = igetch_t(MAX_DELAY_TIME); + ch = igetch_t(BBS_max_user_idle_time); switch (toupper(ch)) { case KEY_NULL: @@ -561,7 +576,7 @@ int article_modify(const SECTION_LIST *p content = malloc(ARTICLE_CONTENT_MAX_LEN); if (content == NULL) { - log_error("malloc(content) error: OOM\n"); + log_error("malloc(content) error: OOM"); ret = -1; goto cleanup; } @@ -569,7 +584,14 @@ int article_modify(const SECTION_LIST *p len_content = editor_data_save(p_editor_data, content, ARTICLE_CONTENT_MAX_LEN - LINE_BUFFER_LEN); if (len_content < 0) { - log_error("editor_data_save() error\n"); + log_error("editor_data_save() error"); + ret = -1; + goto cleanup; + } + + if (check_badwords(content, '*') < 0) + { + log_error("check_badwords(content) error"); ret = -1; goto cleanup; } @@ -588,7 +610,7 @@ int article_modify(const SECTION_LIST *p db = db_open(); if (db == NULL) { - log_error("db_open() error: %s\n", mysql_error(db)); + log_error("db_open() error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -596,14 +618,14 @@ int article_modify(const SECTION_LIST *p // Begin transaction if (mysql_query(db, "SET autocommit=0") != 0) { - log_error("SET autocommit=0 error: %s\n", mysql_error(db)); + log_error("SET autocommit=0 error: %s", mysql_error(db)); ret = -1; goto cleanup; } if (mysql_query(db, "BEGIN") != 0) { - log_error("Begin transaction error: %s\n", mysql_error(db)); + log_error("Begin transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -612,7 +634,7 @@ int article_modify(const SECTION_LIST *p content_f = malloc((size_t)len_content * 2 + 1); if (content_f == NULL) { - log_error("malloc(content_f) error: OOM\n"); + log_error("malloc(content_f) error: OOM"); ret = -1; goto cleanup; } @@ -626,7 +648,7 @@ int article_modify(const SECTION_LIST *p sql_content = malloc(SQL_BUFFER_LEN + (size_t)len_content * 2 + 1); if (sql_content == NULL) { - log_error("malloc(sql_content) error: OOM\n"); + log_error("malloc(sql_content) error: OOM"); ret = -1; goto cleanup; } @@ -640,7 +662,7 @@ int article_modify(const SECTION_LIST *p if (mysql_query(db, sql_content) != 0) { - log_error("Add article content error: %s\n", mysql_error(db)); + log_error("Add article content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -657,14 +679,14 @@ int article_modify(const SECTION_LIST *p if (mysql_query(db, sql) != 0) { - log_error("Add article error: %s\n", mysql_error(db)); + log_error("Add article error: %s", mysql_error(db)); ret = -1; goto cleanup; } if (mysql_query(db, sql) != 0) { - log_error("Update content error: %s\n", mysql_error(db)); + log_error("Update content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -677,7 +699,7 @@ int article_modify(const SECTION_LIST *p if (mysql_query(db, sql) != 0) { - log_error("Add log error: %s\n", mysql_error(db)); + log_error("Add log error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -685,7 +707,7 @@ int article_modify(const SECTION_LIST *p // Commit transaction if (mysql_query(db, "COMMIT") != 0) { - log_error("Commit transaction error: %s\n", mysql_error(db)); + log_error("Commit transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -718,7 +740,7 @@ int article_reply(const SECTION_LIST *p_ MYSQL *db = NULL; MYSQL_RES *rs = NULL; MYSQL_ROW row; - long line_offsets[ARTICLE_QUOTE_MAX_LINES + 1]; + long line_offsets[MAX_EDITOR_DATA_LINES + 1]; char sql[SQL_BUFFER_LEN]; char *sql_content = NULL; EDITOR_DATA *p_editor_data = NULL; @@ -731,6 +753,7 @@ int article_reply(const SECTION_LIST *p_ char nickname_f[BBS_nickname_max_len * 2 + 1]; int sign_id = 0; int reply_note = 0; + int full_quote = 0; long len; int ch; char *p, *q; @@ -746,7 +769,7 @@ int article_reply(const SECTION_LIST *p_ if (p_section == NULL || p_article == NULL) { - log_error("NULL pointer error\n"); + log_error("NULL pointer error"); } if (!checkpriv(&BBS_priv, p_section->sid, S_POST)) @@ -767,7 +790,7 @@ int article_reply(const SECTION_LIST *p_ db = db_open(); if (db == NULL) { - log_error("db_open() error: %s\n", mysql_error(db)); + log_error("db_open() error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -778,13 +801,13 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Query article status error: %s\n", mysql_error(db)); + log_error("Query article status error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_store_result(db)) == NULL) { - log_error("Get article status data failed\n"); + log_error("Get article status data failed"); ret = -1; goto cleanup; } @@ -820,13 +843,13 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Query article content error: %s\n", mysql_error(db)); + log_error("Query article content error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_use_result(db)) == NULL) { - log_error("Get article content data failed\n"); + log_error("Get article content data failed"); ret = -1; goto cleanup; } @@ -836,7 +859,7 @@ int article_reply(const SECTION_LIST *p_ content = malloc(ARTICLE_CONTENT_MAX_LEN); if (content == NULL) { - log_error("malloc(content) error: OOM\n"); + log_error("malloc(content) error: OOM"); ret = -1; goto cleanup; } @@ -844,7 +867,7 @@ int article_reply(const SECTION_LIST *p_ content_f = malloc(ARTICLE_CONTENT_MAX_LEN); if (content_f == NULL) { - log_error("malloc(content_f) error: OOM\n"); + log_error("malloc(content_f) error: OOM"); ret = -1; goto cleanup; } @@ -855,44 +878,6 @@ int article_reply(const SECTION_LIST *p_ // Remove control sequence len = str_filter(content_f, 0); - - len = snprintf(content, ARTICLE_CONTENT_MAX_LEN, - "\n\n【 在 %s (%s) 的大作中提到: 】\n", - p_article->username, p_article->nickname); - - quote_content_lines = split_data_lines(content_f, MAX_EDITOR_DATA_LINE_LENGTH - 2, line_offsets, ARTICLE_QUOTE_MAX_LINES + 1, 0, NULL); - for (i = 0; i < quote_content_lines; i++) - { - memcpy(content + len, ": ", 2); // quote line prefix - len += 2; - memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); - len += (line_offsets[i + 1] - line_offsets[i]); - if (content[len - 1] != '\n') // Appennd \n if not exist - { - content[len] = '\n'; - len++; - } - } - if (content[len - 1] != '\n') // Appennd \n if not exist - { - content[len] = '\n'; - len++; - } - content[len] = '\0'; - - free(content_f); - content_f = NULL; - - p_editor_data = editor_data_load(content); - if (p_editor_data == NULL) - { - log_error("editor_data_load(aid=%d, cid=%d) error\n", p_article->aid, atoi(row[0])); - ret = -1; - goto cleanup; - } - - free(content); - content = NULL; } mysql_free_result(rs); rs = NULL; @@ -905,7 +890,10 @@ int article_reply(const SECTION_LIST *p_ { clearscr(); moveto(21, 1); - prints("回复文章于 %s[%s] 讨论区,回复通知:%s", p_section->stitle, p_section->sname, (reply_note ? "开启" : "关闭")); + prints("回复文章于 %s[%s] 讨论区, 回复通知: %s, 引用模式: %s", + p_section->stitle, p_section->sname, + (reply_note ? "开启" : "关闭"), + (full_quote ? "完整" : "精简")); moveto(22, 1); prints("标题: %s", (p_article_new->title[0] == '\0' ? "[无]" : p_article_new->title)); moveto(23, 1); @@ -916,13 +904,13 @@ int article_reply(const SECTION_LIST *p_ prints(" 按0~3选签名档(0表示不使用)"); moveto(24, 1); - prints("T改标题, C取消, N%s, Enter继续: ", - (reply_note ? "关闭回复通知" : "开启回复通知")); + prints("T改标题, C取消, N%s, Q%s, Enter继续: ", + (reply_note ? "关闭回复通知" : "开启回复通知"), (full_quote ? "精简引用" : "完整引用")); iflush(); ch = 0; } - for (; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) + while (!SYS_server_exit) { switch (toupper(ch)) { @@ -941,6 +929,15 @@ int article_reply(const SECTION_LIST *p_ len = q - p; if (*p != '\0') { + if ((ret = check_badwords(p, '*')) < 0) + { + log_error("check_badwords(title) error"); + } + else if (ret > 0) + { + memcpy(title_input, p, (size_t)len + 1); + continue; + } memcpy(p_article_new->title, p, (size_t)len + 1); memcpy(title_input, p_article_new->title, (size_t)len + 1); } @@ -955,6 +952,9 @@ int article_reply(const SECTION_LIST *p_ case 'N': reply_note = (reply_note ? 0 : 1); break; + case 'Q': + full_quote = (full_quote ? 0 : 1); + break; case '0': case '1': case '2': @@ -962,6 +962,7 @@ int article_reply(const SECTION_LIST *p_ sign_id = ch - '0'; break; default: // Invalid selection + ch = igetch_t(BBS_max_user_idle_time); continue; } @@ -973,6 +974,47 @@ int article_reply(const SECTION_LIST *p_ continue; } + len = snprintf(content, ARTICLE_CONTENT_MAX_LEN, + "\n\n【 在 %s (%s) 的大作中提到: 】\n", + p_article->username, p_article->nickname); + + quote_content_lines = split_data_lines(content_f, + MAX_EDITOR_DATA_LINE_LENGTH - 2, line_offsets, + (full_quote ? MAX_EDITOR_DATA_LINES : ARTICLE_QUOTE_DEFAULT_LINES) + 1, + 0, NULL); + for (i = 0; i < quote_content_lines; i++) + { + memcpy(content + len, ": ", 2); // quote line prefix + len += 2; + memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); + len += (line_offsets[i + 1] - line_offsets[i]); + if (content[len - 1] != '\n') // Appennd \n if not exist + { + content[len] = '\n'; + len++; + } + } + if (content[len - 1] != '\n') // Appennd \n if not exist + { + content[len] = '\n'; + len++; + } + content[len] = '\0'; + + free(content_f); + content_f = NULL; + + p_editor_data = editor_data_load(content); + if (p_editor_data == NULL) + { + log_error("editor_data_load(aid=%d, cid=%d) error", p_article->aid, atoi(row[0])); + ret = -1; + goto cleanup; + } + + free(content); + content = NULL; + for (ch = 'E'; !SYS_server_exit && toupper(ch) == 'E';) { editor_display(p_editor_data); @@ -982,7 +1024,7 @@ int article_reply(const SECTION_LIST *p_ prints("(S)发送, (C)取消, (T)更改标题 or (E)再编辑? [S]: "); iflush(); - for (ch = 0; !SYS_server_exit; ch = igetch_t(MAX_DELAY_TIME)) + for (ch = 0; !SYS_server_exit; ch = igetch_t(BBS_max_user_idle_time)) { switch (toupper(ch)) { @@ -1024,7 +1066,7 @@ int article_reply(const SECTION_LIST *p_ content = malloc(ARTICLE_CONTENT_MAX_LEN); if (content == NULL) { - log_error("malloc(content) error: OOM\n"); + log_error("malloc(content) error: OOM"); ret = -1; goto cleanup; } @@ -1032,7 +1074,14 @@ int article_reply(const SECTION_LIST *p_ len_content = editor_data_save(p_editor_data, content, ARTICLE_CONTENT_MAX_LEN); if (len_content < 0) { - log_error("editor_data_save() error\n"); + log_error("editor_data_save() error"); + ret = -1; + goto cleanup; + } + + if (check_badwords(content, '*') < 0) + { + log_error("check_badwords(content) error"); ret = -1; goto cleanup; } @@ -1040,7 +1089,7 @@ int article_reply(const SECTION_LIST *p_ db = db_open(); if (db == NULL) { - log_error("db_open() error: %s\n", mysql_error(db)); + log_error("db_open() error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1053,13 +1102,13 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Query sign error: %s\n", mysql_error(db)); + log_error("Query sign error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_use_result(db)) == NULL) { - log_error("Get sign data failed\n"); + log_error("Get sign data failed"); ret = -1; goto cleanup; } @@ -1080,14 +1129,14 @@ int article_reply(const SECTION_LIST *p_ // Begin transaction if (mysql_query(db, "SET autocommit=0") != 0) { - log_error("SET autocommit=0 error: %s\n", mysql_error(db)); + log_error("SET autocommit=0 error: %s", mysql_error(db)); ret = -1; goto cleanup; } if (mysql_query(db, "BEGIN") != 0) { - log_error("Begin transaction error: %s\n", mysql_error(db)); + log_error("Begin transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1096,7 +1145,7 @@ int article_reply(const SECTION_LIST *p_ content_f = malloc((size_t)len_content * 2 + 1); if (content_f == NULL) { - log_error("malloc(content_f) error: OOM\n"); + log_error("malloc(content_f) error: OOM"); ret = -1; goto cleanup; } @@ -1112,7 +1161,7 @@ int article_reply(const SECTION_LIST *p_ sql_content = malloc(SQL_BUFFER_LEN + (size_t)len_content * 2 + 1); if (sql_content == NULL) { - log_error("malloc(sql_content) error: OOM\n"); + log_error("malloc(sql_content) error: OOM"); ret = -1; goto cleanup; } @@ -1126,7 +1175,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql_content) != 0) { - log_error("Add article content error: %s\n", mysql_error(db)); + log_error("Add article content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1148,7 +1197,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Add article error: %s\n", mysql_error(db)); + log_error("Add article error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1165,7 +1214,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Update topic article error: %s\n", mysql_error(db)); + log_error("Update topic article error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1177,7 +1226,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Update content error: %s\n", mysql_error(db)); + log_error("Update content error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1190,13 +1239,13 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Read reply info error: %s\n", mysql_error(db)); + log_error("Read reply info error: %s", mysql_error(db)); ret = -1; goto cleanup; } if ((rs = mysql_store_result(db)) == NULL) { - log_error("Get reply info failed\n"); + log_error("Get reply info failed"); ret = -1; goto cleanup; } @@ -1218,7 +1267,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Insert msg error: %s\n", mysql_error(db)); + log_error("Insert msg error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1235,7 +1284,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Update exp error: %s\n", mysql_error(db)); + log_error("Update exp error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1249,7 +1298,7 @@ int article_reply(const SECTION_LIST *p_ if (mysql_query(db, sql) != 0) { - log_error("Add log error: %s\n", mysql_error(db)); + log_error("Add log error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -1257,7 +1306,7 @@ int article_reply(const SECTION_LIST *p_ // Commit transaction if (mysql_query(db, "COMMIT") != 0) { - log_error("Commit transaction error: %s\n", mysql_error(db)); + log_error("Commit transaction error: %s", mysql_error(db)); ret = -1; goto cleanup; }