Пример #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
bbsboardlistscript_main()
{
	int total;
	struct boardmem *(data[MAXBOARD]);
	char *secstr;
	changemode(READING);
	if (cache_header
	    (max(thisversion, file_time(MY_BBS_HOME "/wwwtmp")), 500))
		return 0;
	secstr = getparm("secstr");
	if (secstr[0]== '*')
		total = listmybrd(data);
	else
		total = makeboardlist(getsectree(secstr), data);
	printf("Content-type: application/x-javascript; charset=%s\r\n\r\n",
	       CHARSET);
	printf("var boardlistscript=");
	boardlistscript(data, total);
	return 0;
}
Пример #4
0
int
index2009_main()
{
	//struct boardmem *x;
	//int i, total = 0;
	char *secstr;
	//char ydq[3];
	const struct sectree *sec;
	struct brcinfo *brcinfo;

	brcinfo = brc_readinfo(currentuser->userid);

	secstr = getparm("secstr");
	sec = getsectree(secstr);

	if (secstr[0] != '*' && !strcmp(sec->basestr, brcinfo->lastsec)) {
		if (cache_header
		    (max(thisversion, file_time(MY_BBS_HOME "/wwwtmp")), 120))
			return 0;
	}

	if (secstr[0] != '*' && strcmp(sec->basestr, brcinfo->lastsec)) {
		strsncpy(brcinfo->lastsec, sec->basestr,
			 sizeof (brcinfo->lastsec));
		brc_saveinfo(currentuser->userid, brcinfo);
	}
	html_header(1);
	printf("<title>一路BBS 凝聚华人力量,加强中外交流</title>");
	//check_msg();
	printf("<style type=text/css>A {color: #0000f0}</style>");
	printf("<script src=" BBSJS "></script>\n");
	printf("<script src=" BBSBOAJS "></script>\n");	
	printf("</head><body topmargin=0 leftMargin=1 MARGINWIDTH=1 MARGINHEIGHT=0>" WWWLEFT_DIV);
	showsecpage2009(sec);
	printf(WWWFOOT_DIV "</body></html>");
	return 0;
}
Пример #5
0
void babl_store_db (void)
{
  BablDb *db = babl_fish_db ();
  int i;
  FILE *dbfile = fopen (fish_cache_path (), "w");
  if (!dbfile)
    return;
  fprintf (dbfile, "%s\n", cache_header ());

  /* sort the list of fishes by usage, making next run more efficient -
   * and the data easier to approach as data for targeted optimization
   */
  qsort (db->babl_list->items, db->babl_list->count,
         sizeof (Babl*), compare_fish_pixels);

  for (i = 0; i< db->babl_list->count; i++)
  {
    Babl *fish = db->babl_list->items[i];
    char tmp[8192];
    if (babl_fish_serialize (fish, tmp, 4096))
      fprintf (dbfile, "%s----\n", tmp);
  }
  fclose (dbfile);
}
Пример #6
0
void babl_init_db (void)
{
  const char *path = fish_cache_path ();
  long  length = -1;
  char  seps[] = "\n\r";
  Babl *babl   = NULL;
  char *contents = NULL;
  char *token;
  char *tokp;
  const Babl  *from_format = NULL;
  const Babl  *to_format   = NULL;
  time_t tim = time (NULL);

  if (getenv ("BABL_DEBUG_CONVERSIONS"))
    return;

  babl_file_get_contents (path, &contents, &length, NULL);
  if (!contents)
    return;

  token = strtok_r (contents, seps, &tokp);
  while( token != NULL )
    {
      switch (token[0])
      {
        case '-': /* finalize */
          if (babl)
          {
            if (((babl->fish.pixels + babl->fish.processings) % 100) == (tim % 100))
            {
              /* 1% chance of individual cached conversions being dropped -
               * making sure mis-measured conversions do not
                 stick around for a long time*/
              babl_free (babl);
            }
            else
              babl_db_insert (babl_fish_db(), babl);
          }
          from_format = NULL;
          to_format = NULL;
          babl=NULL;
          break;
        case '#':
          /* if babl has changed in git .. drop whole cache */
          {
            if (strcmp ( token, cache_header ()))
            {
              free (contents);
              return;
            }
          }
          break;
        case '\t':
          if (strchr (token, '='))
          {
            char seps2[] = " ";
            char *tokp2;
            char *token2;
            char name[4096];

            _babl_fish_create_name (name, from_format, to_format, 1);
            babl = babl_db_exist_by_name (babl_fish_db (), name);
            if (babl)
            {
              fprintf (stderr, "%s:%i: loading of cache failed\n",
                              __FUNCTION__, __LINE__);
              return;
            }

            babl = babl_calloc (1, sizeof (BablFishPath) +
                                strlen (name) + 1);
            babl_set_destructor (babl, _babl_fish_path_destroy);

            babl->class_type     = BABL_FISH_PATH;
            babl->instance.id    = babl_fish_get_id (from_format, to_format);
            babl->instance.name  = ((char *) babl) + sizeof (BablFishPath);
            strcpy (babl->instance.name, name);
            babl->fish.source               = from_format;
            babl->fish.destination          = to_format;
            babl->fish_path.conversion_list = babl_list_init_with_size (10);

            token2 = strtok_r (&token[1], seps2, &tokp2);
            while( token2 != NULL )
            {
              if (!strncmp (token2, "error=", 6))
              {
                babl->fish.error = babl_parse_double (token2 + 6);
              }
              else if (!strncmp (token2, "cost=", 5))
              {
                babl->fish_path.cost = babl_parse_double (token2 + 5);
              }
              else if (!strncmp (token2, "pixels=", 7))
              {
                babl->fish.pixels = strtol (token2 + 7, NULL, 10);
              }
              else if (!strncmp (token2, "processings=", 12))
              {
                babl->fish.processings = strtol (token2 + 12, NULL, 10);
              }
              token2 = strtok_r (NULL, seps2, &tokp2);
            }
          }
          else
          {
            Babl *conv = (void*)babl_db_find(babl_conversion_db(), &token[1]);
            if (!conv)
            {
              return;
            }
            else
              babl_list_insert_last (babl->fish_path.conversion_list, conv);
          }
          break;
        default:
          if (!from_format)
          {
            from_format = (void*)babl_db_find(babl_format_db(), token);
            if (!from_format)
              return;
          }
          else
          {
            to_format = (void*)babl_db_find(babl_format_db(), token);
            if (!to_format)
              return;
          }
          break;
      }
      token = strtok_r (NULL, seps, &tokp);
    }
  if (contents)
    free (contents);
}