diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbs.c | 10 | ||||
-rw-r--r-- | mbbsd/board.c | 7 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 7 | ||||
-rw-r--r-- | mbbsd/name.c | 3 | ||||
-rw-r--r-- | mbbsd/var.c | 3 |
5 files changed, 27 insertions, 3 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 1039e1e4..89fd9684 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -2975,6 +2975,11 @@ b_config(void) (bp->brdattr & BRD_RESTRICTEDPOST) ? ANSI_COLOR(1)"只有板友才可發文" : "無特別設定" ); + prints( " " ANSI_COLOR(1;36) "1" ANSI_RESET + " - 未滿十八歲 " ANSI_COLOR(1) "%s" ANSI_RESET + " 進入", + (bp->brdattr & BRD_OVER18) ? "不可以" : "可以" ); + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) { vmsg("您對此板無管理權限"); @@ -3072,6 +3077,11 @@ b_config(void) bp->brdattr &= ~BRD_NORECOMMEND; break; #endif + case '1': + bp->brdattr ^= BRD_OVER18; + touched = 1; + break; + default: finished = 1; break; diff --git a/mbbsd/board.c b/mbbsd/board.c index 13cdd930..64c27f65 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -103,11 +103,15 @@ HasBoardPerm(boardheader_t *bptr) if (HasUserPerm(PERM_SYSOP)) return 1; + /* 十八禁看板 */ + if( (brdattr & BRD_OVER18) && !over18 ) + return 0; + + /* 板主 */ if( is_BM_cache(bptr - bcache + 1) ) /* XXXbid */ return 1; /* 祕密看板:核對首席板主的好友名單 */ - if (brdattr & BRD_HIDE) { /* 隱藏 */ if (hbflcheck((int)(bptr - bcache) + 1, currutmp->uid)) { if (brdattr & BRD_POSTMASK) @@ -117,6 +121,7 @@ HasBoardPerm(boardheader_t *bptr) } else return 1; } + /* 限制閱讀權限 */ if (level && !(brdattr & BRD_POSTMASK) && !HasUserPerm(level)) return 0; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 38716ad0..9cd20572 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1005,6 +1005,13 @@ user_login(void) /* 初始化: random number 增加user跟時間的差異 */ mysrand(); + /* check if over18 */ + if( (ptime.tm_year - cuser.year) >= 18 || + (ptime.tm_year - cuser.year == 17 && + ((ptime.tm_mon+1) > cuser.month || + ((ptime.tm_mon+1) == cuser.month && ptime.tm_mday > cuser.day))) ) + over18 = 1; + /* show welcome_login */ if( (ifbirth = (ptime.tm_mday == cuser.day && ptime.tm_mon + 1 == cuser.month)) ){ diff --git a/mbbsd/name.c b/mbbsd/name.c index 8fd78fb7..aafc4cc6 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -762,7 +762,8 @@ completeboard_permission(int where) boardheader_t *bptr = &bcache[SHM->bsorted[0][where]]; return (!(bptr->brdattr & BRD_SYMBOLIC) && (GROUPOP() || HasBoardPerm(bptr)) && - !(bptr->brdattr & BRD_GROUPBOARD)); + !(bptr->brdattr & BRD_GROUPBOARD) && + !(bptr->brdattr & BRD_OVER18 && !over18)); } int diff --git a/mbbsd/var.c b/mbbsd/var.c index 3afa2d6f..e44abd9d 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -74,7 +74,7 @@ const char * const str_permboard[] = { #endif "禁止快速推文", /* BRD_NOFASTRECMD */ "推文記錄 IP", /* BRD_IPLOGRECMD */ - "沒想到", + "十八禁", /* BRD_OVER18 */ "沒想到", "沒想到", "沒想到", @@ -387,6 +387,7 @@ char fromhost[STRLEN] = "\0"; char water_usies = 0; FILE *fp_writelog = NULL; water_t water[6], *swater[6], *water_which = &water[0]; +char over18 = 0; /* chc_play.c */ |