int makeboardlist(const struct sectree *sec, struct boardmem *(data[])) { int total = 0, len, hasintro = 0, i; struct boardmem *x; char *secstr = sec->basestr; len = strlen(secstr); if (sec->introstr[0]) hasintro = 1; 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 (hasintro) { if (strcmp(secstr, x->header.sec1) && strcmp(secstr, x->header.sec2)) continue; } else { if (strncmp(secstr, x->header.sec1, len) && strncmp(secstr, x->header.sec2, len)) continue; } if (!has_view_perm_x(currentuser, x)) continue; data[total] = x; total++; } return total; }
int listmybrd(struct boardmem *(data[])) { struct boardmem *x; int i, j, total = 0; struct FolderSet *Favor; if ((Favor = _loadFavorFolder(currentuser->userid)) == NULL) return 0; 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 (!has_view_perm_x(currentuser, x)) continue; for (j = 1; j < FAVOR_BRD_NUM; j++) { if (strcasecmp(x->header.filename, Favor->boards[j])) continue; data[total] = x; total++; break; } } _unloadFavorFolder(Favor); return total; }
int bm_printboard(struct boardmem *bmem, char *who) { if (chk_BM_id(who, &bmem->header) && has_view_perm_x(currentuser, bmem)) { printf("<a href=bbsdoc?B=%d>", getbnumx(bmem)); printf("%s", bmem->header.filename); printf("</a> "); } return 0; }
//secstr == NULL: all boards //secstr == "": boards that doesnn't belong to any group //return the bnum of one of the match boards static int searchlist_alphabetical(const char *sectitle, const char *secstr, char *match, int showintro, int *bnum) { struct boardmem *(data[MAXBOARD]), *bx; int i, len = 0, total = 0; if (secstr) { len = strlen(secstr); if (len == 0) len = 1; } for (i = 0; i < MAXBOARD && i < shm_bcache->number; i++) { bx = &shm_bcache->bcache[i]; if (secstr && strncmp(bx->header.sec1, secstr, len) //&& strncmp(bx->header.sec2, secstr, len) ) continue; if (!strcasestr(bx->header.filename, match) && !strcasestr(bx->header.title, match) && !strcasestr(getboardaux(i)->intro, match)) continue; if (has_view_perm_x(currentuser, bx)) { *bnum = i; data[total] = bx; total++; } } if (!total) return 0; printhr(); printf("<b>·ÖÇø: <a href=boa?secstr=%s>%s</a></b>", secstr, nohtml(sectitle)); qsort(data, total, sizeof (struct boardmem *), (void *) cmpboard); printf("<table width=100%%>\n"); for (i = 0; i < total; i++) { if (showintro || (i && i % 3 == 0)) printf("</tr>"); if (showintro || i % 3 == 0) printf("\n<tr valign=top bgcolor=%x>", 0xf0f0d0 | (unsigned) (i % 2) * 0x0f0f0f); printf ("<td><a href='javascript:setEl(\"%s\")'><nobr>%s(%s)</nobr></a></td>", data[i]->header.filename, data[i]->header.filename, nohtml(data[i]->header.title)); if (showintro) { struct boardaux *baux; baux = getboardaux(getbnumx(data[i])); if (baux != NULL) printf("<td>%s</td>", nohtml(baux->intro)); } } printf("</table>\n"); return total; }