Example #1
0
int bbsmybrd_main(void)
{
	if (!loginok)
		return BBS_ELGNREQ;
	int type = strtol(getparm("type"), NULL, 10);
	if (type != 0)
		return read_submit();

	// Read '.goodbrd'.
	char file[HOMELEN];
	sethomefile(file, currentuser.userid, ".goodbrd");
	mmap_t m;
	m.oflag = O_RDONLY;
	if (mmap_open(file, &m) < 0)
		return BBS_ENOFILE;
	struct goodbrdheader *iter, *end;
	int num = m.size / sizeof(struct goodbrdheader);
	if (num > GOOD_BRC_NUM)
		num = GOOD_BRC_NUM;
	end = (struct goodbrdheader *)m.ptr + num;

	// Print 'bid's of favorite boards.
	xml_header("bbs");
	printf("<bbsmybrd ");
	print_session();
	printf(" limit='%d'>", GOOD_BRC_NUM);
	for (iter = m.ptr; iter != end; iter++) {
		if (!gbrd_is_custom_dir(iter))
			printf("<my bid='%d'/>", iter->pos + 1);
	}
	mmap_close(&m);

	// Print all boards available.
	struct boardheader *b;
	for (int i = 0; i < MAXBOARD; i++) {
		b = bcache + i;
		if (b->filename[0] <= 0x20 || b->filename[0] > 'z')
			continue;
		if (!hasreadperm(&currentuser, b))
			continue;
		printf("<mbrd bid='%d' desc='%s' %s/>", i + 1, b->title + 11,
				is_board_dir(b) ? "dir='1'" : "");
	}
	printf("</bbsmybrd>");
	return 0;	
}
Example #2
0
int
bbsmybrd_main()
{	//modify by mintbaggio 20040829 for new www
	int type, mode, mybrdmode;
	char buf[80];
	html_header(1);
	check_msg();
	if (!loginok || isguest)
		http_fatal("尚未登录或者超时");
	changemode(ZAP);
	type = atoi(getparm("type"));
	if (type != 0) {
		read_submit();
		http_quit();
	}
	readmybrd(currentuser.userid);
	//printf("<style type=text/css>A {color: 000080} </style>\n");
	//printf("<body><center>\n");

	mode = atoi(getparm("mode"));
	if (mode == 2)
	{
		printf("<body leftmargin=0 topmargin=0>\n");
		printf("<table width=100%% border=0 cellpadding=0 cellspacing=0>\n"
		"<tr><td height=30 colspan=2></td>\n"
		"</tr><tr><td height=70 colspan=2>\n"
		"<table width=100%% height=100%% border=0 cellpadding=0 cellspacing=0 class=\"level2\">\n");
		printf("<tr>\n<td width=40 rowspan=2>&nbsp; </td>\n");
		printf("<td height=35> %s &gt; <span id=\"topmenu_b\">个人RSS订阅管理</span></td>\n", MY_BBS_NAME);
		printf("<tr>\n<td width=40 class=\"level1\">&nbsp;</td>\n"
		"<td class=\"level1\"><br>\n");
		showlist_grouped(1);
		printf("</td></tr></table></td></tr></table></body>\n");
		http_quit();
		return 0;
	}

	printf("<body leftmargin=0 topmargin=0>\n");
	printf("<table width=100%% border=0 cellpadding=0 cellspacing=0>\n"
		"<tr><td height=30 colspan=2></td>\n"
		"</tr><tr><td height=70 colspan=2>\n"
		"<table width=100%% height=100%% border=0 cellpadding=0 cellspacing=0 class=\"level2\">\n");
	printf("<tr>\n<td width=40 rowspan=2>&nbsp; </td>\n");
	//printf("<div class=rhead>个人预定讨论区管理(您目前预定了<span class=h11>%d</span>个讨论区,最多可预定<span class=h11>%d</span>个)</div><br>\n", mybrdnum, GOOD_BRC_NUM);
	printf("<td height=35> %s &gt; <span id=\"topmenu_b\">个人预定讨论区管理</span>\n", MY_BBS_NAME);
	printf("[ 目前预定: <span class=\"smalltext\">%d</span>个 | 最多预定:</b> <span class=\"smalltext\">%d</span>个 ]</td>\n"
		, mybrdnum, GOOD_BRC_NUM);
	printf("</tr>\n <td height=35 valign=top><a href=\"bbsmybrd?mode=0\" class=\"btnsubmittheme\">按字母顺序排列</a>\n"
		"<a href=\"bbsmybrd?mode=1\" class=\"btnsubmittheme\">按分类排列</a></td></tr>\n");
#if 0
	printf("<a href=bbsmybrd?mode=0>按字母顺序排列</a> &nbsp; "
	       "<a href=bbsmybrd?mode=1>按分类排列</a><hr>");
#endif
	printf("<tr>\n<td width=40 class=\"level1\">&nbsp;</td>\n"
		"<td class=\"level1\"><br>\n"
		"<form action=bbsmybrd?type=1&confirm1=1 method=post>\n");
	printf("<input type=hidden name=confirm1 value=1>\n");
	
	if (mode == 0)
		showlist_alphabetical(NULL, 0);
	else 
		showlist_grouped(0);

	readuservalue(currentuser.userid, "mybrdmode", buf, sizeof (buf));
	mybrdmode = atoi(buf);
	printf
	    ("<br>\n<input type=radio name=mybrdmode value='0' %s>预定讨论区显示中文描述 "
	     "<input type=radio name=mybrdmode value='1' %s>预定讨论区显示英文名称<br>",
	     mybrdmode ? "" : "checked", mybrdmode ? "checked" : "");
	printf
	    ("<input type=submit class=resetlong value=确认预定> <input type=reset class=sumbitlong value=复原>\n");
	printf("</form></td></tr></table></td></tr></table></body>\n");
	http_quit();
	return 0;
}