# normally unixtime is sufficient, if it is not unique append our PID
my $ext = time;
- opendir (TMP, $config{tmpdir});
+ opendir (DIR, $config{tmpdir});
my @tmpfiles = readdir (DIR);
- closedir (TMP);
+ closedir (DIR);
opendir (FERTIG, $config{archivedir});
my @fertigfiles = readdir (FERTIG);
closedir (FERTIG);
# no mails: exit here
unless ($count) {
- print UVmessage::get("VOTE_NO_VOTES") . "\n\n";
+ print UVmessage::get("VOTE_NO_VOTEMAILS") . "\n\n";
exit 0;
}
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) {
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]+)/) {
# Should read like this: #a [ STIMME ] Text
# (Text is configurable in usevote.cfg)
unless ($$body =~ /$bdsg_regexp/s &&
- $$body =~ /#a\W*?\[\W*?$config{ja_stimme}\W*?\]\W*?$bdsg2_regexp/is) {
+ $$body =~ /#a\W*?\[\W*?$config{bdsg_confirm}\W*?\]\W*?$bdsg2_regexp/is) {
push (@errors, 'InvalidBDSG');
}
# 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;
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();