Commit info for scoop/lib/Scoop/Admin:
Modified Files:
Polls.pm
Log Message:
hulver's patch for bug 20, polls lose votes on story edit
-janra
Index: Polls.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Admin/Polls.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -r1.14 -r1.15
569a570,575
> # Quote stuff for the DB's pleasure
> $question = $S->{DBH}->quote($question);
> $editqid = $S->{DBH}->quote($editqid);
> $newqid = $S->{DBH}->quote($newqid);
> $question = $S->filter_subject($question);
> my $set = qq| qid = $newqid, question = $question,post_date="$current_time"|;
573a580
>
575,579d581
< for(my $num=1; $num<= $S->{UI}->{VARS}->{poll_num_ans}; $num++) {
< my $vote_count = 'votes' . $num;
< my $these_votes = $S->{CGI}->param($vote_count);
< $voters += int $these_votes;
< }
581,586c583,593
< # Quote stuff for the DB's pleasure
< $question = $S->{DBH}->quote($question);
< $editqid = $S->{DBH}->quote($editqid);
< $newqid = $S->{DBH}->quote($newqid);
<
< $question = $S->filter_subject($question);
---
> # make sure they can't set # votes unless they are an admin
> if ($S->have_perm('edit_polls') && $S->{UI}->{VARS}->{allow_ballot_stuffing}) {
> for(my $num=1; $num<= $S->{UI}->{VARS}->{poll_num_ans}; $num++) {
> my $vote_count = 'votes' . $num;
> my $these_votes = $S->{CGI}->param($vote_count);
> $voters += int $these_votes;
> }
> $set .= qq|, voters = "$voters"|;
> } else {
> $voters = 0;
> }
592c599
< SET => qq| qid = $newqid, question = $question, voters = "$voters",post_date="$current_time"|,
---
> SET => $set,
601c608
< SET => qq| qid = $newqid|,
---
> SET => qq| qid = $newqid|,
636c643
<
---
> my $setvotes = 0;
638c645,647
< unless ($S->have_perm('edit_polls') && $S->{UI}->{VARS}->{allow_ballot_stuffing}) {
---
> if ($S->have_perm('edit_polls') && $S->{UI}->{VARS}->{allow_ballot_stuffing}) {
> $setvotes = 1;
> } else {
662a672,675
>
> my $set = qq|answer=$answer|;
> $set .= qq|, votes=$votes| if ($setvotes);
>
666c679
< SET => qq|answer=$answer, votes=$votes|,
---
> SET => $set,