diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-02-02 00:12:27 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2013-02-02 00:12:27 +0800 |
commit | f42007878be40e378ae856a8799ac61ced26ef25 (patch) | |
tree | 8734fcb49b33ddcac710bcab0d51e35ca955da4e | |
parent | 53f6d9f2bc50dc679a03e3ee71771f2124295918 (diff) | |
download | pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar.gz pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar.bz2 pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar.lz pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar.xz pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.tar.zst pttbbs-f42007878be40e378ae856a8799ac61ced26ef25.zip |
Check violate law in vote (same logic as voteboard).
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5787 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/vote.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pttbbs/mbbsd/vote.c b/pttbbs/mbbsd/vote.c index 24df4859..5e23a2c0 100644 --- a/pttbbs/mbbsd/vote.c +++ b/pttbbs/mbbsd/vote.c @@ -981,10 +981,14 @@ user_vote_one(const vote_buffer_t *vbuf, const char *bname) static const char * voteperm_msg(const char *bname) { + const char *msg; + if (!HasBasicUserPerm(PERM_LOGINOK)) return "對不起! 您未完成註冊程序, 還沒有投票權喔!"; - const char *msg; + if (HasUserPerm(PERM_VIOLATELAW)) + return "罰單未繳清,無法投票。"; + if ((msg = banned_msg(bname)) != NULL) return msg; @@ -1002,6 +1006,7 @@ user_vote(const char *bname) char genbuf[STRLEN]; char inbuf[80]; vote_buffer_t vbuf; + const char *msg; if ((bid = getbnum(bname)) <= 0) return 0; @@ -1015,13 +1020,10 @@ user_vote(const char *bname) vmsg("目前並沒有任何投票舉行。"); return FULLUPDATE; } - do { - const char *msg; - if ((msg = voteperm_msg(bname)) != NULL) { - vmsg(msg); - return FULLUPDATE; - } - } while (0); + if ((msg = voteperm_msg(bname)) != NULL) { + vmsg(msg); + return FULLUPDATE; + } // XXX I think such loop is ineffective... // According to the creation code, the vote is ranged as [1..MAX_VOTE_NR] |