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; }
int genhotboard2009(struct hotboard *hb, const struct sectree *sec, int max) { int count = 0, i, j, len; struct boardmem *bmem[MAXHOTBOARD], *x, *x1; if (max < 3 || max > MAXHOTBOARD) max = 10; if (max == hb->max && hb->uptime > shm_bcache->uptime) return hb->count; 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; } for (i = 0; i < count; i++) { strsncpy(hb->bname[i], bmem[i]->header.filename, sizeof (hb->bname[0])); strsncpy(hb->title[i], bmem[i]->header.title, sizeof (hb->title[0])); hb->bnum[i] = getbnumx(bmem[i]); } hb->max = max; hb->count = count; hb->uptime = now_t; hb->sec = sec; return count; }
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", " "); 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; }