summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-25 21:22:38 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-25 21:22:38 +0800
commit00f1e5a84015dac18d4b66f51cd0284afb552be5 (patch)
treeea20f6a42fdec9703c092c67026973a3942f7e78
parent2f63f3e91fd9acfa1fdc0d7aa17d172d7c3f9ed4 (diff)
downloadpttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar.gz
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar.bz2
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar.lz
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar.xz
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.tar.zst
pttbbs-00f1e5a84015dac18d4b66f51cd0284afb552be5.zip
* remove numlogin from vote/post restriction (confirmed by SYSOPs)
* reason: this variable can be easily cheated by bots and hard to detect/avoid. * this can be replaced by regtime (or, count of 'days' that logged in). * we also plan to remove all references to numlogins in future because it's hard to be kept on web-forum systems. * also refined code layout in pttstruct.h git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4774 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/pttstruct.h184
-rw-r--r--mbbsd/bbs.c20
-rw-r--r--mbbsd/board.c15
-rw-r--r--mbbsd/voteboard.c5
-rw-r--r--util/shmctl.c1
-rw-r--r--util/showboard.c1
6 files changed, 102 insertions, 124 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 84f2d71c..2c3591c4 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -53,74 +53,88 @@ typedef struct userec_t {
uint32_t version; /* version number of this sturcture, we
* use revision number of project to denote.*/
- char userid[IDLEN + 1]; /* ID */
- char realname[20]; /* 真實姓名 */
- char nickname[24]; /* 暱稱 */
- char passwd[PASSLEN]; /* 密碼 */
- char padx;
- uint32_t uflag; /* 習慣1 , see uflags.h */
- uint32_t uflag2; /* 習慣2 , see uflags.h */
+ char userid[IDLEN+1];/* 使用者ID */
+ char realname[20]; /* 真實姓名 */
+ char nickname[24]; /* 暱稱 */
+ char passwd[PASSLEN];/* 密碼 */
+
+ char pad_1;
+
+ uint32_t uflag; /* 習慣1 , see uflags.h */
+ uint32_t uflag2; /* 習慣2 , see uflags.h */
uint32_t userlevel; /* 權限 */
uint32_t numlogins; /* 上站次數 */
uint32_t numposts; /* 文章篇數 */
- time4_t firstlogin; /* 註冊時間 */
- time4_t lastlogin; /* 最近上站時間 */
- char lasthost[IPV4LEN+1];/* 上次上站來源 */
+ time4_t firstlogin; /* 註冊時間 */
+ time4_t lastlogin; /* 最近上站時間 */
+ char lasthost[IPV4LEN+1];/* 上次上站來源 */
int32_t money; /* Ptt幣 */
- char unused[4];
- char email[50]; /* Email */
- char address[50]; /* 住址 */
- char justify[REGLEN + 1]; /* 審核資料 */
- uint8_t month; /* 生日 月 */
- uint8_t day; /* 生日 日 */
- uint8_t year; /* 生日 年 */
- uint8_t sex; /* 性別 */
- uint8_t unused2; /* unused */
- uint8_t pager; /* 呼叫器狀態 */
- uint8_t invisible; /* 隱形狀態 */
- char unused3[2];
+
+ char unused_1[4];
+
+ char email[50]; /* Email */
+ char address[50]; /* 住址 */
+ char justify[REGLEN + 1];/* 審核資料 */
+ uint8_t month; /* 生日 月 */
+ uint8_t day; /* 生日 日 */
+ uint8_t year; /* 生日 年 */
+ uint8_t sex; /* 性別 */
+
+ uint8_t unused_2;
+
+ uint8_t pager; /* 呼叫器狀態 */
+ uint8_t invisible; /* 隱形狀態 */
+
+ char unused_3[2];
+
uint32_t exmailbox; /* 購買信箱數 TODO short 就夠了 */
- // r3968 移出 chicken 128 byte
- // chicken_t old_chicken;
- char chkpad0[4]; /* 前面留空提高相容性(?) */
- char career[40];
- char phone[20];
- char chkpad1[52];
- time4_t chkpad2[3]; /* in case 有人忘了把 time4_t 調好... */
+ // r3968 移出 sizeof(chicken_t)=128 bytes
+ char chkpad0[4];
+
+ char career[40]; /* 學歷職業 */
+ char phone[20]; /* 電話 */
+
+ char chkpad1[52];
+ time4_t chkpad2[3]; /* in case 有人忘了把 time4_t 調好... */
// 以上應為 sizeof(chicken_t) 同等大小
- time4_t lastsong; /* 上次點歌時間 */
- uint32_t loginview; /* 進站畫面 */
- uint8_t channel; /* TODO unused */
- char padxxx;
- uint16_t vl_count; /* 違法記錄 ViolateLaw counter */
- uint16_t five_win; /* 五子棋戰績 勝 */
- uint16_t five_lose; /* 五子棋戰績 敗 */
- uint16_t five_tie; /* 五子棋戰績 和 */
- uint16_t chc_win; /* 象棋戰績 勝 */
- uint16_t chc_lose; /* 象棋戰績 敗 */
- uint16_t chc_tie; /* 象棋戰績 和 */
+ time4_t lastsong; /* 上次點歌時間 */
+ uint32_t loginview; /* 進站畫面 */
+
+ uint8_t unused_4; // was: channel
+ uint8_t pad_2;
+
+ uint16_t vl_count; /* 違法記錄 ViolateLaw counter */
+ uint16_t five_win; /* 五子棋戰績 勝 */
+ uint16_t five_lose; /* 五子棋戰績 敗 */
+ uint16_t five_tie; /* 五子棋戰績 和 */
+ uint16_t chc_win; /* 象棋戰績 勝 */
+ uint16_t chc_lose; /* 象棋戰績 敗 */
+ uint16_t chc_tie; /* 象棋戰績 和 */
int32_t mobile; /* 手機號碼 */
- char mind[4]; /* 心情 not a null-terminate string */
- uint16_t go_win; /* 圍棋戰績 勝 */
- uint16_t go_lose; /* 圍棋戰績 敗 */
- uint16_t go_tie; /* 圍棋戰績 和 */
- char pad0[5]; /* 從前放 ident 身份證字號,現在可以拿來做別的事了,
- 不過最好記得要先清成 0 */
- uint8_t signature; /* 慣用簽名檔 */
-
- uint8_t goodpost; /* 評價為好文章數 */
- uint8_t badpost; /* 評價為壞文章數 */
- uint8_t goodsale; /* deprecated: 競標 好的評價 */
- uint8_t badsale; /* deprecated: 競標 壞的評價 */
- char myangel[IDLEN+1]; /* 我的小天使 */
- char pad2;
- uint16_t chess_elo_rating; /* 象棋等級分 */
- uint32_t withme; /* 我想找人下棋,聊天.... */
- time4_t timeremovebadpost; /* 上次刪除劣文時間 */
- time4_t timeviolatelaw; /* 被開罰單時間 */
- char pad[28];
+ char mind[4]; /* 心情 XXX not a null-terminate string */
+ uint16_t go_win; /* 圍棋戰績 勝 */
+ uint16_t go_lose; /* 圍棋戰績 敗 */
+ uint16_t go_tie; /* 圍棋戰績 和 */
+
+ char unused_5[5]; /* 從前放 ident 身份證字號,使用前請先清0 */
+
+ uint8_t signature; /* 慣用簽名檔 */
+ uint8_t goodpost; /* 評價為好文章數 */
+ uint8_t badpost; /* 評價為壞文章數 */
+ uint8_t unused_6; /* 從前放競標好評(goodsale), 使用前請先清0 */
+ uint8_t unused_7; /* 從前放競標壞評(badsale), 使用前請先清0 */
+ char myangel[IDLEN+1];/* 我的小天使 */
+
+ char pad_3;
+
+ uint16_t chess_elo_rating;/* 象棋等級分 */
+ uint32_t withme; /* 我想找人下棋,聊天.... */
+ time4_t timeremovebadpost;/* 上次刪除劣文時間 */
+ time4_t timeviolatelaw; /* 被開罰單時間 */
+
+ char pad_tail[28];
} PACKSTRUCT userec_t;
/* flags in userec_t.withme */
@@ -143,38 +157,38 @@ typedef struct userec_t {
/* TODO 動態更新的欄位不應該跟要寫入檔案的混在一起,
* 至少用個 struct 包起來之類 */
typedef struct boardheader_t { /* 256 bytes */
- char brdname[IDLEN + 1]; /* bid */
+ char brdname[IDLEN + 1]; /* bid */
char title[BTLEN + 1];
- char BM[IDLEN * 3 + 3]; /* BMs' userid, token '/' */
+ char BM[IDLEN * 3 + 3]; /* BMs' userid, token '/' */
char pad1[3];
- uint32_t brdattr; /* board的屬性 */
- char chesscountry;
- uint8_t vote_limit_posts; /* 連署 : 文章篇數下限 */
- uint8_t vote_limit_logins; /* 連署 : 登入次數下限 */
- uint8_t vote_limit_regtime; /* 連署 : 註冊時間限制 */
- time4_t bupdate; /* note update time */
- uint8_t post_limit_posts; /* 發表文章 : 文章篇數下限 */
- uint8_t post_limit_logins; /* 發表文章 : 登入次數下限 */
- uint8_t post_limit_regtime; /* 發表文章 : 註冊時間限制 */
- uint8_t bvote; /* 正舉辦 Vote 數 */
- time4_t vtime; /* Vote close time */
- uint32_t level; /* 可以看此板的權限 */
- time4_t perm_reload; /* 最後設定看板的時間 */
- int32_t gid; /* 看板所屬的類別 ID */
- int32_t next[2]; /* 在同一個gid下一個看板 動態產生*/
- int32_t firstchild[2]; /* 屬於這個看板的第一個子看板 */
- int32_t parent;
- int32_t childcount; /* 有多少個child */
- int32_t nuser; /* 多少人在這板 */
- int32_t postexpire; /* postexpire */
+ uint32_t brdattr; /* board的屬性 */
+ char chesscountry; /* 棋國 */
+ uint8_t vote_limit_posts; /* 連署 : 文章篇數下限 */
+ uint8_t expired_vote_limit_logins; /* (已停用) 連署 : 登入次數下限 */
+ uint8_t vote_limit_regtime; /* 連署 : 註冊時間限制 */
+ time4_t bupdate; /* note update time */
+ uint8_t post_limit_posts; /* 發表文章 : 文章篇數下限 */
+ uint8_t expired_post_limit_logins; /* (已停用) 發表文章 : 登入次數下限 */
+ uint8_t post_limit_regtime; /* 發表文章 : 註冊時間限制 */
+ uint8_t bvote; /* 正舉辦 Vote 數 */
+ time4_t vtime; /* Vote close time */
+ uint32_t level; /* 可以看此板的權限 */
+ time4_t perm_reload; /* 最後設定看板的時間 */
+ int32_t gid; /* 看板所屬的類別 ID */
+ int32_t next[2]; /* 在同一個gid下一個看板 動態產生*/
+ int32_t firstchild[2]; /* 屬於這個看板的第一個子看板 */
+ int32_t parent; /* 這個看板的 parent 看板 bid */
+ int32_t childcount; /* 有多少個child */
+ int32_t nuser; /* 多少人在這板 */
+ int32_t postexpire; /* postexpire */
time4_t endgamble;
char posttype[33];
char posttype_f;
- uint8_t fastrecommend_pause; /* 快速連推間隔 */
- uint8_t vote_limit_badpost; /* 連署 : 劣文上限 */
- uint8_t post_limit_badpost; /* 發表文章 : 劣文上限 */
+ uint8_t fastrecommend_pause; /* 快速連推間隔 */
+ uint8_t vote_limit_badpost; /* 連署 : 劣文上限 */
+ uint8_t post_limit_badpost; /* 發表文章 : 劣文上限 */
char pad3[3];
- time4_t SRexpire; /* SR Records expire time */
+ time4_t SRexpire; /* SR Records expire time */
char pad4[40];
} PACKSTRUCT boardheader_t;
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 7829bed9..528e61b4 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -399,8 +399,6 @@ int CheckPostRestriction(int bid)
// check first-login
if (cuser.firstlogin > (now - (time4_t)bp->post_limit_regtime * MONTH_SECONDS))
return 0;
- if (cuser.numlogins / 10 < (unsigned int)bp->post_limit_logins)
- return 0;
// XXX numposts itself is an integer, but some records (by del post!?) may
// create invalid records as -1... so we'd better make it signed for real
// comparison.
@@ -1967,8 +1965,7 @@ read_post(int ent, fileheader_t * fhdr, const char *direct)
}
void
-editLimits(unsigned char *pregtime, unsigned char *plogins,
- unsigned char *pposts, unsigned char *pbadpost)
+editLimits(unsigned char *pregtime, unsigned char *pposts, unsigned char *pbadpost)
{
char genbuf[STRLEN];
int temp;
@@ -1976,7 +1973,6 @@ editLimits(unsigned char *pregtime, unsigned char *plogins,
// load var
unsigned char
regtime = *pregtime,
- logins = *plogins,
posts = *pposts,
badpost = *pbadpost;
@@ -1989,14 +1985,6 @@ editLimits(unsigned char *pregtime, unsigned char *plogins,
} while (temp < 0 || temp > 255);
regtime = (unsigned char)temp;
- sprintf(genbuf, "%u", logins*10);
- do {
- getdata_buf(b_lines - 1, 0,
- "上站次數下限 (0~2550,以10為單位,個位數字將自動捨去):", genbuf, 5, NUMECHO);
- temp = atoi(genbuf);
- } while (temp < 0 || temp > 2550);
- logins = (unsigned char)(temp / 10);
-
sprintf(genbuf, "%u", posts*10);
do {
getdata_buf(b_lines - 1, 0,
@@ -2015,7 +2003,6 @@ editLimits(unsigned char *pregtime, unsigned char *plogins,
// save var
*pregtime = regtime;
- *plogins = logins;
*pposts = posts;
*pbadpost = badpost;
}
@@ -2044,7 +2031,6 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&bp->post_limit_regtime,
- &bp->post_limit_logins,
&bp->post_limit_posts,
&bp->post_limit_badpost);
@@ -2058,7 +2044,6 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&bp->vote_limit_regtime,
- &bp->vote_limit_logins,
&bp->vote_limit_posts,
&bp->vote_limit_badpost);
@@ -2072,7 +2057,6 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct)
editLimits(
&fhdr->multi.vote_limits.regtime,
- &fhdr->multi.vote_limits.logins,
&fhdr->multi.vote_limits.posts,
&fhdr->multi.vote_limits.badpost);
@@ -2974,7 +2958,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
snprintf(reason, sizeof(reason), "(已被%s刪除) <%s>",
cuser.userid, fhdr->owner);
move(3, 0); clrtoeol();
- getdata_str(2, 0, " >> 請輸入刪除後要顯示的標題: ■ ",
+ getdata_str(2, 0, " >> 請輸入刪除後要顯示的標題: □ ",
reason, sizeof(reason), DOECHO, reason);
if (!reason[0])
diff --git a/mbbsd/board.c b/mbbsd/board.c
index 7bfa3d22..5bf159c6 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -311,8 +311,7 @@ b_config(void)
while(!finished) {
// limits
- uint8_t llogin = bp->post_limit_logins,
- lpost = bp->post_limit_posts,
+ uint8_t lpost = bp->post_limit_posts,
lreg = bp->post_limit_regtime,
lbp = bp->post_limit_badpost;
@@ -439,23 +438,11 @@ b_config(void)
if (bp->brdattr & BRD_VOTEBOARD)
{
- llogin = bp->vote_limit_logins;
lpost = bp->vote_limit_posts;
lreg = bp->vote_limit_regtime;
lbp = bp->vote_limit_badpost;
}
- if (llogin)
- {
- move_ansi(ipostres++, COLPOSTRES);
- i = (int)llogin * 10;
- attr = (cuser.numlogins < i) ? 1 : 0;
- if (attr) outs(ANSI_COLOR(1;31));
- prints("上站次數 %d 次以上", i);
- if (attr) outs(ANSI_RESET);
- hasres = 1;
- }
-
if (lpost)
{
move_ansi(ipostres++, COLPOSTRES);
diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c
index 1cc08bb5..50c6053d 100644
--- a/mbbsd/voteboard.c
+++ b/mbbsd/voteboard.c
@@ -12,8 +12,6 @@ int CheckVoteRestriction(int bid)
// check first-login
if (cuser.firstlogin > (now - (time4_t)bcache[bid - 1].vote_limit_regtime * MONTH_SECONDS))
return 0;
- if (cuser.numlogins / 10 < (unsigned int)bcache[bid - 1].vote_limit_logins)
- return 0;
if (cuser.numposts / 10 < (unsigned int)bcache[bid - 1].vote_limit_posts)
return 0;
if (cuser.badpost > (255 - (unsigned int)bcache[bid - 1].vote_limit_badpost))
@@ -31,8 +29,6 @@ int CheckVoteRestrictionFile(const fileheader_t * fhdr)
// check first-login
if (cuser.firstlogin > (now - (time4_t)fhdr->multi.vote_limits.regtime * MONTH_SECONDS))
return 0;
- if (cuser.numlogins / 10 < (unsigned int)fhdr->multi.vote_limits.logins)
- return 0;
if (cuser.numposts / 10 < (unsigned int)fhdr->multi.vote_limits.posts)
return 0;
if (cuser.badpost > (255 - (unsigned int)fhdr->multi.vote_limits.badpost))
@@ -396,7 +392,6 @@ do_voteboard(int type)
/* use lower 16 bits of 'money' to store limits */
/* lower 8 bits are posts, higher 8 bits are logins */
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;
votefile.multi.vote_limits.badpost = bcache[currbid - 1].vote_limit_badpost;
setbdir(genbuf, currboard);
diff --git a/util/shmctl.c b/util/shmctl.c
index 3372d9f0..39c0fdbd 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -664,7 +664,6 @@ int listbrd(int argc, char **argv)
printf("\n");
printf("post_limit_posts:\t%d\n", b.post_limit_posts);
- printf("post_limit_logins:\t%d\n", b.post_limit_logins);
printf("post_limit_regtime:\t%d\n", b.post_limit_regtime);
printf("level:\t%d\n", b.level);
printf("gid:\t%d\n", b.gid);
diff --git a/util/showboard.c b/util/showboard.c
index 41627cfe..8e18ae2d 100644
--- a/util/showboard.c
+++ b/util/showboard.c
@@ -68,7 +68,6 @@ int main(int argc, char *argv[])
printf("BM:\t%s\n", b.BM);
printf("brdattr:\t%08x\n", b.brdattr);
printf("post_limit_posts:\t%d\n", b.post_limit_posts);
- printf("post_limit_logins:\t%d\n", b.post_limit_logins);
printf("post_limit_regtime:\t%d\n", b.post_limit_regtime);
printf("level:\t%d\n", b.level);
printf("gid:\t%d\n", b.gid);