Esempio n. 1
0
int show_file(char *board, struct fileheader *x)
{
    char title[STRLEN];
    char *ptr=x->title;
    if(!strncmp(ptr, "Re:", 3))
        ptr+=4;
    strsncpy(title, ptr, 60);

    brc_init(currentuser.userid, board);
    brc_add_read(x->filename);
    brc_update(currentuser.userid, board);
    //printf("ok");return 0;
    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)
    {
        http_fatal("文章内容已被删除<br>\n");
        return;
    }
    printf("<p>");

    if(fgets(buf, 256, fp)==0)
    {
        printf("读取文件出错!");
        fclose(fp);
        return 0;
    }
    char *id,*s;

    int w=80;
    if(ads) {
        w=100;
    }
    int con=1,qmd=0,cite=0;
    printf("<table><tr><td id=\"c\" bgcolor=\"black\" style=\"font-size:16px;line-height:1\"></td></tr></table>");
    printf("<script language=\"javascript\">\n\r	init();\n\r");
    printf("document.getElementById('c').innerHTML=previewthis('");
    fseek (fp,0,0);
    while(1)
    {
        if(fgets(buf, 500, fp)==0)
            break;
        jsprint(buf);
    }
    printf("');\n\r</script>");
    fclose(fp);
    if(ads) googleads();
    return 1;
}
Esempio n. 2
0
int bbsclear_main(void)
{
	if (!loginok)
		return BBS_ELGNREQ;
	const char *board = getparm("board");
	struct boardheader *bp = getbcache(board);
	if (bp == NULL || !hasreadperm(&currentuser, bp))
		return BBS_ENOBRD;
	const char *start = getparm("start");
	brc_fcgi_init(currentuser.userid, board);
	brc_clear(NA, NULL, YEA);
	brc_update(currentuser.userid, board);
	char buf[STRLEN];
	snprintf(buf, sizeof(buf), "doc?board=%s&start=%s", board, start);
	http_header();
	refreshto(0, buf);
	printf("</head></html>");
	return 0;
}
Esempio n. 3
0
int
bbsclear_main()
{
	char board[80], start[80], buf[256];
	html_header(1);
	check_msg();
	strsncpy(board, getparm("B"), 32);
	if (!board[0])
		strsncpy(board, getparm("board"), 32);
	strsncpy(start, getparm("S"), 32);
	if (!start[0])
		strsncpy(start, getparm("start"), 32);
	if (!getboard(board))
		http_fatal("´íÎóµÄÌÖÂÛÇø");
	changemode(READNEW);
	brc_initial(currentuser.userid, board);
	brc_clear();
	brc_update(currentuser.userid);
	sprintf(buf, "%s%s&S=%s", showByDefMode(), board, start);
	refreshto(buf, 0);
	http_quit();
	return 0;
}
Esempio n. 4
0
//struct file_to_appendix  a;
int main()
{
        FILE *fp;
        char filename[80], dir[80], board[80], title[80], buf[80], *content, vfrom[80];
	char tmpbuf [5], title2 [10];
        char redirfile[80];
        int r, i=0, length=0, sig, mode=0, accessed=0;
        struct fileheader x;
        struct shortfile *brd;
        init_all();
        if(!loginok)
                http_fatal("匆匆过客不能发表文章,请先登录");


        mode=atoi(getparm("mode"));
        if(mode)
                strsncpy(redirfile, getparm("redir"), 20);
        strsncpy(board, getparm("board"), 18);
        strsncpy(vfrom, getparm("vfrom"), 18);
		if (!*vfrom)
		{
			strcpy(vfrom, board);
		}

        if(dashf("NOPOST")&&!HAS_PERM(PERM_OBOARDS)
   		                && insec(1,board) 
          )
                http_fatal("对不起,系统进入只读状态,暂停发表文章.你先四处看看吧");

        /* efan: very faint	*/
        if (dashf ("NOPOST.2") && ! HAS_PERM (PERM_OBOARDS) && (
                                !strcmp (board, "VoiceofNankai") ||
                                !strcmp (board, "Military") ||
                                !strcmp (board, "TaiWan") ||
                                !strcmp (board, "Salon"))
           )
                http_fatal("对不起,本板进入只读状态,暂停发表文章");



        if(!(currentuser.userlevel & PERM_POST)&&strcmp(board, "appeal")&&strcmp(board, "sysop"))
                http_fatal("您尚未通过注册,暂无发表文章权限");

        if(check_post_limit(board)) return 0;

        strsncpy(title, getparm("title"), 50);
	strsncpy (tmpbuf, getparm ("title2"), 5);
	if (tmpbuf [0] != 0)
		sprintf (title2, "【%s】", tmpbuf);
	else
		title2[0] = 0;

	content=getparm("text");
        brd=getbcache(board);
        /* add by wzk for outgo post */
        //out=strlen(getparm("out"));
        //if (!(brd->flag & OUT_FLAG)) out=0;
        /* end */
        if(brd==0)
                http_fatal("错误的讨论区名称");
        strcpy(board, brd->filename);
	//huangxu@070217:no_word_filter flag
	int bd=0; 
        char temp[80];
        if(!(brd->flag2&NOFILTER_FLAG)&&(bad_words(title) || bad_words (tmpbuf) || bad_words(content) )){
                bd=1;		
                printf("您的文章可能包含不便显示的内容,已经提交审核。请返回并进行修改。");
   	        sprintf(temp,"TEMP-%s",board);
                strcpy(board,"TEMP");
        }else
                strcpy(temp,board);

        for(i=0; i<strlen(title); i++)
                if(title[i]<=27 && title[i]>=-1)
                        title[i]=' ';
        sig=atoi(getparm("signature"));

        if(title[0]==0)
                http_fatal("文章必须要有标题");
	if (title2 [0] == 0 && !strcmp (board, "Secondhand"))
		http_fatal ("在Secondhand板请说清楚您的需要!");
	if (tmpbuf [0] != ' ') {
		char tmptmpbuf [80];
		sprintf (tmptmpbuf, "%s%s", title2, title);
		strcpy (title, tmptmpbuf);
	}
        sprintf(dir, "boards/%s/.DIR", board);
        if(bd==0) 
      	  if(!has_post_perm(&currentuser, board))
             	   http_fatal("此讨论区是唯读的, 或是您尚无权限在此发表文章.");
        
	sprintf(filename, "boards/%s/deny_users", board);
        if(file_has_word(filename, currentuser.userid))
                http_fatal("很抱歉, 你被板务人员停止了本板的post权利.");
        if(abs(time(0) - *(int*)(u_info->from+36))<6) {
                *(int*)(u_info->from+36)=time(0);
                http_fatal("两次发文间隔过密, 请休息几秒后再试");
        }
        *(int*)(u_info->from+36)=time(0);
        sprintf(filename, "tmp/%d.%s.tmp", getpid(),currentuser.userid);
        f_append(filename, content);
        accessed=0;
        if(strlen(getparm("noreply"))>0)
                accessed=FILE_NOREPLY;

        int outgo=0;
        if(strlen(getparm("outgo"))>0)     
            outgo=1;

        int attach=atoi(getparm("attach"));
      
        r=0;
        r=post_article2(temp, title, filename, currentuser.userid, currentuser.username, fromhost, sig-1, accessed, attach,outgo);
        if(r<=0)
                http_fatal("内部错误,无法发文");
        char path[STRLEN];
  /*      while( appendix != NULL ) {
                bzero(&a,sizeof(struct appendix));
                strcpy(a.appendixname,appendix);
                a.filename=r;
                a.sign=0;
                strcpy(a.path,board);
                sprintf(path,"%s/file_appendix",UPLOAD_PATH);
                append_record(&a,sizeof(struct appendix),path);
                appendix = strtok( NULL, "," );
        }
*/
        sprintf(buf,"M.%d.A",r);
        brc_init(currentuser.userid, board);
        brc_add_read(buf);
        brc_update(currentuser.userid, board);
        unlink(filename);
        sprintf(buf, "posted WWW '%s' on '%s'", title, board);
        report(buf);
        if(mode==0)
                sprintf(buf, "bbsdoc?board=%s#bottom", vfrom);
        else if(mode==1)
                sprintf(buf, "bbstcon?board=%s&file=%s&vfrom=%s#bottom", board, redirfile, vfrom);
        else if(mode==2)
                sprintf(buf, "bbstdoc?board=%s#bottom", vfrom);
        if(!junkboard(board)) 
	{
                currentuser.numposts++;
                save_user_data(&currentuser);
               // write_posts(currentuser.userid, board, title);
        }
	 if(toptenboard(board))
        {
                 write_posts(currentuser.userid, board, title);
        }

	else if(!strcmp("Blessing",board)) write_posts(currentuser.userid, board, title);
        //  return 0;
        if(bd==0)        redirect(buf);

}
Esempio n. 5
0
int boarddetail_act(char * info)
{
	int act;
	char buf[1024];
	char opinfo[256];
	*opinfo = 0;
	strncpy (board, getparm("board"), 79);
	act = atoi(getparm("act"));
	if (loginok)
	{
		wmlmode (u_info, READNEW);
	}
	x = getbcache(board);
	if (x)
	{
		if ((!canenterboard (currentuser.userid, board) || !has_read_perm(&currentuser, board)) && !HAS_PERM(PERM_SYSOP))
		{
			x = NULL;
		}
	}
	if (x)
	{
		switch (act)
		{
			case 1://清除板面未读
				if (loginok)
				{
					brc_init(currentuser.userid, board);
					brc_clear();
					brc_update(currentuser.userid, board);
					strcpy (opinfo, "已标记本板为已读。");
				}
				break;
		}
		printf ("<card title=\"%s/%s\">", x->title + 11, x->filename);
		if (*opinfo)
		{
			printf ("<p>%s</p>", opinfo);
		}
		printf ("<p>板面:<anchor><go href=\"bbsdoc.wml?board=%s\" />%s/%s</anchor></p>", x->filename, x->title + 11, x->filename);
		wmlUseridStr(buf, x->BM);
		printf ("<p>板主:%s %s %s</p>", *buf ? buf : "无", (x->flag & OUT_FLAG) ? "转信" : "", junkboard(board) ? "不计文章数" : "计文章数");
		printf ("<p><anchor><go href=\"bbsdoc.wml?board=%s&amp;mode=0\" />普通</anchor> ", board);
		printf ("<anchor><go href=\"bbsdoc.wml?board=%s&amp;mode=1\" />文摘</anchor> ", board);
		printf ("<anchor><go href=\"bbsdoc.wml?board=%s&amp;mode=8\" />置顶</anchor> ", board);
		if (has_BM_perm(&currentuser, x->filename) || HAS_PERM(PERM_FORCEPAGE))
		{
			printf ("<anchor><go href=\"bbsdoc.wml?board=%s&amp;mode=4\" />回收</anchor>", board);
		}
		printf ("</p>");
		if (HAS_PERM(PERM_POST))
		{
			if (x->flag & VOTE_FLAG)
			{
				printf ("<p><anchor><go href=\"bbsvote.wml?board=%s\" />投票</anchor></p>", x->filename);
			}
			printf ("<p><anchor><go href=\"bbspst.wml?board=%s\" />发文</anchor> <anchor><go href=\"bbspattern.wml?board=%s\" />模板</anchor> <anchor><go href=\"bbs0an.wml?path=%s\" />精华</anchor> <anchor><go href=\"boarddetail.wml?board=%s&amp;act=1\" />清除未读</anchor> </p>", x->filename, x->filename, anno_path_of(x->filename), board);
		}
		printf ("<p><anchor><go href=\"bbscon.wml?board=%s&amp;file=%s\" />封禁名单</anchor> <anchor><go href=\"bbscon.wml?board=%s\" />敏感词</anchor></p>", WML_VB_DENIED, board, WML_VB_HEXIE);
		return 0;
	}
	else
	{
		strcpy (info, "讨论区不存在或您无权进入此讨论区。");
		return -1;
	}
}