示例#1
0
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;
}
示例#2
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;
}
示例#3
0
int show_file(char *board, struct fileheader *x, int n)
{
        FILE *fp;
        char path[80], buf[512];
        if(loginok)
                brc_add_read(x->filename);
        sprintf(path, "boards/%s/%s", board, x->filename);
        fp=fopen(path, "r");
        if(fp==0)
                return;
        printf("<table width=600  style='BORDER: 1px solid; BORDER-COLOR: 65c8aa;'  cellpadding=4 cellspacing=0  align=center><tr><td>\n");
        printf("[<a href=bbscon?board=%s&file=%s&num=%d>本篇全文</a>] ", board, x->filename, n);
        printf("[<a href='bbspst?board=%s&file=%s&title=%s&userid=%s'>回复本文</a>] ",
               board, x->filename, x->title, x->owner);
        printf("[本篇作者: %s] ", userid_str(x->owner));
        printf("<a href=bbsdoc?board=%s>本讨论区</a>",board);
        printf("</td></tr><tr><td style='font-size:14px'><pre>\n");
        while(1)
        {
                /*
                if(fgets(buf, 500, fp)==0) break;
                if(!strncmp(buf, ": ", 2)) continue;
                if(!strncmp(buf, "【 在 ", 4)) continue;
                //		if(!strncmp(buf, "--", 2)) break;
                hhprintf("%s", buf);
                 */
                if(fgets(buf, 500, fp)==0)
                        break;
                if(!strcmp(board,"Pictures") || !strcmp(board,"SelfPhoto") ) {
                        if(!strncmp(buf, ": ", 2))
                                continue;
                        if(!strncmp(buf, "【 在 ", 4))
                                continue;
                        if(!strncmp(buf, "--", 2))
                                break;
                        hhprintf("%s", buf);
                        continue;
                }
                if(!strncmp(buf, ": ", 2))
                        printf("<font color=808080>");
                hhprintf("%s", buf);
                if(!strncmp(buf, ": ", 2))
                        printf("</font>");

        }
        fclose(fp);
        printf("</table></pre>");
        //	printf("<table width=100%% bgcolor=#65c8aa border=0 cellpadding=0 cellspacing=0 height=1><tr><td></table>");
        return 1;
}
示例#4
0
int
oneboardscript(struct boardmem *brd)
{
	char bmbuf[IDLEN * 4 + 4], *ptr;
	int i, limit, brdnum, hasicon;
	struct boardaux *boardaux = getboardaux(getbnumx(brd));
	updatewwwindex(brd);
	brdnum = getbnumx(brd);
	hasicon = brd->wwwicon;
	if (hasicon)
		hasicon += hideboard_x(brd) ? 1 : 0;
	printf("new abrd(%d,'%s','%s',%d,%d,%d,%d,%d,",
	       brdnum, brd->header.filename, scriptstr(brd->header.title),
	       hasicon, brd->total, brd->score,
	       (brd->header.flag & VOTE_FLAG) ? 1 : 0,
	       (brd->header.
		level & PERM_POSTMASK) ? 2 : ((brd->header.
					       flag & CLOSECLUB_FLAG) ? 1 : 0));

	ptr = userid_str(bm2str(bmbuf, &(brd->header)));
	if (!*ptr)
		printf("'ипнч╟ФжВ',");
	else
		printf("'%s',", ptr);
	printf("'%s ',", scriptstr(boardaux->intro));
	limit = 8;
	if ((ptr = strstr(brd->header.filename, "admin"))) {
		if (strlen(ptr) == 5)
			limit = 4;
	}
	if ((brd->header.flag & CLOSECLUB_FLAG))
		printf("''");
	else {
		limit = min(limit, boardaux->nlastmark);
		printf("new Array(");
		for (i = 0; i < limit; i++) {
			struct lastmark *lm = &boardaux->lastmark[i];
			printf("new alm(%d,'%s','%s',%d)",
			       lm->thread, scriptstr(lm->title), 
			       lm->authors, lm->marked ? 1 : 0);
			if (i < limit - 1)
				printf(",");
		}
		printf(")");
	}
	printf(")");
	return 0;
}
示例#5
0
int
bbsbkndoc_main()
{
	FILE *fp;
	char board[80], bkn[80], dir[160], *ptr, genbuf[STRLEN];
	struct boardmem *x1;
	struct fileheader x;
	int i, start, total;
	html_header(1);
	printf("<script src=" BBSJS "></script>\n");
	changemode(BACKNUMBER);
	//check_msg();
	getparmboard(board, sizeof(board));
	strsncpy(bkn, getparm("bkn"), 32);
	ptr = bkn;
	while (*ptr) {
		if (*ptr != 'B' && *ptr != '.' && !isdigit(*ptr))
			http_fatal("错误的过刊号");
		ptr++;
	}
	if (strlen(bkn) < 3)
		http_fatal("错误的过刊号");

	x1 = getboard(board);
	if (x1 == 0)
		nosuchboard(board, "bbsbkndoc");
	else {
		updateinboard(x1);
		strcpy(board, x1->header.filename);
		sprintf(dir, "boards/.backnumbers/%s/%s", board, bkn);
		if (!file_exist(dir))
			http_fatal("没有这卷过刊");
		sprintf(dir, "boards/.backnumbers/%s/%s/.DIR", board, bkn);
		fp = fopen(dir, "r");
		total = file_size(dir) / sizeof (struct fileheader);
		start = getdocstart(total, w_info->t_lines);
		printf("<body topmargin=0>");
		printf("<nobr><center>\n");
		sprintf(genbuf, "阅览过刊 文章数[%d]", total);
		printboardtop(x1, 5, genbuf);
		if (total <= 0)
			http_fatal("本卷过刊目前没有文章");
		printf("<table cellSpacing=0 cellPadding=2>\n");
		printf
		    ("<tr class=docbgcolor><td>序号<td>状态<td>作者<td>日期<td>标题<td>星级<td>评价</td>\n");
		if (fp) {
			fseek(fp, (start - 1) * sizeof (struct fileheader),
			      SEEK_SET);
			for (i = 0; i < w_info->t_lines; i++) {
				char filename[255];
				char *ptr;
				if (fread(&x, sizeof (x), 1, fp) <= 0)
					break;
				if (x.accessed & FH_HIDE) {
					printf
					    ("<tr><td>%d<td>&nbsp;<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;
}
示例#6
0
文件: bbsgdoc.c 项目: bmybbs/bmybbs
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("文章数&lt;%d&gt; 在线&lt;%d&gt;</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\">&nbsp;</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\">&nbsp;</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("文章数&lt;%d&gt; 在线&lt;%d&gt;</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;
}
示例#7
0
文件: bbssbs.c 项目: bmybbs/bmybbs
int
bbssbs_main()
{	
	int result[MAXBOARD], i, total=0;
	char keyword[80], *ptr, buf[128], bmbuf[(IDLEN + 1) * 4];
	struct boardmem *bp;
	
	html_header(1);
	check_msg();
	changemode(READING);
	strsncpy(keyword, getparm("keyword"), 32);
	printf("<body><center>");
	printf("<div class=rhead>%s -- 超级版面选择</div><hr>\n", BBSNAME);
	
	if (strlen(strtrim(keyword))) { 
		for (i = 0; i < shm_bcache->number && total < MAXBOARD ; i++){
			if (shm_bcache->bcache[i].header.filename[0] == '\0')
				continue;
			if (has_read_perm_x(&currentuser, &(shm_bcache->bcache[i].header))) {
				if (strcasestr(shm_bcache->bcache[i].header.filename, keyword) 
				 || strcasestr(shm_bcache->bcache[i].header.keyword, keyword) 
				 || strcasestr(shm_bcache->bcache[i].header.title, keyword) ){
					result[total] = i;
					total++;
				}
			}
		}
		if (total == 0){
			printf("Sorry,我真的帮你找了,没找到符合条件的讨论区啊!");
			printf("<p><a href=javascript:history.go(-1)>快速返回</a>");
			http_quit();
/*			
		}else if (total == 1){
			sprintf(buf, "%s?board=%s", "bbshome", shm_bcache->bcache[result[0]].header.filename);
			redirect(buf);
*/
		}else {
			printf("<table width=\"100%\" border=0 cellpadding=0 cellspacing=0><tr>\n"
				"<td width=40>&nbsp;</td>\n"
				"<td colspan=2 class=\"level1\"><TABLE width=\"90%\" border=0 cellPadding=2 cellSpacing=0>\n"
				"<TBODY>\n");
			printf("<TR>\n"
				"<TD class=tdtitle>未</TD>\n"
				"<TD class=tduser>讨论区名称</TD>\n"
				"<TD class=tdtitle>V</TD>\n"
				"<TD class=tdtitle>类别</TD>\n"
				"<TD class=tdtitle>中文描述</TD>\n"
				"<TD class=tdtitle>版主</TD>\n"
				"<TD class=tdtitle>文章数</TD>\n"
				"<TD class=tdtitle>人气</TD>\n"
				"<TD class=tdtitle>在线</TD>\n"
				"</TR>\n");
			//brc_initial(currentuser.userid, NULL);
			printf("<tr>\n");
			for (i = 0; i < total; i++){
				bp=&(shm_bcache->bcache[result[i]]);
				printf("<td class=tdborder>%s</td>\n", 
					board_read(bp->header.filename, bp->lastpost) ? "◇" : "◆");
				printf("<td class=tduser><a href=%s?B=%s >%s</a></td>\n",
					"bbsdoc", bp->header.filename, bp->header.filename);
				printf("<td class=tdborder>");
				if (bp->header.flag & VOTE_FLAG)
					printf("<a href=vote?B=%s>V</a>", bp->header.filename);
				else
					printf("&nbsp;");
				printf("</td>\n");
				printf("<td class=tdborder>[%4.4s]</td>\n", bp->header.type);
				printf("<td class=tdborder><a href=%s?B=%s>%s</a></td>\n",
					"bbshome",bp->header.filename, bp->header.title);
				ptr = userid_str(bm2str(bmbuf, &(bp->header)));
				if (strlen(ptr) == 0)
					printf("<td class=tdborder>诚征版主中</td>\n");
				else
					printf("<td class=tdborder>%s</td>\n", ptr);
				printf("<td class=tdborder>%d</td>\n"
					"<td class=tdborder>%d</td>\n"
					"<td class=tdborder>%d</td>\n</tr>\n",
					bp->total, bp->score, bp->inboard);
				setbfile(buf, bp->header.filename, "introduction");
				if (file_exist(buf)) { 
					printf("<tr><td>&nbsp;&nbsp;</td>\n"
						"<td class=tduser>版面简介: </td>\n"
						"<td class=tdborder colspan=7>"
						"<div title=\"本版关键字: %s\">\n", 
						bp->header.keyword[0] ? bp->header.keyword: "(暂无)");
					fshowcon(stdout, buf, 2);
					printf("</div></td></tr>\n");
				}
				printlastmark(bp->header.filename);
			}
			printf("</TR></TBODY></TABLE></td></tr></table>\n");
		}
	}
	printf("<br><form action=bbssbs>\n");
	printf
	    ("<div title=\"支持中英文版名/版面关键字定位至版面。例如,输入“铁路”可定位至traffic版。\">"
	    "<input name=keyword maxlength=20 size=20>\n");
	printf("<input type=submit value=开始搜索></div>\n");
	printf("</form><hr>\n");
	http_quit();
	return 0;	
}