--- lbbs/src/article_del.c 2025/06/15 13:42:38 1.4 +++ lbbs/src/article_del.c 2026/01/03 10:27:14 1.13 @@ -1,23 +1,19 @@ -/*************************************************************************** - article_del.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_del + * - user interactive feature to delete article + * + * Copyright (C) 2004-2026 Leaflet + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "article_del.h" #include "database.h" -#include "log.h" #include "io.h" +#include "log.h" #include "screen.h" #include "user_priv.h" #include @@ -37,14 +33,14 @@ int article_del(const SECTION_LIST *p_se if (p_section == NULL || p_article == NULL) { - log_error("NULL pointer error\n"); + log_error("NULL pointer error"); } if (p_article->excerption) // Delete is not allowed { clearscr(); moveto(1, 1); - prints("该文章无法被删除,请联系版主。"); + prints("璇ユ枃绔犳棤娉曡鍒犻櫎锛岃鑱旂郴鐗堜富銆"); press_any_key(); return 0; @@ -52,10 +48,10 @@ int article_del(const SECTION_LIST *p_se clearscr(); moveto(1, 1); - prints("真的要删除文章?(Y)是, (N)否 [N]: "); + prints("鐪熺殑瑕佸垹闄ゆ枃绔狅紵(Y)鏄, (N)鍚 [N]: "); 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)) { @@ -63,7 +59,6 @@ int article_del(const SECTION_LIST *p_se case KEY_TIMEOUT: goto cleanup; case CR: - igetch_reset(); case KEY_ESC: case 'N': return 0; @@ -84,7 +79,7 @@ int article_del(const SECTION_LIST *p_se 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; } @@ -92,14 +87,14 @@ int article_del(const SECTION_LIST *p_se // 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; } @@ -110,13 +105,13 @@ int article_del(const SECTION_LIST *p_se 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_use_result(db)) == NULL) { - log_error("Get article status data failed\n"); + log_error("Get article status data failed"); ret = -1; goto cleanup; } @@ -136,7 +131,7 @@ int article_del(const SECTION_LIST *p_se clearscr(); moveto(1, 1); - prints("该文章已被删除,请稍后刷新列表。"); + prints("璇ユ枃绔犲凡琚垹闄わ紝璇风◢鍚庡埛鏂板垪琛ㄣ"); press_any_key(); goto cleanup; @@ -146,7 +141,7 @@ int article_del(const SECTION_LIST *p_se { clearscr(); moveto(1, 1); - prints("该文章无法被删除,请联系版主。"); + prints("璇ユ枃绔犳棤娉曡鍒犻櫎锛岃鑱旂郴鐗堜富銆"); press_any_key(); goto cleanup; @@ -161,7 +156,7 @@ int article_del(const SECTION_LIST *p_se if (mysql_query(db, sql) != 0) { - log_error("Update article status error: %s\n", mysql_error(db)); + log_error("Update article status error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -182,7 +177,7 @@ int article_del(const SECTION_LIST *p_se 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; } @@ -197,7 +192,7 @@ int article_del(const SECTION_LIST *p_se 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; } @@ -211,7 +206,7 @@ int article_del(const SECTION_LIST *p_se if (mysql_query(db, sql) != 0) { - log_error("Update article error: %s\n", mysql_error(db)); + log_error("Update article error: %s", mysql_error(db)); ret = -1; goto cleanup; } @@ -220,7 +215,7 @@ int article_del(const SECTION_LIST *p_se // 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; } @@ -230,7 +225,7 @@ int article_del(const SECTION_LIST *p_se clearscr(); moveto(1, 1); - prints("删除成功,请在%d秒后刷新列表。", BBS_section_list_load_interval); + prints("鍒犻櫎鎴愬姛锛岃鍦%d绉掑悗鍒锋柊鍒楄〃銆", BBS_section_list_load_interval); press_any_key(); ret = 1; // Success