| 70 |
c++; |
c++; |
| 71 |
} |
} |
| 72 |
|
|
| 73 |
#ifdef _LOAD_SO |
#ifdef _ENABLE_SHARED |
| 74 |
hdll = dlopen(s + 5, RTLD_LAZY); |
hdll = dlopen(s + 5, RTLD_LAZY); |
| 75 |
|
|
| 76 |
if (hdll) |
if (hdll) |
| 125 |
return EXITBBS; |
return EXITBBS; |
| 126 |
} |
} |
| 127 |
|
|
| 128 |
|
int eula(void *param) |
| 129 |
|
{ |
| 130 |
|
display_file(DATA_EULA, 0); |
| 131 |
|
|
| 132 |
|
return REDRAW; |
| 133 |
|
} |
| 134 |
|
|
| 135 |
int license(void *param) |
int license(void *param) |
| 136 |
{ |
{ |
| 137 |
display_file(DATA_LICENSE, 0); |
display_file(DATA_LICENSE, 0); |
| 159 |
|
|
| 160 |
if (kill(getppid(), SIGHUP) < 0) |
if (kill(getppid(), SIGHUP) < 0) |
| 161 |
{ |
{ |
| 162 |
log_error("Send SIGHUP signal failed (%d)\n", errno); |
log_error("Send SIGHUP signal failed (%d)", errno); |
| 163 |
|
|
| 164 |
prints("发送指令失败\r\n"); |
prints("发送指令失败\r\n"); |
| 165 |
} |
} |
| 182 |
|
|
| 183 |
if (toupper(buf[0]) == 'Y') |
if (toupper(buf[0]) == 'Y') |
| 184 |
{ |
{ |
| 185 |
log_common("Notify main process to exit by [%s]\n", BBS_username); |
log_common("Notify main process to exit by [%s]", BBS_username); |
| 186 |
|
|
| 187 |
if (kill(getppid(), SIGTERM) < 0) |
if (kill(getppid(), SIGTERM) < 0) |
| 188 |
{ |
{ |
| 189 |
log_error("Send SIGTERM signal failed (%d)\n", errno); |
log_error("Send SIGTERM signal failed (%d)", errno); |
| 190 |
} |
} |
| 191 |
} |
} |
| 192 |
|
|
| 227 |
p_article = article_block_find_by_aid(aid); |
p_article = article_block_find_by_aid(aid); |
| 228 |
if (p_article == NULL) |
if (p_article == NULL) |
| 229 |
{ |
{ |
| 230 |
log_error("article_block_find_by_aid(%d) error\n", aid); |
log_error("article_block_find_by_aid(%d) error", aid); |
| 231 |
return NOREDRAW; |
return NOREDRAW; |
| 232 |
} |
} |
| 233 |
|
|
| 234 |
if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0) |
if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0) |
| 235 |
{ |
{ |
| 236 |
log_error("article_cache_load(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid); |
log_error("article_cache_load(aid=%d, cid=%d) error", p_article->aid, p_article->cid); |
| 237 |
return NOREDRAW; |
return NOREDRAW; |
| 238 |
} |
} |
| 239 |
|
|
| 240 |
if (user_online_update("VIEW_ARTICLE") < 0) |
if (user_online_update("VIEW_ARTICLE") < 0) |
| 241 |
{ |
{ |
| 242 |
log_error("user_online_update(VIEW_ARTICLE) error\n"); |
log_error("user_online_update(VIEW_ARTICLE) error"); |
| 243 |
} |
} |
| 244 |
|
|
| 245 |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
| 247 |
|
|
| 248 |
if (article_cache_unload(&cache) < 0) |
if (article_cache_unload(&cache) < 0) |
| 249 |
{ |
{ |
| 250 |
log_error("article_cache_unload(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid); |
log_error("article_cache_unload(aid=%d, cid=%d) error", p_article->aid, p_article->cid); |
| 251 |
} |
} |
| 252 |
|
|
| 253 |
// Update article_view_log |
// Update article_view_log |
| 254 |
if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0) |
if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0) |
| 255 |
{ |
{ |
| 256 |
log_error("article_view_log_set_viewed(aid=%d) error\n", p_article->aid); |
log_error("article_view_log_set_viewed(aid=%d) error", p_article->aid); |
| 257 |
} |
} |
| 258 |
|
|
| 259 |
return REDRAW; |
return REDRAW; |
| 266 |
p_section = section_list_find_by_name(param); |
p_section = section_list_find_by_name(param); |
| 267 |
if (p_section == NULL) |
if (p_section == NULL) |
| 268 |
{ |
{ |
| 269 |
log_error("Section %s not found\n", (const char *)param); |
log_error("Section %s not found", (const char *)param); |
| 270 |
return -1; |
return -1; |
| 271 |
} |
} |
| 272 |
|
|
| 273 |
if (section_list_ex_dir_display(p_section) < 0) |
if (section_list_ex_dir_display(p_section) < 0) |
| 274 |
{ |
{ |
| 275 |
log_error("section_list_ex_dir_display(sid=%d) error\n", p_section->sid); |
log_error("section_list_ex_dir_display(sid=%d) error", p_section->sid); |
| 276 |
} |
} |
| 277 |
|
|
| 278 |
return REDRAW; |
return REDRAW; |
| 282 |
{ |
{ |
| 283 |
static int show_top10 = 0; |
static int show_top10 = 0; |
| 284 |
int ch = 0; |
int ch = 0; |
| 285 |
|
int loop; |
| 286 |
|
|
| 287 |
if (show_top10) |
if (show_top10) |
| 288 |
{ |
{ |
| 296 |
|
|
| 297 |
if (display_menu(&top10_menu) == 0) |
if (display_menu(&top10_menu) == 0) |
| 298 |
{ |
{ |
| 299 |
while (!SYS_server_exit) |
for (loop = 1; !SYS_server_exit && loop;) |
| 300 |
{ |
{ |
| 301 |
iflush(); |
iflush(); |
| 302 |
ch = igetch(100); |
ch = igetch(100); |
| 306 |
BBS_last_access_tm = time(NULL); |
BBS_last_access_tm = time(NULL); |
| 307 |
} |
} |
| 308 |
|
|
| 309 |
|
if (user_online_update("TOP10_MENU") < 0) |
| 310 |
|
{ |
| 311 |
|
log_error("user_online_update(TOP10_MENU) error"); |
| 312 |
|
} |
| 313 |
|
|
| 314 |
switch (ch) |
switch (ch) |
| 315 |
{ |
{ |
| 316 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 317 |
log_error("KEY_NULL\n"); |
log_debug("KEY_NULL"); |
| 318 |
show_top10 = 0; |
loop = 0; |
| 319 |
return 0; |
break; |
| 320 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 321 |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 322 |
{ |
{ |
| 323 |
log_error("User input timeout\n"); |
log_debug("User input timeout"); |
| 324 |
show_top10 = 0; |
loop = 0; |
| 325 |
return 0; |
break; |
| 326 |
} |
} |
| 327 |
continue; |
continue; |
| 328 |
case CR: |
case CR: |
| 330 |
switch (menu_control(&top10_menu, ch)) |
switch (menu_control(&top10_menu, ch)) |
| 331 |
{ |
{ |
| 332 |
case EXITMENU: |
case EXITMENU: |
| 333 |
ch = EXITMENU; |
loop = 0; |
| 334 |
break; |
break; |
| 335 |
case REDRAW: |
case REDRAW: |
| 336 |
clearscr(); |
clearscr(); |
| 343 |
break; |
break; |
| 344 |
} |
} |
| 345 |
} |
} |
|
|
|
|
if (ch == EXITMENU) |
|
|
{ |
|
|
break; |
|
|
} |
|
| 346 |
} |
} |
| 347 |
} |
} |
| 348 |
|
|
| 363 |
|
|
| 364 |
if (sname == NULL || aid == NULL) |
if (sname == NULL || aid == NULL) |
| 365 |
{ |
{ |
| 366 |
log_error("top10_locate(%s) error: invalid parameter\n", param); |
log_error("top10_locate(%s) error: invalid parameter", param); |
| 367 |
return NOREDRAW; |
return NOREDRAW; |
| 368 |
} |
} |
| 369 |
|
|
| 376 |
{ |
{ |
| 377 |
if (article_favor_display(&BBS_article_favor) < 0) |
if (article_favor_display(&BBS_article_favor) < 0) |
| 378 |
{ |
{ |
| 379 |
log_error("article_favor_display() error\n"); |
log_error("article_favor_display() error"); |
| 380 |
} |
} |
| 381 |
|
|
| 382 |
return REDRAW; |
return REDRAW; |
| 386 |
{ |
{ |
| 387 |
if (user_list_display(0) < 0) |
if (user_list_display(0) < 0) |
| 388 |
{ |
{ |
| 389 |
log_error("user_list_display(all_user) error\n"); |
log_error("user_list_display(all_user) error"); |
| 390 |
} |
} |
| 391 |
|
|
| 392 |
return REDRAW; |
return REDRAW; |
| 396 |
{ |
{ |
| 397 |
if (user_list_display(1) < 0) |
if (user_list_display(1) < 0) |
| 398 |
{ |
{ |
| 399 |
log_error("user_list_display(online_user) error\n"); |
log_error("user_list_display(online_user) error"); |
| 400 |
} |
} |
| 401 |
|
|
| 402 |
return REDRAW; |
return REDRAW; |
| 406 |
{ |
{ |
| 407 |
if (user_intro_edit(BBS_priv.uid) < 0) |
if (user_intro_edit(BBS_priv.uid) < 0) |
| 408 |
{ |
{ |
| 409 |
log_error("user_intro_edit(%d) error\n", BBS_priv.uid); |
log_error("user_intro_edit(%d) error", BBS_priv.uid); |
| 410 |
} |
} |
| 411 |
|
|
| 412 |
return REDRAW; |
return REDRAW; |
| 416 |
{ |
{ |
| 417 |
if (user_sign_edit(BBS_priv.uid) < 0) |
if (user_sign_edit(BBS_priv.uid) < 0) |
| 418 |
{ |
{ |
| 419 |
log_error("user_sign_edit(%d) error\n", BBS_priv.uid); |
log_error("user_sign_edit(%d) error", BBS_priv.uid); |
| 420 |
} |
} |
| 421 |
|
|
| 422 |
return REDRAW; |
return REDRAW; |