| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 16 |
|
|
| 17 |
|
#define _POSIX_C_SOURCE 200809L |
| 18 |
|
|
| 19 |
#include "section_list_loader.h" |
#include "section_list_loader.h" |
| 20 |
#include "article_cache.h" |
#include "article_cache.h" |
| 21 |
#include "bbs.h" |
#include "bbs.h" |
| 27 |
#include <errno.h> |
#include <errno.h> |
| 28 |
#include <signal.h> |
#include <signal.h> |
| 29 |
#include <stdlib.h> |
#include <stdlib.h> |
| 30 |
|
#include <string.h> |
| 31 |
#include <strings.h> |
#include <strings.h> |
| 32 |
#include <unistd.h> |
#include <unistd.h> |
| 33 |
|
|
|
#define _POSIX_C_SOURCE 200809L |
|
|
#include <string.h> |
|
|
|
|
| 34 |
int section_list_loader_pid; |
int section_list_loader_pid; |
| 35 |
int last_article_op_log_mid; |
int last_article_op_log_mid; |
| 36 |
|
|
| 211 |
|
|
| 212 |
while ((row = mysql_fetch_row(rs))) |
while ((row = mysql_fetch_row(rs))) |
| 213 |
{ |
{ |
| 214 |
bzero(&article, sizeof(ARTICLE)); |
memset(&article, 0, sizeof(ARTICLE)); |
| 215 |
|
|
| 216 |
// copy data of article |
// copy data of article |
| 217 |
i = 0; |
i = 0; |
| 450 |
break; |
break; |
| 451 |
case 'D': // Delete article |
case 'D': // Delete article |
| 452 |
case 'X': // Delete article by Admin |
case 'X': // Delete article by Admin |
| 453 |
p_article->visible = 0; |
if (section_list_set_article_visible(p_section, atoi(row[1]), 0) < 0) |
|
if (p_article->tid == 0) |
|
| 454 |
{ |
{ |
| 455 |
// Set articles in the topic to be invisible |
log_error("section_list_set_article_visible(sid=%d, aid=%d, visible=0) error\n", p_section->sid, atoi(row[1])); |
| 456 |
do |
} |
| 457 |
{ |
if (section_list_calculate_page(p_section, atoi(row[1])) < 0) |
| 458 |
p_article = p_article->p_topic_next; |
{ |
| 459 |
p_article->visible = 0; |
log_error("section_list_calculate_page(aid=%d) error\n", atoi(row[1])); |
|
} while (p_article->tid != 0); |
|
| 460 |
} |
} |
| 461 |
break; |
break; |
| 462 |
case 'S': // Restore article |
case 'S': // Restore article |
| 463 |
p_article->visible = 1; |
if (section_list_set_article_visible(p_section, atoi(row[1]), 1) < 0) |
| 464 |
|
{ |
| 465 |
|
log_error("section_list_set_article_visible(sid=%d, aid=%d, visible=1) error\n", p_section->sid, atoi(row[1])); |
| 466 |
|
} |
| 467 |
|
if (section_list_calculate_page(p_section, atoi(row[1])) < 0) |
| 468 |
|
{ |
| 469 |
|
log_error("section_list_calculate_page(aid=%d) error\n", atoi(row[1])); |
| 470 |
|
} |
| 471 |
break; |
break; |
| 472 |
case 'L': // Lock article |
case 'L': // Lock article |
| 473 |
p_article->lock = 1; |
p_article->lock = 1; |
| 514 |
ret = -4; |
ret = -4; |
| 515 |
} |
} |
| 516 |
mysql_free_result(rs2); |
mysql_free_result(rs2); |
| 517 |
|
|
| 518 |
|
p_article->excerption = 0; // Set excerption = 0 implicitly in case of rare condition |
| 519 |
break; |
break; |
| 520 |
case 'T': // Move article |
case 'T': // Move article |
| 521 |
snprintf(sql, sizeof(sql), |
snprintf(sql, sizeof(sql), |