~;
# Censor the question.
foreach (@censored) {
($tmpa,$tmpb) = @{$_};
$question =~ s~\Q$tmpa\E~$tmpb~gi;
}
if (($userhasvoted) || $viewresults eq 'yes' || $pollislocked eq 1 ) {
$yymain.= qq~
$polltxt{'16'}: $question
|
~;
$nums = 0;
my $Key;
my $Total;
$maxvote = 0;
foreach $Key (@votes) {
$Total += $Key;
if ($Key >= $maxvote) { $maxvote = $Key;}
}
$totalvotes = $Total;
pop (@options);
foreach (@options) {
# Censor the options.
foreach (@censored) {
($tmpa,$tmpb) = @{$_};
$options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi;
}
$message = $options[$nums]; # put the message back into the proper variable to do ubbc on it
if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys;
$options[$nums] = $message;
$options[$nums] =~ s~\n~~g;
$options[$nums] =~ s~ ~~g;
$yymain .= qq~
$options[$nums] |
~;
# Now lets calculate how many devisions by the total number of votes are needed to make the bar graphs stay nicely sized in the browser window:
$pollpercent = 0;
$pollbar = 0;
if ($totalvotes ne 0 && $maxvote ne 0) {
$pollpercent = int(1000 * $votes[$nums] / $totalvotes);
$pollpercent = $pollpercent / 10;
$pollbar = int( 150 * $votes[$nums] / $maxvote);
}
$yymain .= qq~   $votes[$nums] ($pollpercent%) |
~;
$nums++;
}
$yymain .= qq~
$polltxt{'17'}: $totalvotes
|
~;
}
else {
$yymain.= qq~
|