int bbsclear_main(void) { if (!loginok) return BBS_ELGNREQ; const char *board = getparm("board"); struct boardheader *bp = getbcache(board); if (bp == NULL || !hasreadperm(¤tuser, 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; }
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; }
int bbssnd_main(void) { if (!loginok) return BBS_ELGNREQ; if (parse_post_data() < 0) return BBS_EINVAL; int bid = strtol(getparm("bid"), NULL, 10); struct boardheader *bp = getbcache2(bid); if (bp == NULL || !haspostperm(¤tuser, bp)) return BBS_ENOBRD; if (bp->flag & BOARD_DIR_FLAG) return BBS_EINVAL; bool isedit = (*(getparm("e")) == '1'); unsigned int fid; struct fileheader fh; char *f = getparm("f"); bool reply = !(*f == '\0'); if (reply) { fid = strtoul(f, NULL, 10); if (!bbscon_search(bp, fid, 0, &fh)) return BBS_ENOFILE; if (!isedit && fh.accessed[0] & FILE_NOREPLY) return BBS_EPST; if (isedit && !chkBM(bp, ¤tuser) && strcmp(fh.owner, currentuser.userid)) return BBS_EACCES; } char title[sizeof(fh.title)]; if (!isedit) { strlcpy(title, getparm("title"), sizeof(title)); printable_filter(title); if (*title == '\0') return BBS_EINVAL; } // TODO: ... #ifdef SPARC if(abs(time(0) - *(int*)(u_info->from+34))<6) { //modified from 36 to 34 for sparc solaris by roly 02.02.28 *(int*)(u_info->from+34)=time(0); //modified from 36 to 34 for sparc solaris by roly 02.02.28 return BBS_EPFREQ; } *(int*)(u_info->from+34)=time(0);//modified from 36 to 34 for sparc solaris by roly 02.02.28 #else if(abs(time(0) - *(int*)(u_info->from+36))<6) { //modified from 36 to 34 for sparc solaris by roly 02.02.28 *(int*)(u_info->from+36)=time(0); //modified from 36 to 34 for sparc solaris by roly 02.02.28 return BBS_EPFREQ; } *(int*)(u_info->from+36)=time(0);//modified from 36 to 34 for sparc solaris by roly 02.02.28 #endif if (isedit) { char file[HOMELEN]; setbfile(file, bp->filename, fh.filename); if (edit_article(file, getparm("text"), mask_host(fromhost)) < 0) return BBS_EINTNL; } else { post_request_t pr = { .autopost = false, .crosspost = false, .userid = NULL, .nick = NULL, .user = ¤tuser, .bp = bp, .title = title, .content = getparm("text"), .sig = strtol(getparm("sig"), NULL, 0), .ip = mask_host(fromhost), .o_fp = reply ? &fh : NULL, .noreply = false, .mmark = false }; if (do_post_article(&pr) < 0) return BBS_EINTNL; } if (!isedit && !junkboard(bp)) { currentuser.numposts++; save_user_data(¤tuser); } char buf[sizeof(fh.title) + sizeof(bp->filename)]; snprintf(buf, sizeof(buf), "%sed '%s' on %s", isedit ? "edit" : "post", title, bp->filename); report(buf, currentuser.userid); snprintf(buf, sizeof(buf), "doc?board=%s", bp->filename); http_header(); refreshto(1, buf); printf("</head>\n<body>发表成功,1秒钟后自动转到<a href='%s'>版面</a>\n" "</body>\n</html>\n", buf); return 0; }
int web_sector(void) { int sid = 0; board_t parent = { .id = 0 }; db_res_t *res = NULL; const char *sname = web_get_param("s"); if (*sname) { res = db_query("SELECT id, descr" " FROM board_sectors WHERE name = %s", sname); if (!res || db_res_rows(res) < 1) { db_clear(res); return BBS_EINVAL; } } else { const char *pname = web_get_param("board"); if (*pname) get_board(pname, &parent); else get_board_by_bid(strtol(web_get_param("bid"), NULL, 10), &parent); if (!parent.id || !(parent.flag & BOARD_FLAG_DIR) || !has_read_perm(&parent)) return BBS_ENOBRD; } xml_header(NULL); printf("<bbsboa link='%sdoc' ", get_post_list_type_string()); if (*sname) { char path[HOMELEN]; sprintf(path, "%s/info/egroup%d/icon.jpg", BBSHOME, (int) strtol(sname, NULL, 16)); if (dashf(path)) printf(" icon='%s'", path); const char *utf8_sector = db_get_value(res, 0, 1); if (web_request_type(UTF8)) { printf(" title='%s'>", utf8_sector); } else { GBK_BUFFER(sector, BOARD_SECTOR_NAME_CCHARS); convert_u2g(utf8_sector, gbk_sector); printf(" title='%s'>", gbk_sector); } sid = db_get_integer(res, 0, 0); db_clear(res); } else { if (web_request_type(UTF8)) { printf(" dir= '1' title='%s'>", parent.descr); } else { GBK_BUFFER(descr, BOARD_DESCR_CCHARS); convert_u2g(parent.descr, gbk_descr); printf(" dir= '1' title='%s'>", gbk_descr); } } if (sid) res = db_query(BOARD_SELECT_QUERY_BASE "WHERE b.sector = %d", sid); else res = db_query(BOARD_SELECT_QUERY_BASE "WHERE b.parent = %d", parent.id); if (res && db_res_rows(res) > 0) show_board(res); db_clear(res); print_session(); printf("</bbsboa>"); return 0; } int bbsclear_main(void) { if (!session_id()) return BBS_ELGNREQ; board_t board; if (!get_board(web_get_param("board"), &board) || !has_read_perm(&board)) return BBS_ENOBRD; session_set_board(board.id); const char *start = web_get_param("start"); brc_init(currentuser.userid, board.name); brc_clear_all(); brc_sync(currentuser.userid); char buf[STRLEN]; snprintf(buf, sizeof(buf), "doc?board=%s&start=%s", board.name, start); http_header(); refreshto(0, buf); printf("</head></html>"); return 0; } int bbsnot_main(void) { board_t board; if (!get_board(web_get_param("board"), &board) || !has_read_perm(&board)) return BBS_ENOBRD; if (board.flag & BOARD_FLAG_DIR) return BBS_EINVAL; session_set_board(board.id); char fname[HOMELEN]; snprintf(fname, sizeof(fname), "vote/%s/notes", board.name); mmap_t m; m.oflag = O_RDONLY; if (mmap_open(fname, &m) < 0) return BBS_ENOFILE; xml_header(NULL); printf("<bbsnot brd='%s'>", board.name); xml_fputs2((char *) m.ptr, m.size); mmap_close(&m); print_session(); printf("</bbsnot>"); return 0; }