diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 43 | ||||
-rw-r--r-- | mbbsd/mail.c | 5 | ||||
-rw-r--r-- | mbbsd/voteboard.c | 10 |
3 files changed, 42 insertions, 16 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 76b9b748..b3eb3bc8 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -543,10 +543,11 @@ do_general(int isbid) } #ifndef DEBUG - if ( cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || + if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || + cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10) ) { move(5, 10); - vmsg("你的上站數/文章數不足喔!"); + vmsg("你不夠資深喔!"); return FULLUPDATE; } #endif @@ -803,7 +804,8 @@ do_generalboardreply(fileheader_t * fhdr) { char genbuf[3]; - if ( cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || + if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || + cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10) ) { getdata(b_lines - 1, 0, "▲ 回應至 (M)作者信箱 (Q)取消?[M] ", genbuf, sizeof(genbuf), LCECHO); @@ -1029,10 +1031,11 @@ cross_post(int ent, fileheader_t * fhdr, char *direct) postrecord.checksum[0] = ent; } - if ( cuser.numlogins < ((unsigned int)(bcache[author - 1].post_limit_logins) * 10) || + if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || + cuser.numlogins < ((unsigned int)(bcache[author - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[author - 1].post_limit_posts) * 10) ) { move(5, 10); - vmsg("你的上站數/文章數不足喔!"); + vmsg("你不夠資深喔!"); return FULLUPDATE; } @@ -1147,13 +1150,12 @@ read_post(int ent, fileheader_t * fhdr, char *direct) int do_limitedit(int ent, fileheader_t * fhdr, char *direct) { - char genbuf[256], buf[256]; - int temp; - boardheader_t *bp = NULL; + char genbuf[256], buf[256]; + int temp; + boardheader_t *bp = getbcache(currbid); if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) return DONOTHING; - bp = getbcache(currbid); strcpy(buf, "更改 "); if (HAS_PERM(PERM_SYSOP)) @@ -1165,6 +1167,13 @@ do_limitedit(int ent, fileheader_t * fhdr, char *direct) genbuf[0] = getans(buf); if (HAS_PERM(PERM_SYSOP) && genbuf[0] == 'a') { + sprintf(genbuf, "%u", bp->post_limit_regtime); + do { + getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO); + temp = atoi(genbuf); + } while (temp < 0 || temp > 255); + bp->post_limit_regtime = (unsigned char)temp; + sprintf(genbuf, "%u", bp->post_limit_logins * 10); do { getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO); @@ -1174,7 +1183,7 @@ do_limitedit(int ent, fileheader_t * fhdr, char *direct) sprintf(genbuf, "%u", bp->post_limit_posts * 10); do { - getdata_buf(23, 0, "文章篇數下限 (0~2550):", genbuf, 5, LCECHO); + getdata_buf(b_lines - 1, 0, "文章篇數下限 (0~2550):", genbuf, 5, LCECHO); temp = atoi(genbuf); } while (temp < 0 || temp > 2550); bp->post_limit_posts = (unsigned char)(temp / 10); @@ -1184,6 +1193,13 @@ do_limitedit(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } else if (genbuf[0] == 'b') { + sprintf(genbuf, "%u", bp->vote_limit_regtime); + do { + getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO); + temp = atoi(genbuf); + } while (temp < 0 || temp > 255); + bp->vote_limit_regtime = (unsigned char)temp; + sprintf(genbuf, "%u", bp->vote_limit_logins * 10); do { getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO); @@ -1203,6 +1219,13 @@ do_limitedit(int ent, fileheader_t * fhdr, char *direct) return FULLUPDATE; } else if ((fhdr->filemode & FILE_VOTE) && genbuf[0] == 'c') { + sprintf(genbuf, "%u", fhdr->multi.vote_limits.regtime); + do { + getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO); + temp = atoi(genbuf); + } while (temp < 0 || temp > 255); + fhdr->multi.vote_limits.regtime = temp; + sprintf(genbuf, "%u", (unsigned int)(fhdr->multi.vote_limits.logins) * 10); do { getdata_buf(b_lines - 1, 0, "上站次數下限 (0~2550):", genbuf, 5, LCECHO); diff --git a/mbbsd/mail.c b/mbbsd/mail.c index dd571ee6..2b0b7160 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1044,10 +1044,11 @@ mail_cross_post(int ent, fileheader_t * fhdr, char *direct) return TITLE_REDRAW; ent = getbnum(xboard); - if ( cuser.numlogins < ((unsigned int)(bcache[ent - 1].post_limit_logins) * 10) || + if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || + cuser.numlogins < ((unsigned int)(bcache[ent - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[ent - 1].post_limit_posts) * 10) ) { move(5, 10); - vmsg("你的上站數/文章數不足喔!"); + vmsg("你不夠資深喔!"); return FULLUPDATE; } diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c index 443b4d4b..73cc0742 100644 --- a/mbbsd/voteboard.c +++ b/mbbsd/voteboard.c @@ -165,10 +165,11 @@ do_voteboard(int type) vmsg("對不起,您目前無法在此發表文章!"); return FULLUPDATE; } - if ( cuser.numlogins < ((unsigned int)(bcache[currbid - 1].vote_limit_logins) * 10) || + if ( cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].vote_limit_regtime * 2592000) || + cuser.numlogins < ((unsigned int)(bcache[currbid - 1].vote_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[currbid - 1].vote_limit_posts) * 10) ) { move(5, 10); - vmsg("你的上站數/文章數不足喔!"); + vmsg("你不夠資深喔!"); return FULLUPDATE; } move(0, 0); @@ -345,8 +346,9 @@ do_voteboard(int type) votefile.filemode |= FILE_VOTE; /* use lower 16 bits of 'money' to store limits */ /* lower 8 bits are posts, higher 8 bits are logins */ - votefile.multi.vote_limits.logins = (unsigned int)bcache[currbid - 1].vote_limit_logins; - votefile.multi.vote_limits.posts = (unsigned int)bcache[currbid - 1].vote_limit_posts; + votefile.multi.vote_limits.regtime = bcache[currbid - 1].vote_limit_regtime; + votefile.multi.vote_limits.logins = bcache[currbid - 1].vote_limit_logins; + votefile.multi.vote_limits.posts = bcache[currbid - 1].vote_limit_posts; setbdir(genbuf, currboard); if (append_record(genbuf, &votefile, sizeof(votefile)) != -1) setbtotal(currbid); |