int bbsspam_main() { int num; struct spamheader *sh = NULL; struct spamheader *sh1; uint16_t spamnum; struct yspam_ctx *yctx; unsigned long long mid; char midbuf[100]; int ret; if ((!loginok || isguest) && (!tempuser)) http_fatal("您尚未登录, 请先登录"); html_header(1); changemode(RMAIL); printf("<body><center>\n"); printf("%s -- 垃圾信件列表 [使用者: %s]\n", BBSNAME, currentuser->userid); yctx = yspam_init("127.0.0.1"); ret = yspam_getallspam(yctx, currentuser->userid, &sh, &spamnum); yspam_fini(yctx); if (ret < 0 && ret != -YSPAM_ERR_NOSUCHMAIL) { if (sh) free(sh); http_fatal("内部错误 1"); } printf("共有 %d 封垃圾邮件", spamnum); printf("<table>"); printf ("<tr><td>序号</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); sh1 = sh; for (num = 1; num <= spamnum; num++) { mid = ((unsigned long long)ntohl(sh1->mailid_high) << 32) + ntohl(sh1->mailid_low); sprintf(midbuf, "%llu", mid); printf("<tr><td>%d</td><td>%s</td><td>%12.12s</td><td><a href=bbsspamcon?id=%s&magic=%d>", num, void1(titlestr(sh1->sender)), Ctime(ntohl(sh1->time)) + 4, midbuf, ntohl(sh1->magic)); if (sh1->title[0] == 0) printf("无题"); else printf("%s", void1(titlestr(sh1->title))); printf("</a></td></tr>"); sh1++; } if (sh) free(sh); printf("</table>"); http_quit(); return 0; }
int bbsbkndoc_main() { FILE *fp; char board[80], bkn[80], dir[160], *ptr, genbuf[STRLEN]; struct boardmem *x1; struct fileheader x; int i, start, total; html_header(1); printf("<script src=" BBSJS "></script>\n"); changemode(BACKNUMBER); //check_msg(); getparmboard(board, sizeof(board)); strsncpy(bkn, getparm("bkn"), 32); ptr = bkn; while (*ptr) { if (*ptr != 'B' && *ptr != '.' && !isdigit(*ptr)) http_fatal("错误的过刊号"); ptr++; } if (strlen(bkn) < 3) http_fatal("错误的过刊号"); x1 = getboard(board); if (x1 == 0) nosuchboard(board, "bbsbkndoc"); else { updateinboard(x1); strcpy(board, x1->header.filename); sprintf(dir, "boards/.backnumbers/%s/%s", board, bkn); if (!file_exist(dir)) http_fatal("没有这卷过刊"); sprintf(dir, "boards/.backnumbers/%s/%s/.DIR", board, bkn); fp = fopen(dir, "r"); total = file_size(dir) / sizeof (struct fileheader); start = getdocstart(total, w_info->t_lines); printf("<body topmargin=0>"); printf("<nobr><center>\n"); sprintf(genbuf, "阅览过刊 文章数[%d]", total); printboardtop(x1, 5, genbuf); if (total <= 0) http_fatal("本卷过刊目前没有文章"); printf("<table cellSpacing=0 cellPadding=2>\n"); printf ("<tr class=docbgcolor><td>序号<td>状态<td>作者<td>日期<td>标题<td>星级<td>评价</td>\n"); if (fp) { fseek(fp, (start - 1) * sizeof (struct fileheader), SEEK_SET); for (i = 0; i < w_info->t_lines; i++) { char filename[255]; char *ptr; if (fread(&x, sizeof (x), 1, fp) <= 0) break; if (x.accessed & FH_HIDE) { printf ("<tr><td>%d<td> <td>不详<td>不详<td>-本文已经被删除-<td>\n", start + i); continue; } ptr = flag_str2(x.accessed, 1); sprintf(filename, "boards/.backnumbers/%s/%s/%s", board, bkn, fh2fname(&x)); printf("<tr><td>%d<td>%s<td>%s", start + i, ptr, userid_str(x.owner)); printf("<td>%12.12s", Ctime(x.filetime) + 4); x.title[40] = 0; printf ("<td><a href=bbsbkncon?B=%d&bkn=%s&file=%s&num=%d>%s%s </a>%s", getbnumx(x1), bkn, fh2fname(&x), start + i - 1, strncmp(x.title, "Re: ", 4) ? "○ " : "", void1(titlestr(x.title)), size_str(eff_size(filename))); printf("<td><font color=%s>%d</font>\n", x.staravg50 ? "red" : "black", x.staravg50 / 50); printf("<td><font color=%s>%d人</font>\n", x.hasvoted ? "red" : "black", x.hasvoted); } printf("</table>"); printhr(); fclose(fp); } sprintf(genbuf, "bbsbkndoc?B=%d&bkn=%s", getbnumx(x1), bkn); bbsdoc_helper(genbuf, start, total, w_info->t_lines); printf("<table><tr><td><form name=form1 action=bbsbkndoc>\n"); printf("<input type=hidden name=B value=%d>", getbnumx(x1)); printf("<input type=hidden name=bkn value=%s>", bkn); printf ("<input type=submit value=跳转到> 第 <input type=text name=start size=4> 篇"); printf("</form>\n"); printf("</td><td><form name=form2 action=bbsdoc>\n"); printf ("<input type=submit value=跳转到><input type=text name=board size=5> 讨论区"); printf("</form></td></tr></table>\n"); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); printf("</body>"); http_quit(); } return 0; }
int bbsgdoc_main() { //modity by macintosh 050516 for new www FILE *fp; char board[80], buf[128]; struct boardmem *x1; struct fileheader x; int i, start, total; html_header(1); check_msg(); printf("<script src=/function.js></script>\n"); changemode(READING); strsncpy(board, getparm2("B", "board"), 32); x1 = getboard(board); if (x1 == 0) nosuchboard(board, "bbsgdoc"); updateinboard(x1); strcpy(board, x1->header.filename); sprintf(buf, "boards/%s/.DIGEST", board); fp = fopen(buf, "r"); if (fp == 0) http_fatal("错误的讨论区目录"); total = file_size(buf) / sizeof (struct fileheader); start = getdocstart(total, w_info->t_lines); /* printf("<body topmargin=0>"); printf("<nobr><center>\n"); */ printf("<body topmargin=0 leftmargin=0>\n"); printf("<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>\n" "<td><form name=form1 action=bbsgdoc>\n"); printboardtop(x1, 4); /* printf("文章数[%d] ", total); printf("<a href=bbspst?board=%s>发表文章</a> ", board); */ printf("<tr><td><a href=\"pst?B=%s\" class=\"btnsubmittheme\" title=\"发表文章 accesskey: p\" accesskey=\"p\">发表文章</a>\n", board); printf("文章数<%d> 在线<%d></td>", total, x1->inboard); sprintf(buf, "bbsgdoc?board=%s", board); // bbsdoc_helper(buf, start, total, w_info->t_lines); printf("<td align=right><a href=\"gdoc?B=%s&S=%d\" title=\"第一页 accesskey: 1\" accesskey=\"1\">第一页</a>\n", board, 1); if(start > w_info->t_lines+1) printf("<a href=\"gdoc?B=%s&S=%d\" title=\"上一页 accesskey: f\" accesskey=\"f\">上一页</a>\n", board, (start-w_info->t_lines)); if(start < total-w_info->t_lines+1) printf("<a href=\"gdoc?B=%s&S=%d\" title=\"下一页 accesskey: n\" accesskey=\"n\">下一页</a>\n", board, (start+w_info->t_lines)); printf("<a href=\"gdoc?B=%s&S=%d\" title=\"最后一页 accesskey: l\" accesskey=\"l\">最后一页</a>\n", board, (total-w_info->t_lines+1)); //add by macintosh 050519 for func "Go" printf("<input type=hidden name=B value=%s>", board); printf("<input name=Submit1 type=Submit class=sumbitgrey value=Go>\n" "<input name=S type=text style=\"font-size:11px;font-family:verdana;\" size=4></td>\n" "</tr></table></td></tr>\n"); printf("</form></td>"); if (NULL == fp) http_fatal("本讨论区目前没有文章"); if (total <= 0) { fclose(fp); http_fatal("本讨论区文摘目前没有文章"); } /* printhr(); printf("<table border=0>\n"); printf ("<tr><td>序号</td><td>状态</td><td>作者</td><td>日期</td><td>标题</td><td>星级</td><td>评价</td></tr>\n"); */ printf("%s", "<tr><td width=40 class=\"level1\"> </td>\n" "<td class=\"level1\"><TABLE width=\"95%\" cellpadding=2 cellspacing=0>\n" "<TBODY>\n"); printf("%s", "<TR>\n" "<TD class=tdtitle>序号</TD>\n" "<TD class=tdtitle>状态</TD>\n" "<TD class=tduser>作者</TD>\n" "<TD align=center class=tdtitle>日期</TD>\n" "<TD align=center class=tdtitle>标题</TD>\n" "<TD class=tdtitle>星级</TD>\n" "<TD class=tdtitle>评价</TD>\n" "</TR>\n"); fseek(fp, (start - 1) * sizeof (struct fileheader), SEEK_SET); for (i = 0; i < w_info->t_lines; i++) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; printf("<tr><td class=tdborder>%d</td><td class=tdborder>%s</td><td class=tduser>%s</td>", start + i, flag_str(x.accessed), userid_str(x.owner)); printf("<td align=center class=tdborder>%12.12s</td>", Ctime(x.filetime) + 4); printf ("<td class=tdborder><a href=bbsgcon?board=%s&file=%s&num=%d>%s%s</a></td><td class=tdborder>%d</td><td class=tdborder>%d人</td></tr>\n", board, fh2fname(&x), start + i - 1, strncmp(x.title, "Re: ", 4) ? "● " : "", void1(titlestr(x.title)), x.staravg50 / 50, x.hasvoted); } printf("</TR> </TBODY></TABLE></td></tr>\n"); /* printhr(); printf("文章数[%d] ", total); printf("<a href=bbspst?board=%s>发表文章</a> ", board); bbsdoc_helper(buf, start, total, w_info->t_lines); */ printf("<tr><td height=40 class=\"level1\"> </td>\n" "<td height=40 class=\"level1\">\n" "<table width=\"95%\" height=\"100%\" border=0 cellpadding=0 cellspacing=0 class=\"level1\">\n" "<td><form name=form2 action=bbsgdoc>\n"); printf("<tr><td><a href=\"pst?B=%s\" class=\"btnsubmittheme\" title=\"发表文章 accesskey: p\" accesskey=\"p\">发表文章</a>\n", board); printf("文章数<%d> 在线<%d></td>", total, x1->inboard); sprintf(buf, "bbsgdoc?board=%s", board); printf("<td align=right><a href=\"gdoc?B=%s&S=%d\" title=\"第一页 accesskey: 1\" accesskey=\"1\">第一页</a>\n", board, 1); if(start > w_info->t_lines+1) printf("<a href=\"gdoc?B=%s&S=%d\" title=\"上一页 accesskey: f\" accesskey=\"f\">上一页</a>\n", board, (start-w_info->t_lines)); if(start < total-w_info->t_lines+1) printf("<a href=\"gdoc?B=%s&S=%d\" title=\"下一页 accesskey: n\" accesskey=\"n\">下一页</a>\n", board, (start+w_info->t_lines)); printf("<a href=\"gdoc?B=%s&S=%d\" title=\"最后一页 accesskey: l\" accesskey=\"l\">最后一页</a>\n", board, (total-w_info->t_lines+1)); //add by macintosh 050519 for func "Go" printf("<input type=hidden name=B value=%s>", board); printf("<input name=Submit2 type=Submit class=sumbitgrey value=Go>\n" "<input name=S type=text style=\"font-size:11px;font-family:verdana;\" size=4></td>\n" "</tr></table></td></tr>\n"); printf("</form></td>"); fclose(fp); // printdocform("bbsgdoc", board); printf("</table></td></tr></table></body>\n"); http_quit(); return 0; }
int bbsbknsel_main() { FILE *fp; char board[80], dir[160], genbuf[STRLEN]; struct boardmem *x1; struct bknheader x; int i, start, total; html_header(1); printf("<script src=" BBSJS "></script>\n"); //check_msg(); changemode(SELBACKNUMBER); getparmboard(board, sizeof (board)); x1 = getboard(board); if (x1 == 0) nosuchboard(board, "bbsbknsel"); else { strcpy(board, x1->header.filename); sprintf(dir, "boards/.backnumbers/%s/.DIR", board); fp = fopen(dir, "r"); if (fp == NULL) http_fatal("错误的讨论区"); total = file_size(dir) / sizeof (struct bknheader); start = getdocstart(total, w_info->t_lines); printf("<body topmargin=0><nobr><center>\n"); sprintf(genbuf, "选择过刊 过刊数[%d]", total); printboardtop(x1, 5, genbuf); if (total <= 0) { fclose(fp); http_fatal("本讨论区目前没有过刊"); } printf("<table cellSpacing=0 cellPadding=2>\n"); printf ("<tr class=docbgcolor><td>序号</td><td>讨论区</td><td>建立日期</td><td>标题 </td></tr>\n"); if (fp) { fseek(fp, (start - 1) * sizeof (struct bknheader), SEEK_SET); for (i = 0; i < w_info->t_lines; i++) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; printf("<tr><td>%d</td><td>%s</td>", start + i, x.boardname); if (!i) printf("<td><nobr>%12.12s</td>", Ctime(x.filetime) + 4); else printf("<td>%12.12s</td>", Ctime(x.filetime) + 4); printf ("<td><a href=bbsbkndoc?B=%d&bkn=%s&num=%d>○ %s </a></td></tr>", getbnumx(x1), bknh2bknname(&x), start + i - 1, void1(titlestr(x.title))); } printf("</table>"); printhr(); fclose(fp); } printf("选择过刊 过刊数[%d] ", total); sprintf(genbuf, "bbsbknsel?B=%d", getbnumx(x1)); bbsdoc_helper(genbuf, start, total, w_info->t_lines); printdocform("bbsbknsel", getbnumx(x1)); http_quit(); } return 0; }
int bbsspamcon_main() { unsigned long long id; int magic; char title[60], sender[40]; char path[256]; char idbuf[100]; int ret; int feedham; struct yspam_ctx *yctx; if ((!loginok || isguest) && (!tempuser)) http_fatal("请先登录%d", tempuser); changemode(RMAIL); id = strtoull(getparm("id"), NULL, 10); magic = atoi(getparm("magic")); feedham = atoi(getparm("feed")); if (feedham) { html_header(1); printf("<body><center>\n"); yctx = yspam_init("127.0.0.1"); ret =yspam_feed_ham(yctx, currentuser->userid, id, magic); yspam_fini(yctx); if (ret == 0) printf("成功"); else printf("真失败 %d",ret); printf("<br><a href=bbsspam>返回垃圾邮件列表</a>"); printf("</center></body>\n"); http_quit(); } snprintf(path, sizeof(path), MY_BBS_HOME"/maillog/%llu.bbs", id); if (*getparm("attachname") == '/') { showbinaryattach(path); return 0; } html_header(1); yctx = yspam_init("127.0.0.1"); ret = yspam_getspam(yctx, currentuser->userid, id, magic, title, sender); yspam_fini(yctx); if (ret < 0) { printf("%d", ret); http_quit(); http_fatal("内部错误"); } printf("<body><center>\n"); printf("%s -- 垃圾信件 [使用者: %s]<hr>\n", BBSNAME, currentuser->userid); if (title[0] == 0) printf("</center>标题: 无题<br>"); else printf("</center>标题: %s<br>", void1(titlestr(title))); printf("发信人: %s<br>", void1(titlestr(sender))); printf("<center>"); showcon(path); sprintf(idbuf, "%llu", id); printf("这不是一封垃圾邮件,<a onclick='return confirm(\"这封信真的不是垃圾邮件吗?您的准确判断将有助于我们改善系统\")' href=bbsspamcon?id=%s&magic=%d&feed=1>请还给我</a><br>", idbuf, magic); printf("<a href=bbsspam>返回垃圾邮件列表</a>"); printf("</center></body>\n"); http_quit(); return 0; }