summaryrefslogtreecommitdiffstats
path: root/mbbsd/cal.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-24 11:31:44 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-24 11:31:44 +0800
commit9babe26b4f858e481463edd43290059bcd2717bd (patch)
tree78c5376e6347baf636d36882ada4093b0b1da2f3 /mbbsd/cal.c
parent30990df77ad6872f26b8180145cad86ba0fba00b (diff)
downloadpttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar.gz
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar.bz2
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar.lz
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar.xz
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.tar.zst
pttbbs-9babe26b4f858e481463edd43290059bcd2717bd.zip
- fix user over18 display in admin's user_display.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4014 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/cal.c')
-rw-r--r--mbbsd/cal.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 1f6f9d9d..91ec3cf0 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -493,27 +493,32 @@ give_money_ui(const char *userid)
return do_give_money(id, uid, m);
}
-void
-resolve_over18(void)
+int
+resolve_over18_user(const userec_t *u)
{
/* get local time */
struct tm ptime = *localtime4(&now);
- over18 = 0;
- /* check if over18 */
// 照實歲計算,沒生日的當作未滿 18
- if (cuser.year < 1 || cuser.month < 1)
- over18 = 0;
- else if( (ptime.tm_year - cuser.year) > 18)
- over18 = 1;
- else if (ptime.tm_year - cuser.year < 18)
- over18 = 0;
- else if ((ptime.tm_mon+1) > cuser.month)
- over18 = 1;
- else if ((ptime.tm_mon+1) < cuser.month)
- over18 = 0;
- else if (ptime.tm_mday >= cuser.day )
- over18 = 1;
+ if (u->year < 1 || u->month < 1)
+ return 0;
+ else if( (ptime.tm_year - u->year) > 18)
+ return 1;
+ else if (ptime.tm_year - u->year < 18)
+ return 0;
+ else if ((ptime.tm_mon+1) > u->month)
+ return 1;
+ else if ((ptime.tm_mon+1) < u->month)
+ return 0;
+ else if (ptime.tm_mday >= u->day )
+ return 1;
+ return 0;
+}
+
+void
+resolve_over18(void)
+{
+ over18 = resolve_over18_user(&cuser);
}
int