| 81 |
if (p_editor_data == NULL) |
if (p_editor_data == NULL) |
| 82 |
{ |
{ |
| 83 |
log_error("editor_data_load() error\n"); |
log_error("editor_data_load() error\n"); |
| 84 |
return -2; |
ret = -1; |
| 85 |
|
goto cleanup; |
| 86 |
} |
} |
| 87 |
|
|
| 88 |
// Set title and sign |
// Set title and sign |
| 213 |
if (len_content < 0) |
if (len_content < 0) |
| 214 |
{ |
{ |
| 215 |
log_error("editor_data_save() error\n"); |
log_error("editor_data_save() error\n"); |
| 216 |
ret = -2; |
ret = -1; |
| 217 |
goto cleanup; |
goto cleanup; |
| 218 |
} |
} |
| 219 |
|
|
| 378 |
goto cleanup; |
goto cleanup; |
| 379 |
} |
} |
| 380 |
|
|
| 381 |
|
mysql_close(db); |
| 382 |
|
db = NULL; |
| 383 |
|
|
| 384 |
clearscr(); |
clearscr(); |
| 385 |
moveto(1, 1); |
moveto(1, 1); |
| 386 |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |
| 433 |
return 0; |
return 0; |
| 434 |
} |
} |
| 435 |
|
|
|
if (!checkpriv(&BBS_priv, p_section->sid, S_POST)) |
|
|
{ |
|
|
clearscr(); |
|
|
moveto(1, 1); |
|
|
prints("您没有权限在本版块发表文章\n"); |
|
|
press_any_key(); |
|
|
|
|
|
return 0; |
|
|
} |
|
|
|
|
| 436 |
db = db_open(); |
db = db_open(); |
| 437 |
if (db == NULL) |
if (db == NULL) |
| 438 |
{ |
{ |
| 439 |
log_error("db_open() error: %s\n", mysql_error(db)); |
log_error("db_open() error: %s\n", mysql_error(db)); |
| 440 |
return -1; |
ret = -1; |
| 441 |
|
goto cleanup; |
| 442 |
} |
} |
| 443 |
|
|
| 444 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 450 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 451 |
{ |
{ |
| 452 |
log_error("Query article content error: %s\n", mysql_error(db)); |
log_error("Query article content error: %s\n", mysql_error(db)); |
| 453 |
ret = -2; |
ret = -1; |
| 454 |
goto cleanup; |
goto cleanup; |
| 455 |
} |
} |
| 456 |
if ((rs = mysql_use_result(db)) == NULL) |
if ((rs = mysql_use_result(db)) == NULL) |
| 457 |
{ |
{ |
| 458 |
log_error("Get article content data failed\n"); |
log_error("Get article content data failed\n"); |
| 459 |
ret = -2; |
ret = -1; |
| 460 |
goto cleanup; |
goto cleanup; |
| 461 |
} |
} |
| 462 |
|
|
| 480 |
if (p_editor_data == NULL) |
if (p_editor_data == NULL) |
| 481 |
{ |
{ |
| 482 |
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\n", p_article->aid, atoi(row[0])); |
| 483 |
ret = -3; |
ret = -1; |
| 484 |
goto cleanup; |
goto cleanup; |
| 485 |
} |
} |
| 486 |
|
|
| 539 |
if (len_content < 0) |
if (len_content < 0) |
| 540 |
{ |
{ |
| 541 |
log_error("editor_data_save() error\n"); |
log_error("editor_data_save() error\n"); |
| 542 |
ret = -2; |
ret = -1; |
| 543 |
goto cleanup; |
goto cleanup; |
| 544 |
} |
} |
| 545 |
|
|
| 618 |
|
|
| 619 |
// Update article |
// Update article |
| 620 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 621 |
"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 |
| 622 |
p_article_new->cid, len_content, p_article->aid); |
p_article_new->cid, len_content, p_article->aid); |
| 623 |
|
|
| 624 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 656 |
goto cleanup; |
goto cleanup; |
| 657 |
} |
} |
| 658 |
|
|
| 659 |
|
mysql_close(db); |
| 660 |
|
db = NULL; |
| 661 |
|
|
| 662 |
clearscr(); |
clearscr(); |
| 663 |
moveto(1, 1); |
moveto(1, 1); |
| 664 |
prints("修改完成,新内容通常会在%d秒后可见", BBS_section_list_load_interval); |
prints("修改完成,新内容通常会在%d秒后可见", BBS_section_list_load_interval); |
| 703 |
long quote_content_lines; |
long quote_content_lines; |
| 704 |
long i; |
long i; |
| 705 |
long ret = 0; |
long ret = 0; |
| 706 |
|
int topic_locked = 0; |
| 707 |
|
|
| 708 |
if (p_section == NULL || p_article == NULL) |
if (p_section == NULL || p_article == NULL) |
| 709 |
{ |
{ |
| 720 |
return 0; |
return 0; |
| 721 |
} |
} |
| 722 |
|
|
|
if (p_article->lock) // Reply is not allowed |
|
|
{ |
|
|
clearscr(); |
|
|
moveto(1, 1); |
|
|
prints("该文章谢绝回复"); |
|
|
press_any_key(); |
|
|
|
|
|
return 0; |
|
|
} |
|
|
|
|
| 723 |
p_article_new->title[0] = '\0'; |
p_article_new->title[0] = '\0'; |
| 724 |
snprintf(title_input, sizeof(title_input), "Re: %s", p_article->title); |
snprintf(title_input, sizeof(title_input), "Re: %s", p_article->title); |
| 725 |
len = split_line(title_input, TITLE_INPUT_MAX_LEN, &eol, &display_len); |
len = split_line(title_input, TITLE_INPUT_MAX_LEN, &eol, &display_len); |
| 729 |
if (db == NULL) |
if (db == NULL) |
| 730 |
{ |
{ |
| 731 |
log_error("db_open() error: %s\n", mysql_error(db)); |
log_error("db_open() error: %s\n", mysql_error(db)); |
| 732 |
return -1; |
ret = -1; |
| 733 |
|
goto cleanup; |
| 734 |
|
} |
| 735 |
|
|
| 736 |
|
snprintf(sql, sizeof(sql), |
| 737 |
|
"SELECT `lock` FROM bbs WHERE AID = %d", |
| 738 |
|
(p_article->tid == 0 ? p_article->aid : p_article->tid)); |
| 739 |
|
|
| 740 |
|
if (mysql_query(db, sql) != 0) |
| 741 |
|
{ |
| 742 |
|
log_error("Query article status error: %s\n", mysql_error(db)); |
| 743 |
|
ret = -1; |
| 744 |
|
goto cleanup; |
| 745 |
|
} |
| 746 |
|
if ((rs = mysql_store_result(db)) == NULL) |
| 747 |
|
{ |
| 748 |
|
log_error("Get article status data failed\n"); |
| 749 |
|
ret = -1; |
| 750 |
|
goto cleanup; |
| 751 |
|
} |
| 752 |
|
|
| 753 |
|
if ((row = mysql_fetch_row(rs))) |
| 754 |
|
{ |
| 755 |
|
if (atoi(row[0]) != 0) |
| 756 |
|
{ |
| 757 |
|
topic_locked = 1; |
| 758 |
|
} |
| 759 |
|
} |
| 760 |
|
mysql_free_result(rs); |
| 761 |
|
rs = NULL; |
| 762 |
|
|
| 763 |
|
if (topic_locked) // Reply is not allowed |
| 764 |
|
{ |
| 765 |
|
mysql_close(db); |
| 766 |
|
db = NULL; |
| 767 |
|
|
| 768 |
|
clearscr(); |
| 769 |
|
moveto(1, 1); |
| 770 |
|
prints("该主题谢绝回复"); |
| 771 |
|
press_any_key(); |
| 772 |
|
|
| 773 |
|
goto cleanup; |
| 774 |
} |
} |
| 775 |
|
|
| 776 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |
| 782 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 783 |
{ |
{ |
| 784 |
log_error("Query article content error: %s\n", mysql_error(db)); |
log_error("Query article content error: %s\n", mysql_error(db)); |
| 785 |
return -2; |
ret = -1; |
| 786 |
|
goto cleanup; |
| 787 |
} |
} |
| 788 |
if ((rs = mysql_use_result(db)) == NULL) |
if ((rs = mysql_use_result(db)) == NULL) |
| 789 |
{ |
{ |
| 790 |
log_error("Get article content data failed\n"); |
log_error("Get article content data failed\n"); |
| 791 |
return -2; |
ret = -1; |
| 792 |
|
goto cleanup; |
| 793 |
} |
} |
| 794 |
|
|
| 795 |
if ((row = mysql_fetch_row(rs))) |
if ((row = mysql_fetch_row(rs))) |
| 843 |
if (p_editor_data == NULL) |
if (p_editor_data == NULL) |
| 844 |
{ |
{ |
| 845 |
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\n", p_article->aid, atoi(row[0])); |
| 846 |
ret = -3; |
ret = -1; |
| 847 |
goto cleanup; |
goto cleanup; |
| 848 |
} |
} |
| 849 |
|
|
| 978 |
if (len_content < 0) |
if (len_content < 0) |
| 979 |
{ |
{ |
| 980 |
log_error("editor_data_save() error\n"); |
log_error("editor_data_save() error\n"); |
| 981 |
ret = -2; |
ret = -1; |
| 982 |
goto cleanup; |
goto cleanup; |
| 983 |
} |
} |
| 984 |
|
|
| 1159 |
goto cleanup; |
goto cleanup; |
| 1160 |
} |
} |
| 1161 |
|
|
| 1162 |
|
mysql_close(db); |
| 1163 |
|
db = NULL; |
| 1164 |
|
|
| 1165 |
clearscr(); |
clearscr(); |
| 1166 |
moveto(1, 1); |
moveto(1, 1); |
| 1167 |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |