static void editMsgLine(struct edit *edit) { static int ck, havenewmail; if (!edit) { ck = 0; havenewmail = chkmail(); return; } if (talkrequest) { talkreply(); clear(); edit->redrawall = 1; } if (++ck >= 10) { havenewmail = chkmail(); ck = 0; } move(t_lines - 1, 0); prints("\033[1;33;44m【%s】", havenewmail ? "\033[5;32m信\033[m\033[1;33;44m" : " "); prints("【%s】", have_msg_unread ? "\033[5;32mMSG\033[m\033[1;33;44m" : " "); prints(" \033[31mCtrl-Q\033[33m 求救 "); prints ("状态 [\033[32m%s\033[33m][\033[32m%d\033[33m,\033[32m%d\033[33m][\033[32m%s\033[33m][\033[32m%s\033[33m] ", edit->overwrite ? "Rep" : "Ins", edit->line + 1, edit->col + 1, "X", editview ? " " : "~"); prints("时间\033[1;33;44m【\033[1;32m%16s\033[33m】 \033[m", Ctime(now_t)); }
int bbsnewmail_main() { FILE *fp; struct fileheader x; int total = 0, total2 = 0; char dir[80]; if (!loginok || isguest) http_fatal("您尚未登录, 请先登录"); sprintf(dir, "mail/%c/%s/.DIR", mytoupper(currentuser->userid[0]), currentuser->userid); if (cache_header(file_time(dir), 1)) return 0; html_header(1); //check_msg(); changemode(RMAIL); //去掉了框架 printf("<body topmargin=0 leftMargin=1 MARGINWIDTH=1 MARGINHEIGHT=0>" WWWLEFT_DIV); printf("<center>\n"); printf ("%s -- 未读邮件列表 [使用者: %s] [信箱容量: %dk, 已用空间: %dk]<hr>\n", BBSNAME, currentuser->userid, max_mailsize(currentuser), get_mailsize(currentuser)); fp = fopen(dir, "r"); if (fp == 0) http_fatal("目前您的信箱没有任何信件"); printf("<table border=1>\n"); printf ("<tr><td>序号</td><td>状态</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); while (1) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; total++; if (x.accessed & FH_READ) continue; printf("<tr><td>%d</td><td>N</td>", total); printf("<td>%s</td>", userid_str(fh2owner(&x))); printf("<td>%6.6s</td>", Ctime(x.filetime) + 4); printf("<td><a href=bbsmailcon?file=%s&num=%d>", fh2fname(&x), total - 1); if (strncmp("Re: ", x.title, 4)) printf("★ "); hprintf("%42.42s", void1(x.title)); printf(" </a></td></tr>\n"); total2++; } fclose(fp); printf("</table><hr>\n"); printf("您的信箱共有%d封信件, 其中新信%d封.", total, total2); printf("</center>"); showfile(MY_BBS_HOME "/wwwtmp/googleanalytics"); // printf("</body>"); //修改框架,页面底部 printf(WWWFOOT_DIV "</body></html>\n"); http_quit(); return 0; }
local void Ctimereset(const char *cmd, const char *params, Player *p, const Target *target) { Arena *arena = p->arena; timerdata *td = P_ARENA_DATA(arena, tdkey); ticks_t gamelen = td->gamelen; if (gamelen) { td->timeout = TICK_MAKE(current_ticks() + gamelen); Ctime(cmd, params, p, target); } }
int bbsfoot_main() { int dt = 0, mail_total = 0, mail_unread = 0, lasttime = 0; char *id = "guest"; static int r = 0; html_header(2); printf("<script>function t(){return (new Date()).valueOf();}</script>"); printf("<body topmargin=1 MARGINHEIGHT=1 class=foot>\n"); if (loginok) { id = currentuser->userid; dt = abs(now_t - w_info->login_start_time) / 60; } printf("时间[%16.16s] ", Ctime(now_t)); printf("在线[%d] ", count_online()); printf("帐号[<a href=\"bbsqry?userid=%s\" target=f3>%s</a>] ", id, id); if (loginok && !isguest) { int thistime; lasttime = atoi(getparm("lt")); thistime = mails_time(id); if (thistime <= lasttime) { mail_total = atoi(getparm("mt")); mail_unread = atoi(getparm("mu")); } else { mail_total = mails(id, &mail_unread); lasttime = thistime; } if (mail_unread == 0) { printf("信箱[<a href=bbsmail target=f3>%d封</a>] ", mail_total); } else { printf ("信箱[<a href=bbsmail target=f3>%d(<font color=red>新信%d</font>)</a>] ", mail_total, mail_unread); } showmyclass(); } #ifdef ENABLE_BLOG showmyblog(); #endif printf("停留[%d小时%d分] ", dt / 60, dt % 60); printf ("<a href=# onclick='javascript:{location=location;return false;}'>刷新</a>"); printf("<script>setTimeout('self.location.replace(" "\"bbsfoot?lt=%d&mt=%d&mu=%d&sn='+t()+'\")', %d);</script>", lasttime, mail_total, mail_unread, 900000 + r * 1000); r = (r + dt + now_t) % 30; printf("</body>"); return 0; }
int bbsnewmail_main() { //modify by mintbaggio 20040829 for new www FILE *fp; struct fileheader x; int total = 0, total2 = 0; char dir[80]; if (!loginok || isguest) http_fatal("您尚未登录, 请先登录"); sprintf(dir, "mail/%c/%s/.DIR", mytoupper(currentuser.userid[0]), currentuser.userid); if(cache_header(file_time(dir),1)) return 0; html_header(1); check_msg(); changemode(RMAIL); printf("<body><center>\n"); printf ("<div class=rhead>%s -- 新邮件列表 [使用者: <span class=h11>%s</span>]<br>[信箱容量: <span class=h11>%d</span>k, 已用空间: <span class=h11>%dk</span>]</div><hr>\n", BBSNAME, currentuser.userid, max_mail_size(), get_mail_size()); fp = fopen(dir, "r"); if (fp == 0) http_fatal("目前您的信箱没有任何信件"); printf("<table border=1>\n"); printf ("<tr><td>序号</td><td>状态</td><td>发信人</td><td>日期</td><td>信件标题</td></tr>\n"); while (1) { if (fread(&x, sizeof (x), 1, fp) <= 0) break; total++; if (x.accessed & FH_READ) continue; printf("<tr><td>%d</td><td>N</td>", total); printf("<td>%s</td>", userid_str(fh2owner(&x))); printf("<td>%6.6s</td>", Ctime(x.filetime) + 4); printf("<td><a href=bbsmailcon?file=%s&num=%d>", fh2fname(&x), total - 1); if (strncmp("Re: ", x.title, 4)) printf("★ "); hprintf("%42.42s", void1(x.title)); printf(" </a></td></tr>\n"); total2++; } fclose(fp); printf("</table><hr>\n"); printf("您的信箱共有%d封信件, 其中新信%d封.", total, total2); printf("</center></body>"); http_quit(); return 0; }
//argv[1]: -1: 清理所有封禁/警告标记; 0: 只进行解封; //1: 解封和警告; 2: 封禁/解封和警告 int main(int argn, char **argv) { int i; int oldvalue; struct boardheader *bh; char *(valuestr[]) = { "解封", "警告", "封禁" }; printf("自动封禁/解封版面\n运行时间: %s\n", Ctime(time(NULL))); if (argn >= 2) level = atoi(argv[1]); if (level > 2 || level < -1) level = 0; if (initbbsinfo(&bbsinfo) < 0) { printf("Failed to attach shm.\n"); return -1; } if (uhash_uptime() == 0) { printf("Failed to access uhash.\n"); return -1; } chdir(MY_BBS_HOME); for (i = 0; i < MAXBOARD; i++) { bh = &bbsinfo.bcache[i].header; if (!bh->filename[0]) continue; if (!strcasecmp(bh->filename, "syssecurity")) { bbsinfo.bcache[i].ban = 0; continue; } if (level == -1) { bbsinfo.bcache[i].ban = 0; continue; } oldvalue = bbsinfo.bcache[i].ban; bbsinfo.bcache[i].ban = shouldBan(bh, bbsinfo.bcache[i].ban); if (bbsinfo.bcache[i].ban || oldvalue) printf("%-20.20s %s ==> %s\n", bh->filename, valuestr[oldvalue], valuestr[(int) bbsinfo.bcache[i].ban]); } genfiles(); return 0; }
BOOL LogMng::WriteMsg(LPCSTR msg, ULONG command, ShareInfo *shareInfo) { char buf[MAX_BUF * 2] = " at "; strcat(buf, Ctime()); strcat(buf, " "); if (command & IPMSG_BROADCASTOPT) strcat(buf, BROADCASTLOG_MSGSTR); if (command & IPMSG_AUTORETOPT) strcat(buf, AUTORETLOG_MSGSTR); if (command & IPMSG_MULTICASTOPT) strcat(buf, MULTICASTLOG_MSGSTR); if (command & IPMSG_ENCRYPTOPT) strcat(buf, ENCRYPT_MSGSTR); if (command & IPMSG_SECRETOPT) { if (command & IPMSG_PASSWORDOPT) strcat(buf, PASSWDLOG_MSGSTR); else strcat(buf, SECRETLOG_MSGSTR); } if (shareInfo && (command & IPMSG_FILEATTACHOPT)) { strcat(buf, "\r\n " FILEATTACH_MSGSTR " "); char fname[MAX_PATH], *ptr = buf + strlen(buf); for (int cnt=0; cnt < shareInfo->fileCnt && ptr-buf < sizeof(buf)-MAX_PATH; cnt++) { ForcePathToFname(shareInfo->fileInfo[cnt]->Fname(), fname); ptr += wsprintf(ptr, "%s%s", fname, cnt+1 == shareInfo->fileCnt ? "" : ", "); } } strcat(buf, "\r\n-------------------------------------\r\n"); if (Write(buf) && Write(msg) && Write("\r\n\r\n")) return TRUE; else return FALSE; }
int update_form(char *board, char *file) { FILE *fp; char *buf=getparm("text"), path[80]; int i,l;//huangxu@060331 //这里为了安全 char * pbuf,c; char rbuf[512]; if(!(brd->flag2&NOFILTER_FLAG)&&(bad_words(buf))) { printf("<script language=\"javascript\">alert('您的文章可能包含不便显示的内容,已经提交审核。请返回并进行修改。');history.go(-1);</script>"); return 1; } sprintf(path, "boards/%s/%s", board, file); if (!(fp=fopen(path,"r"))) http_fatal("错误的文件!"); fseek(fp,0,2); l=ftell(fp); fseek(fp,0,0); pbuf=rbuf; for (i=4;l>0&&i>0;l--)//huangxu@060331 { *(pbuf++)=c=fgetc(fp); if (c==0x0a) i--; } fclose(fp); if (l<=0) http_fatal("错误的文件!"); fp=fopen(path, "w"); if(fp==0) http_fatal("无法存盘"); fwrite(rbuf,1,pbuf-rbuf,fp); fprintf(fp, "%s", buf); //huangxu@060331 fprintf(fp, "\n[1;36m※ 修改:·%s 于 %16.16s 修改本文·Web[FROM: %-.20s][m\n", currentuser.userid, Ctime(time(0))+ 4, fromhost); //fprintf(fp, "\n※ 修改:·%s 於 %s 修改本文·%s Web[FROM: %s] ", currentuser.userid, Ctime(time(0))+4,BBSHOST, (!(currentuser.userdefine & DEF_NOTHIDEIP)&&isdormip(fromhost))?"南开宿舍内网":fromhost); fclose(fp); printf("修改文章成功.<br><a href=bbsdoc?board=%s>返回本讨论区</a>", board); }
local void Ctimer(const char *cmd, const char *params, Player *p, const Target *target) { Arena *arena = p->arena; int mins = 0, secs = 0; timerdata *td = P_ARENA_DATA(arena, tdkey); if (td->gamelen == 0) { char *end; mins = strtol(params, &end, 10); if (end != params) { if ((end = strchr(end, ':'))) secs = strtol(end+1, NULL, 10); td->enabled = 1; td->timeout = TICK_MAKE(current_ticks()+(60*100*mins)+(100*secs)); Ctime(cmd, params, p, target); } else chat->SendMessage(p, "timer format is: '?timer mins[:secs]'"); } else chat->SendMessage(p, "Timer is fixed to Misc:TimedGame setting."); }
int printBlogArticle(struct Blog *blog, int n) { struct BlogHeader *blh; char filePath[80]; int i, s, t; if (n < 0 || n >= blog->nIndex) return -1; blh = &blog->index[n]; setBlogPost(filePath, blog->userid, blh->fileTime); printf("<h2 class=posttitle>"); printf("%s", nohtml(blh->title)); printf("</h2>"); printf("<small>%s 发表于 %s</small>", blog->config->useridUTF8, Ctime(blh->fileTime)); printf("<div class=postcontent>"); showfile(filePath); printf("</div>"); printf("<div class=postfoot>"); s = blh->subject; printf("栏目:%s", nohtml(blog->subject[s].title)); printf(" | Tags:"); for (i = 0; i < MAXTAG; ++i) { t = blh->tag[i]; if (t < 0 || t >= blog->nTag) continue; if (! *blog->tag[t].title) continue; printf("%s ", nohtml(blog->tag[t].title)); } printf(" | 评论(%d)", blh->nComment); if (!strcmp(currentuser->userid, blog->userid)) printf(" | <a href=blogpost?T=%d>编辑</a>", blh->fileTime); printf("</div>"); return 0; }
chat_query_user(char *cbuf) { ACCOUNT acct; char buf[80]; int in_now = 0; while (*cbuf && !isspace(*cbuf)) cbuf++; while (*cbuf && isspace(*cbuf)) cbuf++; strip_trailing_space(cbuf); if (!HasPerm(C_QUERY)) { printchatline("*** You do not have permission to query"); return 0; } if (*cbuf == '\0') { printchatline("*** You must specify a userid to query"); return 0; } if (bbs_query(cbuf, &acct) != S_OK) { sprintf(buf, "*** Userid '%s' not found", cbuf); printchatline(buf); return 0; } bbs_enum_users(20, 0, acct.userid, _query_if_logged_in, &in_now); printchatline("***"); sprintf(buf, "*** %s (%s):", acct.userid, acct.username); printchatline(buf); if (acct.lastlogin == 0) strcpy(buf, "*** Never logged in."); else sprintf(buf, "*** %s from %s %s %s", in_now ? "Logged in" : "Last login", acct.fromhost, in_now ? "since" : "at", Ctime((time_t *)&acct.lastlogin)); printchatline(buf); if (acct.realname[0] != '\0') { sprintf(buf, "*** Real name: %s", acct.realname); printchatline(buf); } return 0; }
int genfiles() { FILE *fp; if ((fp = fopen("bbstmpfs/dynamic/banAlert.www.new", "w")) == NULL) return -1; fprintf(fp, "<b>版面文章超限报警</b><br>" "<font class=red>!!!</font> 版面文章将要超限, 版面将在 5 小时内被禁止发文.<br>" "<font class=red><b>!!!</b></font> 版面文章超限, 版面已经被禁止发文.<br>" "<br><br>普通版面" "<li><u>3 天前的文章总数</u>上限 3000, " "<li><u>5 小时前的文章总数</u>上限 4000, " "<li><u>所有文章总数</u>不得超过 4000 + 500." "<br>版面文章数有特殊规定者" "<li><u>3 天前的文章总数</u>上限若为 x," "<li><u>5 小时前的文章总数</u>上限 x + x/3," "<li><u>所有文章总数</u>不得超过 x + x/3 + 500."); fprintf(fp, "<br><br>上次检查时间:%s<br>", Ctime(time(NULL))); fclose(fp); rename("bbstmpfs/dynamic/banAlert.www.new", "bbstmpfs/dynamic/banAlert.www"); return 0; }
int bbsvote_act(char * info) { FILE *fp; struct votebal currvote, ent; char buf[STRLEN], buf1[512]; char buf2[1024]; struct ballot uservote; // struct votelog log; int aborted = NA, pos; int i, chkd; unsigned int j, multiroll = 0; char board[80]; char posturl[256]; char controlfile[STRLEN]; char *date, *tmp1, *tmp2; char flagname[STRLEN]; char logname[STRLEN]; int voted_flag; //用户是否投过该项票 int num_voted; //这个是有多少人投过票 int num_of_vote; //这个是开启的投票数 int votenum; //这个是用户选择进行第几个投票 int votevalue = 0; int procvote; time_t closedate; struct stat st; int now_t=time(0); if (!loginok) { strcpy(info, "匆匆过客不能投票。"); return -1; } strsncpy(board, getparm("B"), 32); if (!*board) { strsncpy(board, getparm("board"), 32); } votenum = atoi(getparm("votenum")); procvote = atoi(getparm("procvote")); modify_mode(u_info, VOTING); if(!has_post_perm(¤tuser, board) || !HAS_PERM(PERM_VOTE))//去死吧倒霉的全站投票 { strcpy(info, "您无权在本板内投票。"); return -1; } sprintf(controlfile, "vote/%s/%s", board, "control"); num_of_vote = (stat(controlfile, &st) == -1) ? 0 : st.st_size / sizeof (struct votebal); if (!num_of_vote) { strcpy(info, "抱歉, 目前并没有任何投票举行。"); return -2; } fp = fopen(controlfile, "r"); if (!fp)//大概不会发生 { strcpy(info, "系统错误。"); return -256; } //从if中提出来的 if (!votenum) //这是投票列表 { printf ("<card title=\"投票箱 -- %s\">", BBSNAME); printf ("<p><anchor><go href=\"bbsdoc.wml?board=%s\" />%s板</anchor>投票</p>", board, board); for (i = 1; i <= num_of_vote; i++) { fread(&ent, sizeof (struct votebal), 1, fp); sprintf(flagname, "vote/%s/flag.%d", board, (int) ent.opendate); num_voted = (stat(flagname, &st) == -1) ? 0 : st.st_size / sizeof (struct ballot); closedate = ent.opendate + ent.maxdays * 86400; //注意,这里的date成了结束时间 w_hsprintf(buf2, "%s", ent.title);//输出标题 printf("<p><anchor><go href=\"bbsvote.wml?board=%s&votenum=%d\" />#%d %s<br />", board, i, i, buf2); //发起投票者被华丽地无视了! datestr(buf2, closedate); //类别也被华丽地无视了! printf ("结束:%s 参与:%d</anchor></p>", buf2, num_voted); } fclose(fp); return 0; } else { if (votenum > num_of_vote) { strcpy(info, "参数错误。"); return -3; } fseek(fp, sizeof (struct votebal) * (votenum - 1), 0); fread(&currvote, sizeof (struct votebal), 1, fp); fclose(fp); sprintf(flagname, "vote/%s/flag.%d", board, (int) currvote.opendate); num_voted = (stat(flagname, &st) == -1) ? 0 : st.st_size / sizeof (struct ballot); pos = 0; fp = fopen(flagname, "r"); voted_flag = NA; if (fp) { for (i = 1; i <= num_voted; i++) { fread(&uservote, sizeof (struct ballot), 1, fp); if (!strcasecmp(uservote.uid, currentuser.userid)) { voted_flag = YEA; pos = i; break; } } fclose(fp); } if (!voted_flag) { memset(&uservote, 0, sizeof (uservote)); } if (procvote == 0) //-------投票权限判断 //没仔细看-_-b { if (currentuser.firstlogin > currvote.opendate) { strcpy(info, "对不起, 本投票在您帐号申请之前开启,您不能投票。"); return -3; } else if (!HAS_PERM(currvote.level & ~(LISTMASK | VOTEMASK))) { strcpy(info, "对不起,您目前尚无权在本票箱投票。"); return -4; } else if(currvote.level & LISTMASK ) { char listfilename[STRLEN]; setvfile(listfilename, board, "vote.list"); if(!dashf(listfilename)) { strcpy(info, "对不起,本票箱需要设定好投票名册方可进行投票。"); return -5; } else if(!seek_in_file(listfilename,currentuser.userid)) { strcpy(info, "对不起, 投票名册上找不到您的大名。"); return -6; } } else if(currvote.level & VOTEMASK ) { if(currentuser.numlogins < currvote.x_logins || currentuser.numposts < currvote.x_posts ||currentuser.stay < currvote.x_stay * 3600 || currentuser.firstlogin > currvote.opendate - currvote.x_live * 86400) { strcpy(info, "对不起,您目前尚不够资格在本票箱投票。"); return -7; } } closedate = currvote.opendate + currvote.maxdays * 86400; printf ("<card title=\"投票箱 -- %s\">", BBSNAME); w_hsprintf (buf2, "%s", currvote.title); printf("<p>投票主题: %s<br />", buf2); printf("投票类型: %s<br />", vote_type[currvote.type - 1]); printf("发起投票: <anchor><go href=\"bbsqry.wml?userid=%s\" />%s</anchor><br />", currvote.userid, currvote.userid); printf("所在板面: <anchor><go href=\"bbsdoc.wml?board=%s\" />%s</anchor><br />", board, board); datetime(buf2, closedate); printf("结束时间: %s<br />", buf2); if (currvote.type != VOTE_ASKING) { printf("最多投票: %d<br />", currvote.maxtkt); printf("投票说明:<br />"); sprintf(buf, "vote/%s/desc.%d", board, (int) currvote.opendate); fp = fopen(buf, "r"); if (fp) { while (1) { if (fgets(buf1, sizeof (buf1), fp) == 0) { break; } w_hprintf("%s", buf1); printf ("<br />"); } fclose(fp); } } printf ("</p>"); //multiroll这种东西没用啦 sprintf (posturl, "bbsvote.wml?board=%s&votenum=%d", board, votenum); switch (currvote.type) { case VOTE_SINGLE: //单选 j = uservote.voted + (uservote.voted << currvote.totalitems); chkd = 0; //这是当前选中的 printf ("<p>选项列表:<br />"); for (i = 0; i < currvote.totalitems; i++) { w_hprintf ("选项%d %s", i + 1, currvote.items[i]); printf ("<br />"); if (j & 1) { chkd = i + 1; } j >>= 1; } printf ("请选择:<select name=\"inp_vote\" value=\"%d\">", chkd); printf ("<option value=\"0\">未选择</option>"); for (i = 0; i < currvote.totalitems; i++) { printf ("<option value=\"%d\">%d</option>", i + 1, i + 1); } printf ("</select></p>"); votesug_inp(&uservote); printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"2\" />", posturl); wmlPostfield("vote"); votesug_pst(); printf ("</go>投票</anchor></p>"); break; case VOTE_MULTI: //复选 j = uservote.voted + (uservote.voted << currvote.totalitems); printf ("<p>选项列表<em>(最多投%d票)</em>:<br />", currvote.maxtkt); for (i = 0; i < currvote.totalitems; i++) { printf ("<select name=\"inp_votemulti%d\" value=\"%d\"><option value=\"0\">不选择</option><option value=\"1\">已选择</option></select> ", i + 1, (j & 1)); w_hprintf ("%s", currvote.items[i]); printf ("<br />"); j >>= 1; } printf ("</p>"); votesug_inp(&uservote); printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"3\" />", posturl); for (i = 0; i < currvote.totalitems; i++) { sprintf (buf2, "votemulti%d", i + 1); wmlPostfield(buf2); } votesug_pst(); printf ("</go>投票</anchor></p>"); break; case VOTE_YN: //是非 ... 不是跟单选一样的么? j = uservote.voted + (uservote.voted << currvote.totalitems); chkd = 0; //这是当前选中的 printf ("<p>选项列表:<br />"); for (i = 0; i < currvote.totalitems; i++) { if (j & 1) { chkd = i + 1; break; } j >>= 1; } printf ("请选择:<select name=\"inp_vote\" value=\"%d\">", chkd); printf ("<option value=\"0\">未选择</option>"); for (i = 0; i < currvote.totalitems; i++) { printf ("<option value=\"%d\">", i + 1); w_hprintf ("%s", currvote.items[i]); printf ("</option>"); } printf ("</select></p>"); votesug_inp(&uservote); printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"1\" />", posturl); //这里不同,单选procvote=2 wmlPostfield("vote"); votesug_pst(); printf ("</go>投票</anchor></p>"); break; case VOTE_VALUE: //数值 printf ("<p>请输入一个值:"); printf ("<input name=\"inp_votevalue\" value=\"%d\" /></p>", uservote.voted); votesug_inp(&uservote); printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"4\" />", posturl); wmlPostfield("votevalue"); votesug_pst(); printf ("</go>投票</anchor></p>"); break; case VOTE_ASKING: votesug_inp(&uservote); printf ("<p><anchor><go href=\"%s\" method=\"post\"><postfield name=\"procvote\" value=\"5\" />", posturl); votesug_pst(); printf ("</go>投票</anchor></p>"); break; default: printf ("<p>没有这种类型的投票啊。</p>"); return 0; //:( //<-switch } } else { if (procvote != currvote.type) { strcpy(info, "投票错误。"); return -1; } switch (procvote) { case 2: //VOTE_SINGLE votevalue = 1; votevalue <<= atoi(getparm("vote")) - 1; if (atoi(getparm("vote")) > currvote.totalitems + 1) { strcpy(info, "无效选项。"); return -1; } aborted = (votevalue == uservote.voted); break; case 3: //VOTE_MULTI votevalue = 0; j = 0; for (i = currvote.totalitems - 1; i >= 0; i--) { votevalue <<= 1; sprintf(buf, "votemulti%d", i + 1); votevalue |= !!atoi(getparm(buf)); j += !!atoi(getparm(buf)); } aborted = (votevalue == uservote.voted); if (j > currvote.maxtkt) { sprintf(info, "本投票最多只能选择%d个选项。", currvote.maxtkt); return -1; } break; case 1: //VOTE_YN votevalue = 1; j = atoi(getparm("vote")) - 1; if (j > currvote.totalitems || j < 0) { strcpy(info, "无效选项。"); return -1; } votevalue <<= j; aborted = (votevalue == uservote.voted); break; case 4: //VOTE_VALUE aborted = ((votevalue = atoi(getparm("votevalue"))) == uservote.voted); if (votevalue < 0 || votevalue > currvote.maxtkt) { sprintf(info, "应当介于0到%d之间(含)。", currvote.maxtkt); return -1; } break; case 5: //VOTE_ASKING aborted = NA; break; //<-switch } printf ("<card title=\"投票箱 -- %s\">", BBSNAME); if (aborted == YEA) { printf ("<p>未修改该投票的选项。</p>"); return 0; } else { fp = fopen(flagname, "r+"); if (fp == 0) { fp = fopen(flagname, "w+"); } if (fp) { flock(fileno(fp), LOCK_EX); if (pos > 0) { fseek(fp, (pos - 1) * sizeof (struct ballot), SEEK_SET); } else { fseek(fp, 0, SEEK_END); } strcpy(uservote.uid, currentuser.userid); uservote.voted = votevalue; for (i = 0; i < 3; i++) { sprintf (buf2, "sug%d", i); strncpy (uservote.msg[i], getparm(buf2), 78); removeInvisibleChars(uservote.msg[i], ' '); } fwrite(&uservote, sizeof (struct ballot), 1, fp); flock(fileno(fp), LOCK_UN); fclose(fp); printf("<p>已经帮您投入票箱中。</p>"); sprintf(buf, "%s %s %s", currentuser.userid, currentuser.lasthost, Ctime(now_t)); fs_append(BBSHOME"/vote.log", buf); } else { printf ("<p>系统发生了一点小小的问题-_-b</p>"); } } } }
int bbsqry_main() { FILE *fp; char userid[14], filename[80], buf[512]; struct userec *x; int tmp2; struct in_addr in; html_header(1); check_msg(); changemode(QUERY); strsncpy(userid, getparm("U"), 13); if (!userid[0]) strsncpy(userid, getparm("userid"), 13); printf("<body><center>"); printf("%s -- 查询网友<hr>\n", BBSNAME); if (userid[0] == 0) { printf("<form name=qry action=bbsqry>\n"); printf ("请输入用户名: <input name=userid maxlength=12 size=12>\n"); printf("<input type=submit value=查询用户>\n"); printf("</form><hr>\n"); printf("<script>document.qry.userid.focus();</script>"); http_quit(); } if (getuser(userid, &x) <= 0) { printf("不可能,肯定是你敲错了,根本没这人啊"); printf("<p><a href=javascript:history.go(-1)>快速返回</a>"); http_quit(); } printf("</center><pre>\n"); if (x->mypic) { printf("<table align=left><tr><td><center>"); printmypic(x->userid); printf("</center></td></tr></table>"); } printf("<b><font size=+1>%s</font></b> (<font class=gre>%s</font>) " "共上站 <font class=gre>%d</font> 次," "发表文章 <font class=gre>%d</font> 篇\n", x->userid, x->username, x->numlogins, x->numposts); // show_special(x->userid); in.s_addr = x->lasthost & 0x0000ffff; printf ("上次在 <font color=green>%s</font> 从 <font color=green>%s</font> 到本站一游。<br>", Ctime(x->lastlogin), inet_ntoa(in)); mails(userid, &tmp2); printf("信箱:[<font color=green>%s</font>],", tmp2 ? "⊙" : " "); if (!strcasecmp(x->userid, currentuser->userid)) { printf ("经验值:[<font color=green>%d</font>](<font color=olive>%s</font>) ", countexp(x), cuserexp(countexp(x))); printf ("表现值:[<font color=green>%d</font>](<font color=olive>%s</font>) ", countperf(x), cperf(countperf(x))); } if (x->dieday) { printf ("<br>已经离开了人世,呜呜...<br>还有 [<b>%d</b>] 天就要转世投胎了<br>", countlife(x)); } else { printf("生命力:[<font color=red>%d</font>]。<br>", countlife(x)); if (x->userlevel & PERM_BOARDS) { int i; printf("担任版务:"); for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) bm_printboard(&shm_bcache->bcache[i], x->userid); printf("<br>"); } if (!show_onlinestate(userid)) { printf ("目前不在站上, 上次离站时间 [<font color=blue>%s</font>]\n\n", (x->lastlogout >= x->lastlogin) ? Ctime(x-> lastlogout) : "因在线上或不正常断线不详"); } } printf("\n"); printf("</pre><table width=100%%><tr><td>"); sethomefile(filename, x->userid, "plans"); fp = fopen(filename, "r"); sprintf(filename, "00%s-plan", x->userid); fdisplay_attach(NULL, NULL, NULL, NULL); if (fp) { while (1) { if (fgets(buf, 256, fp) == 0) break; if (!strncmp(buf, "begin 644 ", 10)) { errlog("old attach %s", filename); fdisplay_attach(stdout, fp, buf, filename); continue; } fhhprintf(stdout, "%s", buf); } fclose(fp); } else { printf("<font color=teal>没有个人说明档</font><br>"); } printf("</td></tr></table>"); printf ("<br><br><a href=bbspstmail?userid=%s&title=没主题>[书灯絮语]</a> ", x->userid); printf("<a href=bbssendmsg?destid=%s>[发送讯息]</a> ", x->userid); printf("<a href=bbsfadd?userid=%s>[加入好友]</a> ", x->userid); printf("<a href=bbsfdel?userid=%s>[删除好友]</a> ", x->userid); if (x->userlevel & PERM_SPECIAL8) { printf ("<a href=bbs0an?path=/groups/GROUP_0/Personal_Corpus/%c/%s>[个人文集]</a> ", mytoupper(x->userid[0]), x->userid); } sethomefile(filename, x->userid, "B/config"); if (file_isfile(filename)) { printf ("<a href=blog?U=%s>[Blog]</a>", x->userid); } printf("<hr>"); printf("<center><form name=qry action=bbsqry>\n"); printf("请输入用户名: <input name=userid maxlength=12 size=12>\n"); printf("<input type=submit value=查询用户>\n"); printf("</form><hr>\n"); printf("</body>\n"); http_quit(); return 0; }
int draw_pic() { char *blk[10] = { "£ß", "¡õ", "¡õ", "¡õ", "¡õ", "¡õ", "¡õ", "¡õ", "¡õ", "¡õ", }; FILE *fp; int max = 0, cr = 0, tm, i, item, j, aver = 0; int pic[24]; char buf[80]; char sid[11]; time_t now; snprintf(sid, sizeof (sid), "%10s", MY_BBS_ID " BBS"); time(&now); if ((fp = fopen(AVEFLE, "r")) == NULL) return -1; else { bzero(&pic, sizeof (pic)); i = 0; while (fgets(buf, 50, fp) != NULL) { cr = atoi(index(buf, ':') + 1); tm = atoi(buf); pic[tm] = cr; aver += cr; i++; max = (max > cr) ? max : cr; } aver = aver / (i ? i : 1) + 1; fclose(fp); } if ((fp = fopen(AVEPIC, "w")) == NULL) return -1; item = (max / MAX_LINE) + 1; fprintf(fp, "\n [1;36m ©°¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª©´[m\n"); for (i = MAX_LINE; i >= 0; i--) { fprintf(fp, "[1;37m%4d[36m©¦[32m", (i + 1) * item); for (j = 0; j < 24; j++) { if ((item * i > pic[j]) && (item * (i - 1) <= pic[j]) && pic[j]) { fprintf(fp, "[35m%-3d[32m", (pic[j] % 1000)); continue; } if (pic[j] - item * i < item && item * i < pic[j]) fprintf(fp, "%s ", blk[((pic[j] - item * i) * 10) / item]); else if (pic[j] - item * i >= item) fprintf(fp, "%s ", blk[9]); else fprintf(fp, " "); } fprintf(fp, "[1;36m©¦[m"); fprintf(fp, "\n"); } time(&now); fprintf(fp, "[1;37m 0[36m©¸¡ª¡ª[37m%sƽ¾ù¸ºÔØÈËÊýͳ¼Æ [36m¡ª¡ª", sid); fprintf(fp, "¡ª¡ª[37m %s [36m¡ª¡ª¡ª©¼[m\n", Ctime(now)); fprintf(fp, "[1;36m 00 01 02 03 04 05 06 07 08 09 10 11 [31m12 13 14"); fprintf(fp, " 15 16 17 18 19 20 21 22 23[m\n\n"); fprintf(fp, " [1;36m 1 [32m¡õ[36m = [37m%3d [36m ƽ¾ùÉÏÕ¾ÈËÊý£º[37m%3d[m\n", item, aver); fclose(fp); return 0; }
int main() { FILE *fp,*fp2; struct shortfile *brd; struct fileheader f; struct userec *u; char buf[80], dir[80], path[80], board[80], file[80], *id; char jdir[80]; int num=0; init_all(); if(!loginok) http_fatal("请先登录"); id=currentuser.userid; strsncpy(board, getparm("board"), 60); strsncpy(file, getparm("file"), 20); brd=getbcache(board); if(strncmp(file, "M.", 2) && strncmp(file, "G.", 2)) http_fatal("错误的参数"); if(strstr(file, "..")) http_fatal("错误的参数"); if(brd==0) http_fatal("板面错误"); if(!has_post_perm(¤tuser, board)) http_fatal("错误的讨论区"); sprintf(dir, "boards/%s/.DIR", board); sprintf(path, "boards/%s/%s", board, file); sprintf(jdir, "boards/%s/.junk", board); fp=fopen(dir, "r"); if(fp==0) http_fatal("错误的参数"); while(1) { if(fread(&f, sizeof(struct fileheader), 1, fp)<=0) break; if(!strcmp(f.filename, file)) {//huangxu@060715:web下删除m文章 if((strcasecmp(id, f.owner)||(f.accessed[0]&FILE_MARKED)) && !has_BM_perm(¤tuser, board)) http_fatal("你无权删除该文"); fp2=fopen(jdir, "a"); fwrite(&f, sizeof(struct fileheader), 1, fp2); fclose(fp2); if(!HAS_PERM(PERM_SYSOP))//huangxu@060406:deleted、junk已经无用 if(strstr(board,"syssecurity")||(!strcmp(board,"Punishment")&&!HAS_PERM(PERM_BLEVELS))) http_fatal("你无权删除该文"); del_record(dir, sizeof(struct fileheader), num); sprintf(buf, "\n※ %s 于 %s 删除·Web[FROM: %s]", currentuser.userid, Ctime(time(0))+4, fromhost); f_append(path, buf); /* if(!strcmp(f.owner, currentuser.userid)) { post_article("junk", f.title, path, f.owner, "", fromhost, -1); } else { post_article("deleted", f.title, path, f.owner, "", fromhost, -1); }*/ //unlink(path); printf("删除成功.<br><a href='bbsdoc?board=%s'>返回本讨论区</a>", board); u=getuser(f.owner); if(!junkboard(board) && u) { if(u->numposts>0) u->numposts--; save_user_data(u); } sprintf(buf, "%s %-12s bbsdel %s\n", Ctime(time(0))+4, id, board); f_append("trace", buf); http_quit(); } num++; } fclose(fp); printf("文件不存在, 删除失败.<br>\n"); printf("<a href='bbsdoc?board=%s'>返回本讨论区</a>", board); http_quit(); }
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; }
BOOL LogMng::GetRecvMsg(MsgBuf *msg, int opt, THosts *hosts, ShareInfo *shareInfo, const std::vector<HostSub> *recvList, U8str *u) { U8str buf(MAX_UDPBUF); char *p = buf.Buf(); p += strcpyz(p, LOGMSG_HEAD_TOP); p += strcpyz(p, LOGMSG_FROM); p += MakeListString(cfg, &msg->hostSub, hosts, p, TRUE); p += strcpyz(p, "\r\n"); if (recvList && recvList->size() >= 1) { for (auto &h: *recvList) { p += strcpyz(p, LOGMSG_CC); p += MakeListString(cfg, (HostSub *)&h, hosts, p, TRUE); p += strcpyz(p, "\r\n"); } } p += strcpyz(p, LOGMSG_AT); p += strcpyz(p, Ctime(&msg->timestamp)); p += strcpyz(p, " "); int command = msg->command; if (command & IPMSG_BROADCASTOPT) { p += strcpyz(p, LoadStrU8(IDS_BROADCASTLOG)); } if (command & IPMSG_AUTORETOPT) { p += strcpyz(p, LoadStrU8(IDS_AUTORETLOG)); } if (command & IPMSG_MULTICASTOPT) { p += strcpyz(p, LoadStrU8(IDS_MULTICASTLOG)); } if (command & IPMSG_ENCRYPTOPT) { int id = 0; if (opt & LOG_SIGN2_OK) { id = IDS_ENCRYPT2_SIGNED2; } else if (opt & LOG_SIGN_OK) { id = IDS_ENCRYPT2_SIGNED; } else if (opt & LOG_SIGN_ERR) { id = IDS_ENCRYPT2_ERROR; } else if (opt & LOG_ENC2) { id = IDS_ENCRYPT2; } else { id = IDS_ENCRYPT; } p += strcpyz(p, LoadStrU8(id)); } else if (opt & LOG_UNAUTH) { p += strcpyz(p, LoadStrU8(IDS_UNAUTHORIZED)); } if (command & IPMSG_SECRETOPT) { if (command & IPMSG_PASSWORDOPT) p += strcpyz(p, LoadStrU8(IDS_PASSWDLOG)); else p += strcpyz(p, LoadStrU8(IDS_SECRETLOG)); } if (shareInfo && (command & IPMSG_FILEATTACHOPT)) { int clip_num = 0; int noclip_num = 0; for (int i=0; i < shareInfo->fileCnt; i++) { if (GET_MODE(shareInfo->fileInfo[i]->Attr()) == IPMSG_FILE_CLIPBOARD) { clip_num++; } else { noclip_num++; } } p += strcpyz(p, "\r\n "); if (clip_num || noclip_num) { int id = clip_num ? noclip_num ? IDS_FILEWITHCLIP : IDS_WITHCLIP : IDS_FILEATTACH; p += strcpyz(p, LoadStrU8(id)); p += strcpyz(p, " "); } for (int i=0; i < shareInfo->fileCnt && p - buf.Buf() < MAX_BUF; i++) { char fname[MAX_PATH_U8]; ForcePathToFname(shareInfo->fileInfo[i]->Fname(), fname); p += snprintfz(p, MAX_BUF, "%s%s", fname, i+1 == shareInfo->fileCnt ? "" : ", "); if (GET_MODE(shareInfo->fileInfo[i]->Attr()) == IPMSG_FILE_CLIPBOARD) { LogClip clip; clip.fname = fname; SetClipDimension(cfg, &clip); } } } p += strcpyz(p, "\r\n"); p += strcpyz(p, LOGMSG_HEAD_END); p += strcpyz(p, msg->msgBuf.s()); p += strcpyz(p, "\r\n\r\n"); *u = buf.s(); return TRUE; }
int main() { struct user_doccount *udcount,*udcounthead; FILE *fp,*fpfile; struct fileheader *data; char buf[512]; int type=0,docstart,docend,total,i,docmin; char dir[80], board[80], userid[80]; struct boardheader *brd; struct fileheader x; init_all(); /* added by roly 2002.05.10 去掉cache */ printf("<meta http-equiv=\"pragma\" content=\"no-cache\">"); printf("<title>信件下载</title><body>"); /* add end */ if(!loginok) { printf("<b>信件下载 · %s</b><br>\n",BBSNAME); printpretable_lite(); http_fatal("您尚未登录, 请先登录"); } printf("<b>信件下载 · %s</b><br>\n", BBSNAME); type=atoi(getparm("type")); if(type==0) return show_form(); docstart=atoi(getparm("start")); docend=atoi(getparm("end")); sprintf(dir, "mail/%c/%s/.DIR", toupper(currentuser.userid[0]), currentuser.userid); total=file_size(dir)/sizeof(struct fileheader); if(docstart<=0) docstart=1; if(docend<=0 || docend>total) docend=total; //printf("docstart:%d,docend:%d",docstart,docend); data=(struct fileheader *)calloc(total, sizeof(struct fileheader)); if(data==0) http_fatal("memory overflow"); fp=fopen(dir, "r"); if(fp==0) http_fatal("dir error"); total=fread(data, sizeof(struct fileheader), total, fp); printpretable_lite(); if(fp) { int i,filetime; char path[STRLEN]; printf("<ol>\n"); for (i=docstart-1 ;i<docend;i++) { filetime=atoi(data[i].filename+2); //added by iamfat 2002.08.10 //check_anonymous(data[i].owner); //added end. printf("<LI><A href=#%s>%s:(%12.12s) %s</A>\n",data[i].filename,data[i].owner,Ctime(filetime)+4,data[i].title); } printf("</ol>\n"); for (i=docstart-1;i<docend;i++) { printf("<a name=%s></a>",data[i].filename); //,data[i].title); printpretable(); printf("<table width=100%% border=0>\n"); printf("<pre class=ansi>"); sprintf(path, "mail/%c/%s/%s", toupper(currentuser.userid[0]), currentuser.userid, data[i].filename); //printf(path); fpfile=fopen(path, "r"); if(fpfile==0) { printf("本文不存在或者已被删除!"); printf("</pre></table>\n"); printposttable(); continue; } while(1) { if(fgets(buf, 512, fpfile)==0) break; hhprintf("%s", buf); } fclose(fpfile); printf("</pre></table>\n"); printposttable(); } } fclose(fp); printf("</body>\n"); http_quit(); }
BOOL LogMng::WriteMsg(ULONG packetNo, LPCSTR msg, ULONG command, int opt, time_t t, ShareInfo *shareInfo, int64 *msg_id) { U8str buf(MAX_UDPBUF); char *p = buf.Buf(); if (msg_id) { *msg_id = 0; } p += strcpyz(p, LOGMSG_AT); p += strcpyz(p, Ctime(&t)); p += strcpyz(p, " "); logMsg->packet_no = packetNo; logMsg->date = t; if (command & IPMSG_BROADCASTOPT) { p += strcpyz(p, LoadStrU8(IDS_BROADCASTLOG)); } if (command & IPMSG_AUTORETOPT) { p += strcpyz(p, LoadStrU8(IDS_AUTORETLOG)); logMsg->flags |= DB_FLAG_AUTOREP; } if (command & IPMSG_MULTICASTOPT) { p += strcpyz(p, LoadStrU8(IDS_MULTICASTLOG)); logMsg->flags |= DB_FLAG_MULTI; } if (command & IPMSG_ENCRYPTOPT) { int id = 0; if (opt & LOG_SIGN2_OK) { id = IDS_ENCRYPT2_SIGNED2; logMsg->flags |= DB_FLAG_SIGNED2|DB_FLAG_RSA2; } else if (opt & LOG_SIGN_OK) { id = IDS_ENCRYPT2_SIGNED; logMsg->flags |= DB_FLAG_SIGNED|DB_FLAG_RSA2; } else if (opt & LOG_SIGN_ERR) { id = IDS_ENCRYPT2_ERROR; logMsg->flags |= DB_FLAG_SIGNERR|DB_FLAG_RSA2; } else if (opt & LOG_ENC2) { id = IDS_ENCRYPT2; logMsg->flags |= DB_FLAG_RSA2; } else { id = IDS_ENCRYPT; logMsg->flags |= DB_FLAG_RSA; } p += strcpyz(p, LoadStrU8(id)); } else if (opt & LOG_UNAUTH) { p += strcpyz(p, LoadStrU8(IDS_UNAUTHORIZED)); logMsg->flags |= DB_FLAG_UNAUTH; } if (command & IPMSG_SECRETOPT) { if (command & IPMSG_PASSWORDOPT) { p += strcpyz(p, LoadStrU8(IDS_PASSWDLOG)); } else { p += strcpyz(p, LoadStrU8(IDS_SECRETLOG)); } logMsg->flags |= DB_FLAG_SEAL; // 未開封フラグのセット for (auto itr=logMsg->host.begin(); itr != logMsg->host.end(); itr++) { if ((logMsg->flags & DB_FLAG_FROM) == 0 || itr == logMsg->host.begin()) { itr->flags = DB_FLAGMH_UNOPEN; } } if ((logMsg->flags & DB_FLAG_FROM)) { logMsg->flags |= DB_FLAG_UNOPENR; } } if (opt & LOG_DELAY) { p += strcpyz(p, LoadStrU8(IDS_DELAYSEND)); logMsg->flags |= DB_FLAG_DELAY; } if (shareInfo && (command & IPMSG_FILEATTACHOPT)) { int clip_num = 0; int noclip_num = 0; for (int i=0; i < shareInfo->fileCnt; i++) { if (GET_MODE(shareInfo->fileInfo[i]->Attr()) == IPMSG_FILE_CLIPBOARD) { clip_num++; } else { noclip_num++; } } p += strcpyz(p, "\r\n "); if (clip_num || noclip_num) { int id = clip_num ? noclip_num ? IDS_FILEWITHCLIP : IDS_WITHCLIP : IDS_FILEATTACH; p += strcpyz(p, LoadStrU8(id)); p += strcpyz(p, " "); } for (int i=0; i < shareInfo->fileCnt && p - buf.Buf() < MAX_BUF; i++) { char fname[MAX_PATH_U8]; ForcePathToFname(shareInfo->fileInfo[i]->Fname(), fname); p += snprintfz(p, MAX_BUF, "%s%s", fname, i+1 == shareInfo->fileCnt ? "" : ", "); if (GET_MODE(shareInfo->fileInfo[i]->Attr()) == IPMSG_FILE_CLIPBOARD) { LogClip clip; clip.fname = fname; SetClipDimension(cfg, &clip); logMsg->clip.push_back(clip); logMsg->flags |= DB_FLAG_CLIP; } else { logMsg->files.push_back(fname); logMsg->flags |= DB_FLAG_FILE; } } } p += strcpyz(p, "\r\n"); p += strcpyz(p, LOGMSG_HEAD_END); Wstr wmsg(msg); LocalNewLineToUnixW(wmsg.s(), wmsg.Buf(), wmsg.Len()+1); logMsg->body = wmsg; logMsg->lines = get_linenum_n(logMsg->body.s(), logMsg->body.StripLen()); BOOL ret = Write(buf.s()) && Write(msg) && Write("\r\n\r\n"); #ifdef IPMSG_PRO #define LOGMNG_WRITEMSG #include "miscext.dat" #undef LOGMNG_WRITEMSG #endif if (logDb && cfg->LogCheck) { logDb->InsertOneData(logMsg); PostMessage(GetMainWnd(), WM_LOGVIEW_UPDATE, MakeMsgIdHigh(logMsg->msg_id), MakeMsgIdLow(logMsg->msg_id)); if (msg_id) { *msg_id = logMsg->msg_id; } } logMsg->Init(); return ret; }
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 apiqry_main() { FILE *fp; char userid[14], filename[80], buf[512], output[4096],output_utf8[4096]; struct userec *x; struct user_info *u; int i, tmp2, num; json_header(); // changemode(QUERY); strsncpy(userid, getparm("U"), 13); if (!userid[0]) strsncpy(userid,getparm("userid"), 13); if (userid[0] == '\0') { printf("{\"User\":null}"); return 0; } x = getuser(userid); if (x == 0) { printf("{\"User\":null}"); return 0; } // ��ʼ����û����� sstrcat(output, "{\"User\":{"); // ��ʾ�������� sstrcat(output, "\"UserID\":\"%s\",\"UserNickName\":\"%s\",\"LoginCounts\":%d,\"PostCounts\":%d,\"LastLogin\":\"%s\",\"LastHost\":\"%s\",", x->userid, x->username, x->numlogins, x->numposts,Ctime(x->lastlogin), x->lasthost); // ��ʾ�������� if(!strcasecmp(x->userid, currentuser.userid)){ sstrcat(output, "\"Exp\":%d,\"ExpLevel\":\"%s\",\"Perf\":%d,\"PerfLevel\":\"%s\"",countexp(x), cexp(countexp(x)), countperf(x), cperf(countperf(x))); } // ��ʾ����վ�����Ϣ if(x->userlevel & PERM_BOARDS) { sstrcat(output, "\"BOARDBM\":["); sethomefile(filename, x->userid, "mboard"); new_apply_record(filename, sizeof(struct boardmanager), (void *)bm_printboardapi, output); sstrcat(output, "],"); } if((x->userlevel & PERM_SYSOP) && (x->userlevel&PERM_ARBITRATE)) sstrcat(output, "\"Job\":\"��վ������\","); else if(x->userlevel & PERM_SYSOP) sstrcat(output, "\"Job\":\"����վ��\","); else if(x->userlevel & PERM_OBOARDS) sstrcat(output, "\"Job\":\"ʵϰվ��\","); else if(x->userlevel & PERM_ARBITRATE) sstrcat(output, "\"Job\":\"���μ�ί\","); else if(x->userlevel & PERM_SPECIAL4) sstrcat(output, "\"Job\":\"����\","); else if(x->userlevel & PERM_WELCOME) sstrcat(output, "\"Job\":\"ϵͳ����\","); else if(x->userlevel & PERM_SPECIAL7) { if((x->userlevel & PERM_SPECIAL1) && !(x->userlevel & PERM_CLOAK)) sstrcat(output, "\"Job\":\"���γ���Ա\","); else sstrcat(output, "\"Job\":\"�������Ա\","); } else if(x->userlevel & PERM_ACCOUNTS) sstrcat(output, "\"Job\":\"�ʺŹ���Ա\","); // ��ʾ��ǰ״̬��null ���� array num = 0; sstrcat(output, "\"States\":"); for (i=0; i<MAXACTIVE; ++i) { u = &(shm_utmp->uinfo[i]); if(!strcmp(u->userid, x->userid)) { if(u->active == 0 || u->pid ==0 || (u->invisible && !HAS_PERM(PERM_SEECLOAK))) continue; ++num; if(num == 1) sstrcat(output, "["); if(u->mode != USERDF4){ if(u->invisible) sstrcat(output, "\"C%s\"", ModeType(u->mode)); else sstrcat(output, "\"%s\"", ModeType(u->mode)); } else // �Զ���״̬ sstrcat(output, "%s", u->user_state_temp); } if( (num>0) && (i == MAXACTIVE - 1)) sstrcat(output, "],"); } if (num == 0 ) { sstrcat(output, "\"null\","); if( x->lastlogout != NULL ) sstrcat(output, "\"LastLogout\":\"%s\",",Ctime(x->lastlogout)); else sstrcat(output, "\"LastLogout\":null,"); } // ��ʾ˵���� sethomefile(filename,x->userid,"plans"); fp = fopen(filename, "r"); sprintf(filename, "00%s-plan", x->userid); if (fp) { sstrcat(output, "\"PersonalIntro\":\""); // ��ʼ����˵���� while(1){ if(fgets(buf,256,fp) == 0) break; if (buf[strlen(buf) - 1] == '\n'){ int currentlength; currentlength = strlen(buf); buf[currentlength - 1] = '\\'; buf[currentlength] = 'n'; buf[currentlength + 1] = 0; } if(!strncmp(buf,"bigin 644",10)){ // errlog() // fdisplay_attach() } sstrcat(output, "%s", buf); } sstrcat(output, "\","); // ��������˵���� fclose(fp); } else //û�и���˵���� sstrcat(output, "\"PersonalIntro\":null,"); // ��ʾ�����ǩ show_special_api(x->userid, output); // ������� sstrcat(output, "}}"); g2u(output,sizeof(output), output_utf8,sizeof(output_utf8)); printf("%s", output_utf8); //http_quit(); return 0; }
/******************************************************************* * 顯示 <BBS_User_xxxxx> TAG * 目前 UserQuery ,UserData 用的TAG一樣, 靠URLParaType區分 * * in UserQuery mode , curuser is target for query, not original userdata *******************************************************************/ void ShowUser(char *tag, USEREC * curuser) { if (request_rec->URLParaType != UserQuery && PSCorrect != Correct) return; if (!strcasecmp(tag, "ID")) { fputs(curuser->userid, fp_out); } else if (!strcasecmp(tag, "Name")) { char buf[STRLEN]; #if defined(NSYSUBBS1) if (request_rec->URLParaType == UserQuery && curuser->ident != 7) fputs("中山遊客", fp_out); else #endif { xstrncpy(buf, curuser->username, STRLEN); fputs(buf, fp_out); } } else if (!strcasecmp(tag, "Level")) { fprintf(fp_out, "%d", curuser->userlevel); } else if (!strcasecmp(tag, "Login")) { fprintf(fp_out, "%d", curuser->numlogins); } else if (!strcasecmp(tag, "Post")) { fprintf(fp_out, "%d", curuser->numposts); } #ifdef USE_IDENT else if (!strcasecmp(tag, "Ident")) { fputs(curuser->ident == 7 ? MSG_HasIdent : MSG_NotIdent, fp_out); } #endif else if (!strcasecmp(tag, "LastLogin")) { fputs(Ctime(&(curuser->lastlogin)), fp_out); } else if (!strcasecmp(tag, "LastHost")) { fputs(curuser->lasthost, fp_out); } else if (!strcasecmp(tag, "NewMail")) { if (curuser->flags[0] & FORWARD_FLAG) fputs(MSG_MailForwardON, fp_out); else if (!strcmp(curuser->userid, "guest")) fputs(MSG_MailHasRead, fp_out); else { if ((request_rec->URLParaType != UserQuery && PSCorrect != Correct) || !CheckNewmail(curuser->userid, TRUE)) { fputs(MSG_MailHasRead, fp_out); } else { fputs(MSG_MailNotRead, fp_out); } } } else if (!strcasecmp(tag, "Status")) /* print user online status */ { USER_INFO *quinf; if ((quinf = search_ulist(cmp_userid, curuser->userid)) && !(quinf->invisible)) { fprintf(fp_out, "線上狀態: %s, 呼喚鈴: %s.", modestring(quinf, 1), (quinf->pager != PAGER_QUIET) ? MSG_ON : MSG_OFF); } else fprintf(fp_out, "目前不在線上"); } else if (!strcasecmp(tag, "Plan")) { char userfile[PATHLEN]; sethomefile(userfile, curuser->userid, UFNAME_PLANS); if (request_rec->URLParaType == UserData) ShowArticle(userfile, FALSE, FALSE); else ShowArticle(userfile, FALSE, TRUE); } else { if (request_rec->URLParaType == UserQuery) /* bug fixed */ return; if (!strcasecmp(tag, "Email")) { fputs(curuser->email, fp_out); } else if (!strcasecmp(tag, "MailForward")) /* use in UserData only */ { fputs(curuser->flags[0] & FORWARD_FLAG ? "ON" : "OFF", fp_out); } else if (!strcasecmp(tag, "Friend")) { char userfile[PATHLEN]; sethomefile(userfile, curuser->userid, UFNAME_OVERRIDES); ShowArticle(userfile, FALSE, TRUE); } else if (strstr(tag, "Sign")) { FILE *fp; char fname[PATHLEN]; sethomefile(fname, curuser->userid, UFNAME_SIGNATURES); if ((fp = fopen(fname, "r")) != NULL) { int line = 0, num; char buffer[512]; GetPara3(buffer, "NUM", tag, 3, "-1"); num = atoi(buffer); for (line = 0; line < num * MAX_SIG_LINES && fgets(buffer, sizeof(buffer), fp); line++) { if (line < (num - 1) * MAX_SIG_LINES) continue; fprintf(fp_out, "%s", buffer); } fclose(fp); } } } }
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 bbsinfo_main() { //modify by mintbaggio 20040829 for new www int type; html_header(1); check_msg(); printf("<body>"); if (!loginok || isguest) http_fatal("您尚未登录"); changemode(EDITUFILE); type = atoi(getparm("type")); printf("<div class=rhead>%s -- 用户个人资料</div><hr>\n", BBSNAME); if (type != 0) { check_info(); http_quit(); } printf("<form action=bbsinfo?type=1 method=post>"); printf("您的帐号: %s<br>\n", currentuser.userid); printf ("您的昵称: <input type=text name=nick value='%s' size=24 maxlength=30><br>\n", currentuser.username); printf("发表大作: %d 篇<br>\n", currentuser.numposts); // printf("信件数量: %d 封<br>\n", currentuser.nummails); printf("上站次数: %d 次<br>\n", currentuser.numlogins); printf("上站时间: %ld 分钟<br>\n", currentuser.stay / 60); printf ("真实姓名: <input type=text name=realname value='%s' size=16 maxlength=16><br>\n", currentuser.realname); printf ("居住地址: <input type=text name=address value='%s' size=40 maxlength=40><br>\n", currentuser.address); printf("帐号建立: %s<br>", Ctime(currentuser.firstlogin)); printf("最近光临: %s<br>", Ctime(currentuser.lastlogin)); printf("来源地址: %s<br>", currentuser.lasthost); #ifndef POP_CHECK printf ("电子邮件: <input type=text name=email value='%s' size=32 maxlength=32><br>\n", currentuser.email); #endif #if 0 printf ("出生日期: <input type=text name=year value=%d size=4 maxlength=4>年", currentuser.birthyear + 1900); printf("<input type=text name=month value=%d size=2 maxlength=2>月", currentuser.birthmonth); printf("<input type=text name=day value=%d size=2 maxlength=2>日<br>\n", currentuser.birthday); printf("用户性别: "); printf("男<input type=radio value=M name=gender %s>", currentuser.gender == 'M' ? "checked" : ""); printf("女<input type=radio value=F name=gender %s><br>", currentuser.gender == 'F' ? "checked" : ""); #endif printf ("<input type=submit value=确定> <input type=reset value=复原>\n"); printf("</form>"); printf("<hr>"); printf("</body></html>"); return 0; }
BOOL TRecvDlg::EvCreate(LPARAM lParam) { editSub.AttachWnd(GetDlgItem(RECV_EDIT)); editSub.SendMessage(EM_AUTOURLDETECT, 1, 0); editSub.SendMessage(EM_SETBKGNDCOLOR, FALSE, ::GetSysColor(COLOR_3DFACE)); editSub.SendMessage(EM_SETTARGETDEVICE, 0, 0); // 折り返し SetDlgIcon(hWnd); SetDlgItemTextU8(RECV_HEAD, head); if (msg.command & IPMSG_BROADCASTOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_BROADCAST)); else if (msg.command & IPMSG_MULTICASTOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_MULTICAST)); else SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_UNICAST)); if (msg.command & IPMSG_AUTORETOPT) SetDlgItemTextU8(RECV_TITLE, GetLoadStrU8(IDS_UNIABSENCE)); char buf[MAX_LISTBUF]; if (msg.command & IPMSG_ENCRYPTOPT) { GetWindowText(buf, sizeof(buf)); strcat(buf, (cryptCapa & IPMSG_BLOWFISH_128) ? " +" : " -"); SetWindowText(buf); } wsprintf(head, "at %s", Ctime(&recvTime)); SetDlgItemTextU8(RECV_HEAD2, head); editSub.ExSetText(msg.msgBuf); if (msg.command & IPMSG_SECRETOPT) editSub.ShowWindow(SW_HIDE), ::ShowWindow(GetDlgItem(QUOTE_CHECK), SW_HIDE); else { ::ShowWindow(GetDlgItem(OPEN_BUTTON), SW_HIDE), openFlg = TRUE; if (shareInfo) SetFileButton(this, FILE_BUTTON, shareInfo); } if (msg.command & IPMSG_FILEATTACHOPT) { GetDlgItemTextU8(OPEN_BUTTON, buf, sizeof(buf)); strcat(buf, " "); strcat(buf, GetLoadStrU8(IDS_FILEATTACH)); SetDlgItemTextU8(OPEN_BUTTON, buf); } if (msg.command & IPMSG_PASSWORDOPT) { GetDlgItemTextU8(OPEN_BUTTON, buf, sizeof(buf)); strcat(buf, GetLoadStrU8(IDS_KEYOPEN)); SetDlgItemTextU8(OPEN_BUTTON, buf); } if (cfg->QuoteCheck) SendDlgItemMessage(QUOTE_CHECK, BM_SETCHECK, cfg->QuoteCheck, 0); if (cfg->AbnormalButton) SetDlgItemTextU8(IDOK, GetLoadStrU8(IDS_INTERCEPT)); SetFont(); SetSize(); HMENU hMenu = ::GetSystemMenu(hWnd, FALSE); AppendMenuU8(hMenu, MF_SEPARATOR, NULL, NULL); SetMainMenu(hMenu); if (IsNewShell() != TRUE) { ULONG style = GetWindowLong(GWL_STYLE); style &= 0xffffff0f; style |= 0x00000080; SetWindowLong(GWL_STYLE, style); } SetForegroundWindow(); if (msg.command & IPMSG_NOADDLISTOPT) ::EnableWindow(GetDlgItem(IDOK), FALSE); EvSize(SIZE_RESTORED, 0, 0); return TRUE; }
int bbsqry_main() { FILE *fp; char userid[14], filename[80], buf[512]; struct userec *x; struct user_info *u; int i, tmp2, num; html_header(1); check_msg(); changemode(QUERY); strsncpy(userid, getparm("U"), 13); if (!userid[0]) strsncpy(userid, getparm("userid"), 13); printf("<body><center>"); printf("<div class=rhead>%s -- ��ѯ����</div><hr>\n", BBSNAME); if (userid[0] == 0) { printf("<form action=bbsqry>\n"); printf ("�������û���: <input name=userid maxlength=12 size=12>\n"); printf("<input type=submit value=��ѯ�û�>\n"); printf("</form><hr>\n"); http_quit(); } x = getuser(userid); if (x == 0) { int i, j = 0; printf("û������û������ѵ�����Щ:<p>"); printf("<table width=600>"); for (i = 0; i < shm_ucache->number; i++) if (strcasestr(shm_ucache->userid[i], userid) == shm_ucache->userid[i]) { j++; if (j % 6 == 1) printf("<tr>"); printf("<td>"); printf("<a href=bbsqry?userid=%s>%s</a>", shm_ucache->userid[i], shm_ucache->userid[i]); printf("</td>"); sprintf(buf, "bbsqry?userid=%s", shm_ucache->userid[i]); if (j % 6 == 0) printf("</tr>"); if (j >= 12 * 6) break; } printf("</table>"); if (!j) printf("�����ܣ��϶������ô��ˣ�����û���˰�"); if (j == 1) redirect(buf); printf("<p><a href=javascript:history.go(-1)>���ٷ���</a>"); http_quit(); } printf("</center><pre style='font-size:14px'>\n"); sprintf(buf, "%s ([33m%s[37m) ����վ [1;32m%d[m �Σ��������� [1;32m%d[m ƪ", x->userid, x->username, x->numlogins, x->numposts); hprintf("%s", buf); show_special_web(x->userid);//add by wjbta@bmy ����id��ʶ printf("\n"); hprintf("�ϴ��� [[1;32m%s[m] �� [[1;32m%s[m] ����վһ�Ρ�\n", Ctime(x->lastlogin), x->lasthost); mails(userid, &tmp2); hprintf("���䣺[[1;32m%s[m]��", tmp2 ? "��" : " "); if (!strcasecmp(x->userid, currentuser.userid)) { hprintf("����ֵ��[[1;32m%d[m]([33m%s[m) ", countexp(x), cexp(countexp(x))); hprintf("����ֵ��[[1;32m%d[m]([33m%s[m) ", countperf(x), cperf(countperf(x))); } hprintf("��������[[1;32m%d[m]��\n", count_life_value(x)); if (x->userlevel & PERM_BOARDS) { hprintf("���ΰ���"); sethomefile(filename, x->userid, "mboard"); new_apply_record(filename, sizeof (struct boardmanager), (void *) bm_printboard, NULL); if (x->userlevel & !strcmp(x->userid, "SYSOP")) hprintf("[[1;36mϵͳ����Ա[m]"); else if (x->userlevel & !strcmp(x->userid, "lanboy")) hprintf("[[1;36mϵͳ����Ա[m]"); else if ((x->userlevel&PERM_SYSOP) && (x->userlevel&PERM_ARBITRATE) ) hprintf("[[1;36m��վ������[m]"); else if (x->userlevel & PERM_SYSOP) hprintf("[[1;36m����վ��[m]"); else if (x->userlevel & PERM_OBOARDS) hprintf("[[1;36mʵϰվ��[m]"); else if (x->userlevel & PERM_ARBITRATE) hprintf("[[1;36m���μ�ί[m]"); else if (x->userlevel & PERM_SPECIAL4) hprintf("[[1;36m����[m]"); else if (x->userlevel & PERM_WELCOME) hprintf("[[1;36mϵͳ����[m]"); else if (x->userlevel & PERM_SPECIAL7) { if ( (x->userlevel & PERM_SPECIAL1) && !(x->userlevel & PERM_CLOAK) ) hprintf("[[1;36m���γ���Ա[m]"); else hprintf("[[1;36m�������Ա[m]"); } else if (x->userlevel & PERM_ACCOUNTS) hprintf ("[[1;36m�ʺŹ���Ա[m]"); hprintf("\n"); } num = 0; for (i = 0; i < MAXACTIVE; i++) { u = &(shm_utmp->uinfo[i]); if (!strcmp(u->userid, x->userid)) { if (u->active == 0 || u->pid == 0 || (u->invisible && !HAS_PERM(PERM_SEECLOAK))) continue; num++; if (num == 1) hprintf("Ŀǰ��վ��, ״̬����:\n"); if (u->invisible) hprintf("[36mC[37m"); if (u->mode != USERDF4) hprintf("\033[%dm%s[m ", u->pid == 1 ? 35 : 32, ModeType(u->mode)); else /* �Զ���״̬ */ hprintf("\033[%dm%s[m ", u->pid == 1 ? 35 : 32, u->user_state_temp); if (num % 5 == 0) printf("\n"); } } if (num == 0) { hprintf("Ŀǰ����վ��, �ϴ���վʱ�� [[1;32m%s[m]\n\n", x->lastlogout ? Ctime(x->lastlogout) : "�������ϻ��������߲���"); } printf("\n"); printf("</pre><table width=100%%><tr><td class=f2>"); sethomefile(filename, x->userid, "plans"); fp = fopen(filename, "r"); sprintf(filename, "00%s-plan", x->userid); fdisplay_attach(NULL, NULL, NULL, NULL); if (fp) { while (1) { if (fgets(buf, 256, fp) == 0) break; if (!strncmp(buf, "begin 644 ", 10)) { errlog("old attach %s", filename); fdisplay_attach(stdout, fp, buf, filename); continue; } fhhprintf(stdout, "%s", buf); } fclose(fp); } else { hprintf("[36mû�и���˵����[37m\n"); } printf("</td></tr></table>"); printf ("<br><br><a href=bbspstmail?userid=%s&title=û����>[�������]</a> ", x->userid); printf("<a href=bbssendmsg?destid=%s>[����ѶϢ]</a> ", x->userid); printf("<a href=bbsfadd?userid=%s>[�������]</a> ", x->userid); printf("<a href=bbsfdel?userid=%s>[ɾ������]</a>", x->userid); printf("<hr>"); printf("<center><form action=bbsqry>\n"); printf("�������û���: <input name=userid maxlength=12 size=12>\n"); printf("<input type=submit value=��ѯ�û�>\n"); printf("</form><hr>\n"); printf("</body>\n"); http_quit(); return 0; }