From f42007878be40e378ae856a8799ac61ced26ef25 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 1 Feb 2013 16:12:27 +0000 Subject: Check violate law in vote (same logic as voteboard). git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5787 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/vote.c | 18 ++++++++++-------- 1 file 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] -- cgit v1.2.3