X-Git-Url: https://code.th-h.de/?p=usenet%2Fusevote.git;a=blobdiff_plain;f=uvvote.pl;h=9505edc301a33c8f34443a6ede12edf7e744d83e;hp=5dd26ff6092576048959f755abd7fce51bff6168;hb=a374bef4c7e8de63bc43471d5a3d2795173a1070;hpb=a384e31e542e2520ebc1e2402a86fad5507b7da2 diff --git a/uvvote.pl b/uvvote.pl old mode 100644 new mode 100755 index 5dd26ff..9505edc --- a/uvvote.pl +++ b/uvvote.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl -w ############################################################################### -# UseVoteGer 4.07 Wahldurchfuehrung -# (c) 2001-2004 Marc Langer +# UseVoteGer 4.09 Wahldurchfuehrung +# (c) 2001-2005 Marc Langer # # This script package is free software; you can redistribute it and/or # modify it under the terms of the GNU Public License as published by the @@ -37,7 +37,7 @@ use UVtemplate; my $clean = 0; my %opt_ctl = (); -print "\n$usevote_version Wahldurchfuehrung - (c) 2001-2004 Marc Langer\n\n"; +print "\n$usevote_version Wahldurchfuehrung - (c) 2001-2005 Marc Langer\n\n"; # unknown parameters remain in @ARGV (for "help") Getopt::Long::Configure(qw(pass_through bundling)); @@ -122,9 +122,9 @@ if ($clean) { # normally unixtime is sufficient, if it is not unique append our PID my $ext = time; - opendir (TMP, $config{tmpdir}); - my @tmpfiles = readdir (TMP); - closedir (TMP); + opendir (DIR, $config{tmpdir}); + my @tmpfiles = readdir (DIR); + closedir (DIR); opendir (FERTIG, $config{archivedir}); my @fertigfiles = readdir (FERTIG); closedir (FERTIG); @@ -158,7 +158,7 @@ if ($clean) { # no mails: exit here unless ($count) { - print UVmessage::get("VOTE_NO_VOTES") . "\n\n"; + print UVmessage::get("VOTE_NO_VOTEMAILS") . "\n\n"; exit 0; } @@ -216,7 +216,7 @@ sub process_vote { my @header = split(/\n/, $entity->stringify_header); my $head = $entity->head; my $msgid = $head->get('Message-ID'); - chomp($msgid) if defined($msgid); + chomp($msgid) if ($msgid); my @votes = (); # the votes my @set; # interactively changed fields @@ -224,6 +224,7 @@ sub process_vote { my $onevote = 0; # 0=no votes, 1=everything OK, 2=vote cancelled my $voteerror = ""; # error message in case of invalid vote my $ballot_id = ""; # ballot id (German: Wahlscheinkennung) + my $voting = ""; # voting (should be votename) # found address? if ($voter_addr) { @@ -239,6 +240,15 @@ sub process_vote { push (@errors, 'InvalidAddress'); } + # correct voting? + if ($$body =~ /\Q$config{ballotintro}\E\s+(.+?)\s*\n([>:|]*?[\t ]+(\S+.+)\s*$)?/m) { + $voting = $1; + $voting .= " $3" if (defined($3) and $3 !~ /\Q$config{nametext}\E/); + push (@errors, 'WrongVoting') if ($config{votename} !~ /^\s*\Q$voting\E\s*$/); + } else { + push (@errors, 'NoVoting'); + } + # personalized ballots? if ($config{personal}) { if ($$body =~ /$config{ballotidtext}\s+([a-z0-9]+)/) { @@ -343,7 +353,7 @@ sub process_vote { # Errors encountered? if (@errors) { my $res = UVmenu::menu(\@votes, \@header, $body, \$voter_addr, \$voter_name, - \$ballot_id, \@set, \@errors); + \$ballot_id, \$voting, \@set, \@errors); return 0 if ($res eq 'i'); # "Ignore": Ignore vote, don't save my $tpl; @@ -402,6 +412,12 @@ sub process_vote { my $msg = $template->processTemplate($config{tpl_bdsg_error}); UVsendmail::mail($voter_addr, "Fehler", $msg, $msgid) if ($config{voteack}); return 0; + } elsif ($error{NoVoting} or $error{WrongVoting}) { + $voteerror = UVmessage::get("VOTE_WRONG_VOTING"); + my $template = UVtemplate->new(); + $template->setKey('body' => $$body); + my $msg = $template->processTemplate($config{tpl_wrong_voting}); + UVsendmail::mail($voter_addr, "Fehler", $msg, $msgid) if ($config{voteack}); } elsif ($error{NoVote}) { $voteerror = UVmessage::get("VOTE_NO_VOTES"); my $template = UVtemplate->new();