| 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 |
|
|
| 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); |
| 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), |
snprintf(sql, sizeof(sql), |
| 740 |
if (mysql_query(db, sql) != 0) |
if (mysql_query(db, sql) != 0) |
| 741 |
{ |
{ |
| 742 |
log_error("Query article status error: %s\n", mysql_error(db)); |
log_error("Query article status error: %s\n", mysql_error(db)); |
| 743 |
return -2; |
ret = -1; |
| 744 |
|
goto cleanup; |
| 745 |
} |
} |
| 746 |
if ((rs = mysql_store_result(db)) == NULL) |
if ((rs = mysql_store_result(db)) == NULL) |
| 747 |
{ |
{ |
| 748 |
log_error("Get article status data failed\n"); |
log_error("Get article status data failed\n"); |
| 749 |
return -2; |
ret = -1; |
| 750 |
|
goto cleanup; |
| 751 |
} |
} |
| 752 |
|
|
| 753 |
if ((row = mysql_fetch_row(rs))) |
if ((row = mysql_fetch_row(rs))) |
| 762 |
|
|
| 763 |
if (topic_locked) // Reply is not allowed |
if (topic_locked) // Reply is not allowed |
| 764 |
{ |
{ |
| 765 |
|
mysql_close(db); |
| 766 |
|
db = NULL; |
| 767 |
|
|
| 768 |
clearscr(); |
clearscr(); |
| 769 |
moveto(1, 1); |
moveto(1, 1); |
| 770 |
prints("该主题谢绝回复"); |
prints("该主题谢绝回复"); |
| 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))) |
| 828 |
len += 2; |
len += 2; |
| 829 |
memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); |
memcpy(content + len, content_f + line_offsets[i], (size_t)(line_offsets[i + 1] - line_offsets[i])); |
| 830 |
len += (line_offsets[i + 1] - line_offsets[i]); |
len += (line_offsets[i + 1] - line_offsets[i]); |
| 831 |
|
if (content[len - 1] != '\n') // Appennd \n if not exist |
| 832 |
|
{ |
| 833 |
|
content[len] = '\n'; |
| 834 |
|
len++; |
| 835 |
|
} |
| 836 |
} |
} |
| 837 |
if (content[len - 1] != '\n') // Appennd \n if not exist |
if (content[len - 1] != '\n') // Appennd \n if not exist |
| 838 |
{ |
{ |
| 848 |
if (p_editor_data == NULL) |
if (p_editor_data == NULL) |
| 849 |
{ |
{ |
| 850 |
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])); |
| 851 |
ret = -3; |
ret = -1; |
| 852 |
goto cleanup; |
goto cleanup; |
| 853 |
} |
} |
| 854 |
|
|
| 983 |
if (len_content < 0) |
if (len_content < 0) |
| 984 |
{ |
{ |
| 985 |
log_error("editor_data_save() error\n"); |
log_error("editor_data_save() error\n"); |
| 986 |
ret = -2; |
ret = -1; |
| 987 |
goto cleanup; |
goto cleanup; |
| 988 |
} |
} |
| 989 |
|
|
| 1164 |
goto cleanup; |
goto cleanup; |
| 1165 |
} |
} |
| 1166 |
|
|
| 1167 |
|
mysql_close(db); |
| 1168 |
|
db = NULL; |
| 1169 |
|
|
| 1170 |
clearscr(); |
clearscr(); |
| 1171 |
moveto(1, 1); |
moveto(1, 1); |
| 1172 |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |
prints("发送完成,新文章通常会在%d秒后可见", BBS_section_list_load_interval); |