Beispiel #1
0
int main()
{
        FILE *fp;
        int type;
        init_all();
        type=atoi(getparm("type"));
        if(!loginok)
                http_fatal("您尚未登录, 请重新登录。");
        printf("%s -- 填写注册单<hr color=green>\n", BBSNAME);
        check_if_ok();
        if(type==1) {
                check_submit_form();
                http_quit();
        }
        printf("您好, %s, 注册单通过确认后才可获得发表文章,发送信件和讯息的权利, 下面各项务必请认真真实填写<br><hr>\n", currentuser.userid);
        printf("<form method=post action=bbsform?type=1>\n");
        printf("真实姓名: <input name=realname type=text maxlength=80 size=8 value='%s'><br>\n",
               nohtml(currentuser.realname));
        printf("学校系级: <input name=dept type=text maxlength=320 size=32 value='%s'>(或工作单位)<br>\n",
               nohtml(currentuser.reginfo));
        printf("居住地址: <input name=address type=text maxlength=320 size=32 value='%s'><br>\n",
               nohtml(currentuser.address));
        printf("联络电话: <input name=phone type=text maxlength=320 size=32><br><hr><br>\n");
        printf("<input type=submit value=填好了> <input type=reset>");
        http_quit();
}
Beispiel #2
0
int
showhotboard2009(const struct sectree *sec, char *s)
{
	static struct hotboard *(hbs[50]);
	static int count = 0;
	struct hotboard *hb = NULL;
	int i;
	for (i = 0; i < count; i++) {
		if (hbs[i]->sec == sec) {
			hb = hbs[i];
			break;
		}
	}
	if (!hb) {
		if (count >= 50)
			return -1;
		hbs[count] = calloc(1, sizeof (struct hotboard));
		hb = hbs[count];
		count++;
	}
	genhotboard2009(hb, sec, atoi(s));
	for (i = 0; i < hb->count; i++) {
		printf("<li><a href=\"home?B=%d\" title=\"%s\">"
				"%s</a></li>\n",
		       hb->bnum[i], void1(nohtml(hb->title[i])), 
		       void1(nohtml(hb->title[i])));
	}
	return 0;
}
Beispiel #3
0
void
showmyclass()
{
	struct brcinfo *brcinfo;
	struct boardmem *bx;
	char *ptr = "";
	brcinfo = brc_readinfo(currentuser->userid);
	if ((bx = getboard(brcinfo->myclass))) {
		brc_initial(currentuser->userid, NULL);
		if (!brc_board_read(bx->header.filename, bx->lastpost))
			ptr = "<font color=red>";
		printf
		    ("<a href=home?B=%d target=f3 title='可以通过左侧工具栏--个人工具箱设置此处的版面'>%s%s%s</a> ",
		     getbnum(brcinfo->myclass), ptr,
		     brcinfo->myclasstitle[0] ? nohtml(brcinfo->
						       myclasstitle) :
		     nohtml(bx->header.title), ptr[0] ? "</font>" : "");
	} else {
// no one will use my class now
/*
		printf
		    ("<a href=bbsmyclass target=f3 title='点击此处设定自己的同学录'>我的班级</a> ");
*/
	}
}
Beispiel #4
0
//secstr == NULL: all boards
//secstr == "": boards that doesnn't belong to any group
//return the bnum of one of the match boards
static int
searchlist_alphabetical(const char *sectitle, const char *secstr, char *match,
			int showintro, int *bnum)
{
	struct boardmem *(data[MAXBOARD]), *bx;
	int i, len = 0, total = 0;
	if (secstr) {
		len = strlen(secstr);
		if (len == 0)
			len = 1;
	}
	for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) {
		bx = &shm_bcache->bcache[i];
		if (secstr && strncmp(bx->header.sec1, secstr, len)
		    //&& strncmp(bx->header.sec2, secstr, len)
		    )
			continue;
		if (!strcasestr(bx->header.filename, match) &&
		    !strcasestr(bx->header.title, match) &&
		    !strcasestr(getboardaux(i)->intro, match))
			continue;
		if (has_view_perm_x(currentuser, bx)) {
			*bnum = i;
			data[total] = bx;
			total++;
		}
	}
	if (!total)
		return 0;

	printhr();
	printf("<b>·ÖÇø: <a href=boa?secstr=%s>%s</a></b>", secstr,
	       nohtml(sectitle));
	qsort(data, total, sizeof (struct boardmem *), (void *) cmpboard);
	printf("<table width=100%%>\n");
	for (i = 0; i < total; i++) {
		if (showintro || (i && i % 3 == 0))
			printf("</tr>");
		if (showintro || i % 3 == 0)
			printf("\n<tr valign=top bgcolor=%x>",
			       0xf0f0d0 | (unsigned) (i % 2) * 0x0f0f0f);
		printf
		    ("<td><a href='javascript:setEl(\"%s\")'><nobr>%s(%s)</nobr></a></td>",
		     data[i]->header.filename, data[i]->header.filename,
		     nohtml(data[i]->header.title));
		if (showintro) {
			struct boardaux *baux;
			baux = getboardaux(getbnumx(data[i]));
			if (baux != NULL)
				printf("<td>%s</td>", nohtml(baux->intro));
		}
	}
	printf("</table>\n");
	return total;
}
Beispiel #5
0
int
main(int argn, char **argv)
{
	char buf[1024], sec[100], qry[100], manfile[100];
	int retv;
	strsncpy(buf, getsenv("QUERY_STRING"), sizeof (buf));
	if (strchr(buf, '&'))
		retv = getformarg(buf, sec, qry, 100);
	else if (strchr(buf, '+'))
		retv = geturlarg(buf, sec, qry, 100);
	else
		retv = -1;
	if (!retv)
		retv = testarg(sec, qry);
	if (!retv) {
		retv = getmanfile(sec, qry, manfile, sizeof (manfile));
		if (retv) {
			printheader();
			printf
			    ("找不到与<font color=red>%s</font>相关的文档<br><br>\n",
			     nohtml(qry));
		}
	}
	if (retv) {
		printheader();
		printsection();
		printform();
		return 0;
	}
	runman2html(manfile);
	return 0;
}
Beispiel #6
0
int main()
{
        struct fileheader *x;
        char board[80], file[80], target[80];
        init_all();
        strsncpy(board, getparm("board"), 30);
        strsncpy(file, getparm("file"), 30);
        strsncpy(target, getparm("target"), 30);
        if(!loginok)
                http_fatal("匆匆过客不能进行本项操作");
        if(!has_read_perm(&currentuser, board))
                http_fatal("错误的讨论区");
        x=get_file_ent(board, file);
        if(x==0)
                http_fatal("错误的文件名");
        printf("<center>%s -- 转寄/推荐给好友 [使用者: %s]<hr color=green>\n", BBSNAME, currentuser.userid);
        if(target[0]) {
                if(!strstr(target, "@")) {
                        if(!getuser(target))
                                http_fatal("错误的使用者帐号");
                        strcpy(target, getuser(target)->userid);
                }
                return do_fwd(x, board, target);
        }
        printf("<table><tr><td>\n");
        printf("文章标题: %s<br>\n", nohtml(x->title));
        printf("文章作者: %s<br>\n", x->owner);
        printf("原讨论区: %s<br>\n", board);
        printf("<form action=bbsfwd method=post>\n");
        printf("<input type=hidden name=board value=%s>", board);
        printf("<input type=hidden name=file value=%s>", file);
        printf("把文章转寄给 <input name=target size=30 maxlength=30 value=%s> (请输入对方的id或email地址). <br>\n",
               currentuser.email);
        printf("<input type=submit value=确定转寄></form>");
}
Beispiel #7
0
int
do_del(char *board, char *file)
{
	FILE *fp;
	int num = 0, filetime;
	char path[256], buf[256], dir[256], *id = currentuser.userid;
	struct fileheader f;
	filetime = atoi(file + 2);
	sprintf(dir, "boards/%s/.DIR", board);
	sprintf(path, "boards/%s/%s", board, file);
	fp = fopen(dir, "r");
	if (fp == 0)
		http_fatal("错误的参数");
	while (1) {
		if (fread(&f, sizeof (struct fileheader), 1, fp) <= 0)
			break;
		if (f.filetime == filetime) {
			del_record(dir, sizeof (struct fileheader), num);
			cancelpost(board, id, &f, !strcmp(id, f.owner));
			updatelastpost(board);
			fclose(fp);
			printf("<tr><td>%s  <td>标题:%s <td>删除成功.\n",
			       fh2owner(&f), nohtml(f.title));
			snprintf(buf, 256, "%s del %s %s %s",
				 currentuser.userid, board, fh2owner(&f),
				 f.title);
			newtrace(buf);
			return 0;
		}
		num++;
	}
	fclose(fp);
	printf("<tr><td><td>%s<td>文件不存在.\n", file);
	return -1;
}
Beispiel #8
0
int main()
{
        int i;
        int shift=1;	//wzk
        char board[80];
        init_all();
        if(!loginok)
                http_fatal("您尚未登录, 请先登录");
        strsncpy(board, getparm("board"), 30);
        if(!has_read_perm(&currentuser, board))
                http_fatal("错误的讨论区");
        if(!has_BM_perm(&currentuser, board))
                http_fatal("你无权进行本操作");
        loaddenyuser(board);
        printf("<center>\n");
        printf("%s -- 被封用户名单 [讨论区: %s]<hr color=green><br>\n", BBSNAME, board);
        printf("本板共有 %d 人被封<br>", denynum);
        printf("<table border=0><tr class=title><td>序号<td>用户帐号<td>被封原因<td>原定解封日期<td>管理\n");
        for(i=0; i<denynum; i++) {
                printf("<tr><td>%d", i+1);
                printf("<td><a href=bbsqry?userid=%s>%s</a>", denyuser[i].id, denyuser[i].id);
                printf("<td>%s\n", nohtml(denyuser[i].exp));
                printf("<td>%s\n", denyuser[i].free_time);
                printf("<td>[<a onclick='return confirm(\"确实解封吗?\")' href=bbsdenydel?board=%s&userid=%s>解封</a>]",
                       board, denyuser[i].id);
        }
        printf("</table><hr color=green>\n");
        printf("[<a href=bbsdenyadd?board=%s>设定新的不可POST用户</a>]</center>\n", board);
        http_quit();
}
Beispiel #9
0
int
bbsfall_main()
{
	int i;
	html_header(1);
	check_msg();
	if (!loginok || isguest)
		http_fatal("дЗипн╢╣гб╪, гКох╣гб╪");
	changemode(GMENU);
	loadfriend(currentuser->userid);
	printf("<body><center>\n");
	printf("%s -- ╨цсяцШ╣╔ [й╧сцуъ: %s]<hr><br>\n", BBSNAME,
	       currentuser->userid);
	printf("дЗ╧╡иХ╤╗ак %d н╩╨цся<br>", friendnum);
	printf
	    ("<table border=1><tr><td>пР╨е</td><td>╨цся╢З╨е</td><td>╨цсяк╣цВ</td><td>и╬ЁЩ╨цся</td></tr>");
	for (i = 0; i < friendnum; i++) {
		printf("<tr><td>%d</td>", i + 1);
		printf("<td><a href=bbsqry?userid=%s>%s</a></td>", fff[i].id,
		       fff[i].id);
		printf("<td>%s</td>\n", nohtml(fff[i].exp));
		printf
		    ("<td>[<a onclick='return confirm(\"х╥й╣и╬ЁЩбП?\")' href=bbsfdel?userid=%s>и╬ЁЩ</a>]</td></tr>",
		     fff[i].id);
	}
	printf("</table><hr>\n");
	printf("[<a href=bbsfadd>лМ╪спб╣д╨цся</a>]</center></body>\n");
	http_quit();
	return 0;
}
Beispiel #10
0
void
showmyclasssetting()
{
	struct brcinfo *brcinfo;
	char *myclass, *myclasstitle;
	char *(titlelist[]) = {
	"版面标题", "我的班级", "我的院系", "我的学校", NULL};
	int i;
	printf
	    ("<script>function search(){\n"
	     "newwindow=open('bbssearchboard?element=sel.myclass.value&match='+document.sel.myclass.value,\n"
	     "'', 'width=600,height=460,resizable=yes,scrollbars=yes');\n"
	     "if(newwindow.opener==null) newwindow.opener=self;"
	     "}\n"
	     "function settitle(v) {document.sel.myclasstitle.value=v;}</script>");
	printf("<center>选择在 WWW 底栏显示的版面<br><br>");
	myclass = getparm("myclass");
	myclasstitle = getparm("myclasstitle");
	if (!myclass[0]) {
		brcinfo = brc_readinfo(currentuser->userid);
		myclass = brcinfo->myclass;
		myclasstitle = brcinfo->myclasstitle;
		if (!myclasstitle[0])
			myclasstitle = "版面标题";
	}
	printf
	    ("<table><tr><td><form name='sel' action=bbsmyclass method=post>"
	     "版面名称:<input type=text name=myclass value='%s'> "
	     "<a href='javascript:search()'>搜索</a><br>",
	     void1(nohtml(myclass)));
	printf
	    ("显示为:<input type=text name=myclasstitle value='%s'>&nbsp;&nbsp;",
	     void1(nohtml(myclasstitle)));
	for (i = 0; titlelist[i]; i++) {
		printf("<a href='javascript:settitle(\"%s\")'>%s</a> ",
		       titlelist[i], titlelist[i]);
	}
	printf("<input type=hidden name=submittype value=1>");
	printf
	    ("<br><center><input type=submit value='确定'></form></td></tr></table>");
#if 1
	printf
	    ("<br>没找到自己的学校?请到<a href=home?B=8admin>兄弟院校区区务管理</a>申请开版!"
	     "<br><br>没找到自己的班级?马上到<a href=home?B=L_admin>同学录区区务管理版</a>"
	     "或 (北京大学的系级) <a href=home?B=1admin>北京大学区区务管理版</a>申请开版!");
#endif
}
Beispiel #11
0
int
printPrevNext(struct Blog *blog, int n)
{
	if (blog->nIndex == 1)
		return 0;
	printf("<div class=prevnext>");
	if (n < blog->nIndex - 1)
		printf
		    ("<span class=postprev><a href=\"blogread?U=%s&amp;T=%d\">&lt; 上一篇 %s</a></span>",
		     blog->config->useridEN, blog->index[n + 1].fileTime,
		     nohtml(blog->index[n + 1].title));
	if (n)
		printf
		    ("<span class=postnext><a href=\"blogread?U=%s&amp;T=%d\">下一篇 %s &gt;</a></span>",
		     blog->config->useridEN, blog->index[n - 1].fileTime,
		     nohtml(blog->index[n - 1].title));
	printf("</div>");
	return 0;
}
Beispiel #12
0
static void
showlist_grouped(int needrss)
{
	int i;
	for (i = 0; i < sectree.nsubsec; i++) {
		printf("<b>%s</b>", nohtml(sectree.subsec[i]->title));
		printf("<hr>\n");
		showlist_alphabetical(sectree.subsec[i]->basestr, needrss);
	}
}
Beispiel #13
0
int do_fwd(struct fileheader *x, char *board, char *target)
{
        FILE *fp, *fp2;
        char title[512], buf[512], path[200], i;
        sprintf(path, "boards/%s/%s", board, x->filename);
        if(!file_exist(path))
                http_fatal("文件内容已丢失, 无法转寄");
        sprintf(title, "[转寄] %s", x->title);
        title[60]=0;
        post_mail(target, title, path, currentuser.userid, currentuser.username, fromhost, -1,1);
        printf("文章已转寄给'%s'<br>\n", nohtml(target));
        printf("[<a href='javascript:history.go(-2)'>返回</a>]");
}
Beispiel #14
0
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;
}
Beispiel #15
0
int
showsechead2009(const struct sectree *sec)
{
	int i, pos;

	printf("\n<script language=\"javascript\">\n"
			"\tvar sectree = new Array(\n"
			"\t\tnew init_sec_tree(0, \"\", \"导读首页\", %d), \n", 
			sectree.nsubsec);
	pos = 0;
	for (i = 1; i <= sectree.nsubsec; i++) {
		if (sectree.subsec[i - 1] == sec)
			pos = i;
		printf("\t\tnew init_sec_tree(%d, \"%s\", \"%s\", %d), \n", 
				i, sectree.subsec[i - 1]->basestr, 
				nohtml(sectree.subsec[i - 1]->title), 
				sectree.subsec[i - 1]->nsubsec);
	}
	printf("\t\tnew init_sec_tree(-1, \".\", \".\", 0)\n\t);\n"
			"\tshow_sec_head(%d);\n</script>\n\n", pos);
	/*printf("<table border=0 class=colortb1><tr>");
	if (sec == &sectree)
		printf("<td align=center class=f1><b>首页导读</b>&nbsp;</td>");
	else
		printf
		    ("<td align=center class=f1><a href=boa?secstr=? class=blk>%s</a>&nbsp;</td>",
		     nohtml(sectree.title));
	ntr = sectree.nsubsec / 9 + 1;
	for (i = 0; i < sectree.nsubsec; i++) {
		sec1 = sectree.subsec[i];
		if (sec1 == sec)
			printf
			    ("<td align=center class=f1><b>%s</b>&nbsp;</td>",
			     nohtml(sec1->title));
		else if (sec1 == sec2)
			printf
			    ("<td align=center class=f1><b><a href=boa?secstr=%s class=blk>%s</a></b>&nbsp;</td>",
			     sec1->basestr, nohtml(sec1->title));
		else
			printf
			    ("<td align=center class=f1><a href=boa?secstr=%s class=blk>%s</a>&nbsp;</td>",
			     sec1->basestr, nohtml(sec1->title));
		if (i != sectree.nsubsec - 1
		    && (i + 2) % (sectree.nsubsec / ntr + 1) == 0)
			printf("</tr><tr>");
	}
	printf("</tr></table>");*/
	return 0;
}
Beispiel #16
0
void
printsectree(const struct sectree *sec)
{
	int i;
	for (i = 0; i < sec->nsubsec; i++) {
#if 0
		if (sec->subsec[i]->nsubsec)
			continue;
#endif
		printf("&nbsp; <a target=_top href=boa?secstr=%s>"
		       "%s%c</a><br>\n", sec->subsec[i]->basestr,
		       nohtml(sec->subsec[i]->title),
		       sec->subsec[i]->nsubsec ? '+' : ' ');
	}
}
Beispiel #17
0
int main()
{
        char *board, buf[80], *board1, *title;
        int i, total=0;
        init_all();
        modify_mode(u_info,SELECT+20000);	//bluetent
        board=nohtml(getparm("board"));
        if(board[0]==0) {
                printf("%s -- 选择讨论区<hr color=green>\n", BBSNAME);
                printf("<form name=sel action=bbssel>\n");
                printf("讨论区名称: <input type=text name=board>");
                printf(" <input type=submit value=确定><br><br> 如果输入一部分板面名称,系统会为您自动选择");
                printf("</form><script language=javascript>sel.board.focus()</script>\n");
                http_quit();
        } else {
                for(i=0; i<MAXBOARD; i++) {
                        board1=shm_bcache->bcache[i].filename;
                        if(!has_read_perm(&currentuser, board1))
                                continue;
                        if(!strcasecmp(board, board1) && !(shm_bcache->bcache[i].flag & ZONE_FLAG)) {
                                sprintf(buf, "bbs%sdoc?board=%s", (currentuser.userdefine & DEF_THESIS)?"t":"", board1);
                                redirect(buf);
                                http_quit();
                        }
                }
                printf("%s -- 选择讨论区<hr color=green>\n", BBSNAME);
                //		printf("找不到这个讨论区, ", board);
                printf("标题中含有'%s'的讨论区有: <br><br>\n", board);
                printf("<table>");
                for(i=0; i<MAXBOARD; i++) {
                        board1=shm_bcache->bcache[i].filename;
                        title=shm_bcache->bcache[i].title;
                        if(!has_read_perm(&currentuser, board1))
                                continue;
                        if(!(shm_bcache->bcache[i].flag & ZONE_FLAG) && (strcasestr(board1, board) || strcasestr(title, board))) {
                                total++;
                                printf("<tr><td>%d", total);
                                printf("<td><a href=bbs%sdoc?board=%s>%s</a><td>%s<br>\n", (currentuser.userdefine & DEF_THESIS)?"t":"",
                                       board1, board1, title+7);
                                sprintf(buf, "bbs%sdoc?board=%s", (currentuser.userdefine & DEF_THESIS)?"t":"", board1);
                        }
                }
                if (total==1)
                        redirect(buf);
                printf("</table><br>\n");
                printf("共找到%d个符合条件的讨论区.\n", total);
        }
}
Beispiel #18
0
int
do_set(char *dirptr, int size, char *file, int flag, char *board)
{
	char path[256], buf[256];
	struct fileheader *f;
	int om, og, nm, ng, filetime;
	int start;
	int total = size / sizeof(struct fileheader);
	filetime = atoi(file + 2);
	sprintf(path, "boards/%s/%s", board, file);

	start = Search_Bin(dirptr, filetime,0 , total - 1);
	if (start >= 0) {
		f = (struct fileheader*)(dirptr + start * sizeof(struct fileheader));
		om = f->accessed & FH_MARKED;
		og = f->accessed & FH_DIGEST;
		f->accessed |= flag;
		if (flag == 0) 
			f->accessed = 0;
		nm = f->accessed & FH_MARKED;
		ng = f->accessed & FH_DIGEST;
		printf("<tr><td>%s<td>标题:%s<td>标记成功.\n",
		       fh2owner(f), nohtml(f->title));
		buf[0] = 0;
		if ((!om) && (nm))
			snprintf(buf, 256, "%s mark %s %s %s",
				 currentuser.userid, board,
				 fh2owner(f), f->title);
		if ((om) && (!nm))
			snprintf(buf, 256, "%s unmark %s %s %s",
				 currentuser.userid, board,
				 fh2owner(f), f->title);
		if ((!og) && (ng))
			snprintf(buf, 256, "%s digest %s %s %s",
				 currentuser.userid, board,
				 fh2owner(f), f->title);
		if ((og) && (!ng))
			snprintf(buf, 256, "%s undigest %s %s %s",
				 currentuser.userid, board,
				 fh2owner(f), f->title);
		if (buf[0] != 0)
			newtrace(buf);
		return 0;
	}
	printf("<td><td><td>%s<td>文件不存在.\n", file);
	return -1;
}
Beispiel #19
0
int main()
{
        char word[80], buf[256];
        int type;
        int has=1;	//wzk
        init_all();
        modify_mode(u_info,DICT+20000);	//bluetent
        type=atoi(getparm("type"));
        strcpy(word, getparm("word"));
        printf("%s -- 字典查询<hr color=green>\n", BBSNAME);
        if(type==0 || word[0]==0) {
                printf("<form name=dict method=post action=bbsdict?type=1><pre>\n");
                hprintf("本字典 CDICT5.0 收录单词近 40000 , 一般较常见的单词和缩写均已收录,\n");
                printf("中英文输入均可, 支持'*'后缀通配符.\n\n");
                printf("请输入要查询的中英文单词: <input type=text name=word>\n");
                printf("<input type=submit>\n");
                printf("</pre></form><script language=javascript>dict.word.focus()</script>\n");
        } else {
                char file[80];
                FILE *fp;
                printf("查询单词: [%s]<br>\n", nohtml(word));
                sprintf(file, "tmp/%d.tmp", getpid());
                check(word);
                sprintf(buf, "bin/dict '%s' > %s", word, file);
                system(buf);
                fp=fopen(file, "r");
                if(fp==0)
                        http_fatal("内部错误");

                printf("<table width=610 border=0><tr><td><pre>\n");
                fgets(buf, 255, fp);		//wzk
                printf("<br>");			//wzk
                while(1) {
                        if(fgets(buf, 255, fp)==0) {
                                if (has)
                                        printf("单词\"%s\"没有找到", word);
                                break;
                        }
                        has=0;		//wzk
                        hprintf("%s", buf);
                }
                printf("</pre></table>");
                unlink(file);
        }
        check_msg();//bluetent 2002.10.31
        http_quit();
}
Beispiel #20
0
int
showhotboard(const struct sectree *sec, char *s)
{
	int count = 0, i, j, len, max;
	struct boardmem *bmem[MAXBOARD], *x, *x1;
	max = atoi(s);
	if (max < 3 || max > 30)
		max = 10;
	len = strlen(sec->basestr);
	for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) {
		x = &(shm_bcache->bcache[i]);
		if (x->header.filename[0] <= 32 || x->header.filename[0] > 'z')
			continue;
		if (hideboard_x(x))
			continue;
		if (strncmp(sec->basestr, x->header.sec1, len) &&
		    strncmp(sec->basestr, x->header.sec2, len))
			continue;
		for (j = 0; j < count; j++) {
			if (x->score > bmem[j]->score)
				break;
			if (x->score == bmem[j]->score
			    && x->inboard > bmem[j]->inboard) break;
		}
		for (; j < count; j++) {
			x1 = bmem[j];
			bmem[j] = x;
			x = x1;
		}
		if (count < max)
			bmem[count++] = x;
	}
	printf
	    ("<table width=588 border=1><tr><td bgcolor=%s width=55 align=center>热门讨论区推荐</td><td>",
	     currstyle->colortb1);
	for (i = 0; i < count; i++) {
		if (i)
			printf("%s", " &nbsp;");
		printf("<a href=%s%s class=pur><u>%s</u></a>",
		       showByDefMode(),
		       bmem[i]->header.filename,
		       void1(nohtml(bmem[i]->header.title)));
	}
	printf("</td></tr></table>");
	return 0;
}
Beispiel #21
0
int
bbssel_main()
{
    char *board, buf[80], *board1, *title;
    int i, total = 0;
    html_header(1);
    check_msg();
    changemode(SELECT);
    board = nohtml(getparm("board"));
    if (board[0] == 0) {
        printf("%s -- 选择讨论区<hr>\n", BBSNAME);
        printf("<form action=bbssel>\n");
        printf("讨论区名称: <input type=text name=board>");
        printf(" <input type=submit value=确定>");
        printf("</form>\n");
        http_quit();
    } else {
        struct boardmem *x;
        x = getboard(board);
        if (x) {
            sprintf(buf, "%s%s", showByDefMode(), x->header.filename);
            redirect(buf);
            http_quit();
        }
        printf("%s -- 选择讨论区<hr>\n", BBSNAME);
        printf("找不到这个讨论区, ", board);
        printf("标题中含有'%s'的讨论区有: <br><br>\n", board);
        printf("<table>");
        for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) {
            board1 = shm_bcache->bcache[i].header.filename;
            title = shm_bcache->bcache[i].header.title;
            if (!has_read_perm(&currentuser, board1))
                continue;
            if (strcasestr(board1, board)
                    || strcasestr(title, board)) {
                total++;
                printf("<tr><td>%d", total);
                printf
                ("<td><a href=%s%s>%s</a><td>%s<br>\n",
                 showByDefMode(), board1, board1, title + 7);
            }
        }
        printf("</table><br>\n");
        printf("共找到%d个符合条件的讨论区.\n", total);
    }
}
Beispiel #22
0
int
bbssearchboard_main()
{
	char *element, *match, *ptr;
	element = getparm("element");
	match = getparm("match");
	html_header(1);
	printf("<script src=" BBSJS "></script>\n");
	//check_msg();
	if (!*element && strlen(match) > 3 && match[0] == '/' && 
			match[2] == ' ') {
		if ((ptr = strchr(match, '.')))
			*ptr = ' ';
		if ((ptr = strchr(match, '\'')))
			*ptr = ' ';
		switch (match[1]) {
#ifdef ENABLE_BLOG
			case 'b':
			case 'B':
				printf("<script>this.location.replace"
					"('blog?U=%s');</script>", match + 3);
				break;
#endif
			case 't':
			case 'T':
				printf("<script>this.location.replace"
					"('qry?U=%s');</script>", match + 3);
				break;
		}
	}
	if (*element) {
		printf("<script>\n"
		       "function setEl(value) {opener.document.%s=value;window.close();}\n"
		       "</script>\n", element);
	} else {
		printf("<script>\n"
		       "function setEl(value) {location.href='home?B='+value;}\n"
		       "</script>");
	}
	printf("<form>°æÃæËÑË÷£º<input type=text value='%s' name=match> "
	       "<input type=hidden name=element value='%s'>"
	       "<input type=submit value=ËÑË÷></form>", nohtml(match), element);
	searchlist_grouped(match, *element ? 0 : 1);
	return 0;
}
Beispiel #23
0
static void
printPostTitleList(struct Blog *blog)
{
	struct BlogHeader* blh;
	//char buf[80] = {0};
	int i;

	printf("<b>文章列表</b><br>");
	printf("<div class=post>");
	printf("文章总数: %d 篇<br >", blog->nIndex);

	for (i = blog->nIndex; i > 0; --i) {
		blh = &blog->index[i-1];
		printf("<li>");
		printf("<a href=\"blogread?U=%s&amp;T=%d\">%s</a>",
			blog->config->useridEN, (int)blh->fileTime, nohtml(blh->title));
		printf("</li>");
	}

	printf("</div>");
}
Beispiel #24
0
int do_del(char * file) {
    FILE *fp;
    struct fileheader f;
    char path[80], *id,buf[256];

    int num=0;
    if(loginok == 0) http_fatal("您尚未登录");
    id=currentuser.userid;
    if((strncmp(file, "M.", 2) || strstr(file, "..")) && file[0] != 's') http_fatal("错误的参数");
    if(file[0] == 's') //e.g.: sharedmail%2Fmailall.Ashinmarch.120623541   %2F表示'/'
    {
        strncpy(buf, file, 10);
        buf[10] = 0;
        strcat(buf, "/");
        strcat(buf, file + 13);
        strcpy(file, buf);
    }
    sprintf(path, "mail/%c/%s/.DIR", toupper(id[0]), id);
    fp=fopen(path, "r");
    if(fp==0) http_fatal("错误的参数2");
    while(1) {
        if(fread(&f, sizeof(f), 1, fp)<=0) break;
        //added by iamfat 2002.08.10
        //check_anonymous(f.owner);
        //added end.
        num++;
        if(!strcmp(f.filename, file)) {
            fclose(fp);
            del_record(path, sizeof(struct fileheader), num-1);
            sprintf(path, "mail/%c/%s/%s", toupper(id[0]), id, f.filename);
            unlink(path);

            printf("<tr><td>%s  <td>标题:%s <td>删除成功.\n", f.owner, nohtml(f.title));

            return 0;
        }
    }
    fclose(fp);
    http_fatal("信件不存在, 无法删除");
}
Beispiel #25
0
static int
upload_getpathsize(char *path, int showlist)
{
	DIR *pdir;
	struct dirent *pdent;
	char fname[1024];
	int totalsize = 0, size;
	if (showlist)
		printf("已经上载的附件有:<br>");
	pdir = opendir(path);
	if (!pdir)
		return -1;
	while ((pdent = readdir(pdir))) {
		if (!strcmp(pdent->d_name, "..") || !strcmp(pdent->d_name, "."))
			continue;
		if (strlen(pdent->d_name) + strlen(path) >= sizeof (fname)) {
			totalsize = -1;
			break;
		}
		sprintf(fname, "%s/%s", path, pdent->d_name);
		size = file_size(fname);
		if (showlist) {
			printf("<li> %s (<i>%d字节</i>) ", pdent->d_name, size);
			printf("<a href=\"bbsupload?del=%s\">删除</a>",
			       nohtml(pdent->d_name));
		}
		if (size < 0) {
			totalsize = -1;
			break;
		}
		totalsize += size;
	}
	closedir(pdir);
	if (showlist) {
		printf("<br>已经上载 %d 字节 (最多 %d 字节)<br>", totalsize,
		       MAXATTACHSIZE);
	}
	return totalsize;
}
Beispiel #26
0
int
read_submit()
{
	int i;
	char buf1[200];
	FILE *fp;
	struct boardmem *x;
	mybrdnum = 0;
	if (!strcmp(getparm("confirm1"), ""))
		http_fatal("参数错误");
	for (i = 0; i < parm_num; i++) {
		if (!strcasecmp(parm_val[i], "on")) {
			if (ismybrd(parm_name[i]))
				continue;
			if (mybrdnum >= GOOD_BRC_NUM)
				http_fatal("您试图预定超过%d个讨论区",
					   GOOD_BRC_NUM);
			if (!(x = getboard(parm_name[i]))) {
				printf("警告: 无法预定'%s'讨论区<br>\n",
				       nohtml(parm_name[i]));
				continue;
			}
			strsncpy(mybrd[mybrdnum], parm_name[i],
				 sizeof (mybrd[0]));
			mybrdnum++;
		}
	}
	sethomefile(buf1, currentuser.userid, ".goodbrd");
	fp = fopen(buf1, "w");
	for (i = 0; i < mybrdnum; i++)
		fprintf(fp, "%s\n", mybrd[i]);
	fclose(fp);
	saveuservalue(currentuser.userid, "mybrdmode", getparm("mybrdmode"));
	printf
	    ("<script>top.f2.location='bbsleft?t=%ld'</script>修改预定讨论区成功,您现在一共预定了%d个讨论区:<hr>\n",
	     now_t, mybrdnum);
	printf("[<a href='javascript:history.go(-2)'>返回</a>]");
	return 0;
}
Beispiel #27
0
int
blogatom_main()
{
	char userid[IDLEN + 1];
	struct Blog blog;
	int n, i;

	printf("Content-type: text/xml; charset=utf-8\r\n\r\n");
	printf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
	       "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:lang=\"zh-CN\">");

	strsncpy(userid, getparm2("U", "userid"), sizeof (userid));
	if (openBlog(&blog, userid) < 0) {
		printf("<title>该 Blog 尚不存在</title>");
		printf("<link href=\"http://" MY_BBS_DOMAIN "\" />");
		goto END;
	}
	printf("<id>%s</id>", makeTag(&blog, NULL));
	printf("<title>%s</title>", nohtml(blog.config->title));
	printf("<link href=\"blog?U=%s\" />", blog.config->useridEN);
	printf("<link rel=\"self\" href=\"blogatom?U=%s\" />",
	       blog.config->useridEN);
	printf("<author><name>%s</name></author>", blog.config->useridUTF8);
	printf("<updated>%s</updated>", atomctime(&blog.indexFile.mtime));
	//tagline...
	//id...
	//generator...

	for (i = blog.nIndex - 1, n = 0; i >= 0 && n < 30; i--) {
		if (now_t - blog.index[i].fileTime > 7 * 24 * 3600 && n > 10)
			break;
		printEntry(&blog, i);
	}

	closeBlog(&blog);
      END:
	printf("</feed>");
	return 0;
}
Beispiel #28
0
static void
printEntry(struct Blog *blog, int i)
{
	struct BlogHeader *blh;
	char buf[256];
	blh = &blog->index[i];
	printf("<entry>");
	printf("<title>%s</title>", nohtml(blh->title));
	printf("<link href=\"blogread?U=%s&amp;T=%d\" />",
	       blog->config->useridEN, (int) blh->fileTime);
	printf("<id>%s</id>", makeTag(blog, &blh->fileTime));
	printf("<updated>%s</updated>", atomctime(&blh->fileTime));

	//printf("<author><name>%s</name></author>", blog->config->useridUTF8);
	//printf("<issued>%s</issued>", gmtctime(&blh->fileTime));
	/*
	   for (i = 0; i < blog->nTag; i++) {
	   if (!*blog->tag[i].title || !blog->tag[i].count
	   || blog->tag[i].hide)
	   continue;
	   printf("<category>%s</category>", nohtml(blog->tag[i].title));
	   } */

	printf("<summary type=\"html\"><![CDATA[");
	if (blh->hasAbstract) {
		setBlogAbstract(buf, blog->userid, blh->fileTime);
		showfile(buf);
		printf
		    ("<br /><a href=\"blogread?U=%s&amp;T=%d\">(继续阅读...)</a>",
		     blog->config->useridEN, (int) blh->fileTime);
	} else {
		setBlogPost(buf, blog->userid, blh->fileTime);
		showfile(buf);
	}
	printf("]]></summary>");
	printf("</entry>");
}
Beispiel #29
0
int main()
{
        int i;
        init_all();
        modify_mode(u_info,FRIEND+20000);	//bluetent
        if(!loginok)
                http_fatal("дЗипн╢╣гб╪, гКох╣гб╪");
        loadfriend(currentuser.userid);
        printf("<center>\n");
        printf("%s -- ╨цсяцШ╣╔ [й╧сцуъ: %s]<hr color=green><br>\n", BBSNAME, currentuser.userid);
        printf("дЗ╧╡иХ╤╗ак %d н╩╨цся<br>", friendnum);
        printf("<table border=1><tr><td>пР╨е<td>╨цся╢З╨е<td>╨цсяк╣цВ<td>и╬ЁЩ╨цся");
        for(i=0; i<friendnum; i++) {
                printf("<tr><td>%d", i+1);
                printf("<td><a href=bbsqry?userid=%s>%s</a>", fff[i].id, fff[i].id);
                printf("<td>%s\n", nohtml(fff[i].exp));
                printf("<td>[<a onclick='return confirm(\"х╥й╣и╬ЁЩбП?\")' href=bbsfdel?userid=%s>и╬ЁЩ</a>]", fff[i].id);
        }
        printf("</table><hr color=green>\n");
        printf("[<a href=bbsfadd>лМ╪спб╣д╨цся</a>]</center>\n");
        //	for(i=0;i<friendnum2;i++)
        //		printf("%d ", u_info->friend[i]);
        http_quit();
}
Beispiel #30
0
int
showsechead(const struct sectree *sec)
{
	const struct sectree *sec1, *sec2;
	int i;
	sec2 = sec;
	while (sec2->parent && !sec2->introstr[0])
		sec2 = sec2->parent;
	printf("<table border=1 bgcolor=%s><tr>", currstyle->colortb1);
	if (sec == &sectree)
		printf("<td align=center>&nbsp;<b>%s</b>&nbsp;</td>",
		       nohtml(sectree.title));
	else if (sec2 == &sectree)
		printf
		    ("<td align=center>&nbsp;<b><a href=boa?secstr=?>%s</a></b>&nbsp;</td>",
		     nohtml(sectree.title));
	else
		printf
		    ("<td align=center>&nbsp;<a href=boa?secstr=?>%s</a>&nbsp;</td>",
		     nohtml(sectree.title));
	for (i = 0; i < sectree.nsubsec; i++) {
		sec1 = sectree.subsec[i];
		if (!sec1->introstr[0])
			continue;
		if (sec1 == sec)
			printf("<td align=center>&nbsp;<b>%s</b>&nbsp;</td>",
			       nohtml(sec1->title));
		else if (sec1 == sec2)
			printf
			    ("<td align=center>&nbsp;<b><a href=boa?secstr=%s>%s</a></b>&nbsp;</td>",
			     sec1->basestr, nohtml(sec1->title));
		else
			printf
			    ("<td align=center>&nbsp;<a href=boa?secstr=%s>%s</a>&nbsp;</td>",
			     sec1->basestr, nohtml(sec1->title));
	}
	printf("</tr></table>");
	return 0;
}