Skip to content
Snippets Groups Projects
Commit 3defe4f4 authored by rswindell's avatar rswindell
Browse files

If a user can't post messages on a sub-board, they shouldn't be able to post

polls either.
If the 'votes=<val>' argument isn't specified, the votes (max votes per ballot)
value is prompted for. This number must be > 1 for multiple-answer polls.
parent 18841a57
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,13 @@ if(!basecode && js.global.bbs)
while(!basecode)
basecode = prompt("message base");
if(!msg_area.sub[basecode.toLowerCase()].can_post) {
alert("Sorry, you can't post on sub-board: " + basecode);
exit();
}
if(msg_area.sub[basecode.toLowerCase()].settings&SUB_NOVOTING) {
alert("No voting allowed in sub-board: " + basecode);
alert("No voting (and thus, no polls) allowed in sub-board: " + basecode);
exit();
}
var msgbase = MsgBase(basecode);
......@@ -39,7 +44,7 @@ if(!msgbase.open()) {
exit();
}
print("Posting Poll to sub-board: " + basecode);
print("\1n\1h\1bPosting Poll to sub-board: \1w" + basecode);
var poll = { field_list: [] };
if(!(poll.subject = prompt("Poll question")))
......@@ -70,7 +75,12 @@ if(js.global.bbs) {
}
if(option["votes"])
poll.votes = option["votes"];
print("posted from: " + poll.from);
else {
printf("Maximum answers/votes per ballot [1]: ");
poll.votes = console.getnum(count, 1);
}
if(!js.global.bbs)
print("Posting poll from: " + poll.from);
poll.to = "All";
if(!msgbase.add_poll(poll))
alert("Error " + msgbase.status + " " + msgbase.last_error);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment