Poll Mod Global Mod Patch - SP1 2.3 **MOD** This mod adds poll capability to your YaBB 1 Gold SP1 Board. The polls themselves are similar to that of vB and YaBB SE. To install, place Poll.pl in your /Sources directory, place the images into your YaBBImages directory and install the mod file as usual with BoardMod. Have fun! Changes in version 1.2: All known bugs should be fixed! ;) **Patch** This is to add the Polls mod to a forum with Global Mods. Installation: Uninstall the mod first, then install the Global Mod or the Anouncment board with the Global Mod Patch, and then install this Patch. Note** this is my clan's website, do not use it to report bugs! Only to talk to me, if necassary. Halcyon http://jghq.netfirms.com/cgi-bin/yabb/YaBB.pl Sources/Display.pl if( $endthread eq $prevtopic && $gonext eq "") { $nav = qq~« $txt{'766'} | $txt{'766'} »~; } if($endthread eq $prevtopic && $gonext ne "") { $nav = qq~« $txt{'766'} | $txt{'767'} »~; } if ( $endthread ne $prevtopic && $gonext eq "") { $nav = qq~« $txt{'768'} | $txt{'766'} »~; } if ($endthread ne $prevtopic && $gonext ne "") { $nav = qq~« $txt{'768'} | $txt{'767'} »~; } $yymain .= qq~
   $mbname
   $cat
   $boardname
$showmods
   $curthreadurl
$nav
$txt{'139'}: $pageindex $replybutton$notify$menusep $img{'sendtopic'}$menusep $img{'print'}
~; # Look for a poll file for this thread. if (-e "$datadir/$viewnum.poll") { $pollthread = 1; } if ($pollthread) { fopen (FILE, "$datadir/$viewnum.poll"); @polldata = ; fclose (FILE); $pollquestion = $polldata[0]; @polldata2 = @polldata; ($blah1, $blah2) = split(/\|/, $polldata2[0]); if ($blah2) { $num = 0; fopen (FILE, "$datadir/$viewnum.txt"); @postdata = ; fclose (FILE); ($msubject, $blah) = split(/\|/, $postdata[0]); $pollquestion = $msubject; } else {$num = 1; } $line = 0; my @options; my @votes; foreach $pointer (@polldata) { ($vote, $option) = split(/\|/, $polldata[$num]); $options[$line] = $option; $votes[$line] = $vote; $line++; $num++; } if ($blah2) { $options[$line++] = ""; } $search = -1; my $found; fopen (FILE, "$memberdir/$username.dat"); @usersdata = ; fclose (FILE); chop $usersdata[2]; chop $usersdata[7]; $usersemail = $usersdata[2]; $userstatus = $usersdata[7]; fopen(FILE, "$datadir/$viewnum.polled"); while( $LineNum = ) { ($useremail, $usersname) = split(/\|/, $LineNum); ++$search; if ( $usersname =~ /\b$username\b/ or $useremail =~ /\b$usersemail\b/) { $found = 1; last; } } close(FILE); if ($found) { $userhasvoted = 1; } $viewresults = $INFO{'viewresults'}; fopen (FILE, "$datadir/$viewnum.txt"); @threaddata = ; fclose (FILE); ($subject, $dname, $semail, $data, $susername, $junk) = split(/\|/, $threaddata[0]); if (-e "$datadir/$viewnum.polll") { $pollislocked = 1; } if ($username ne "Guest" && $username eq $susername && $pollislocked ne 1) { $lockpoll = qq~$polltxt{'20'}~; } if ($username ne "Guest" && $username eq $susername && $pollislocked eq 1) { $lockpoll = qq~$polltxt{'21'}~; } if ($userstatus eq "Administrator" && $pollislocked ne 1 or $userstatus eq "Global Moderator" && $pollislocked ne 1 or exists $moderators{$username} && $pollislocked ne 1) { $lockpoll = qq~$polltxt{'20'}~; } if ($userstatus eq "Administrator" && $pollislocked eq 1 or $userstatus eq "Global Moderator" && $pollislocked eq 1 or exists $moderators{$username} && $pollislocked eq 1) { $lockpoll = qq~$polltxt{'21'}~; } if ($pollislocked eq 1) { $endedtext = $polltxt{'22'}; } if ($userhasvoted and $username ne "Guest" or $viewresults eq 'yes' or $pollislocked eq 1) { # Censor the question. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $pollquestion =~ s~\Q$tmpa\E~$tmpb~gi; } $yymain.= qq~
 $img{'pollicon'} $polltxt{'15'}
$polltxt{'16'}: $pollquestion    $endedtext

  ~; $nums = 0; my $Key; my $Total; foreach $Key (@votes) { $Total += $Key; } $totalvotes = $Total; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $yymain .= qq~ ~; $nums++; } $yymain .= qq~
$options[$nums]   ~; unless ($votes[$nums] eq 0) { $votepercent = ( $votes[$nums] / $totalvotes ); $pollbarpercent = ($votepercent * 100); $votepercent = ($votepercent * 100); # 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: if ($totalvotes <= "10000" && $totalvotes => "5001") { $pollbar = ($pollbarpercent / 1000); } if ($totalvotes <= "5000" && $totalvotes => "1001") { $pollbar = ($pollbarpercent / 100); } if ($totalvotes <= "1000" && $totalvotes => "501") { $pollbar = ($pollbarpercent / 50); } if ($totalvotes <= "500" && $totalvotes => "101") { $pollbar = ($pollbarpercent / 15); } if ($totalvotes <= "100" && $totalvotes => "51") { $pollbar = ($pollbarpercent / 8); } if ($totalvotes <= "50" && $totalvotes => "11") { $pollbar = ($pollbarpercent *2); } if ($totalvotes <= "10" && $totalvotes => "1" && $votes[$nums] => "1") { $pollbar = ($pollbarpercent *4); } } else { $pollbar = 0; } unless ($totalvotes eq 0) { $pollpercent = ( $votes[$nums] * 100 / $totalvotes); } my($roundedpercent) = shift; $pollpercent = int($pollpercent + .5); $yymain .= qq~   $votes[$nums] ($pollpercent%)

$polltxt{'17'}: $totalvotes   $lockpoll

~; } else { $board = $INFO{'board'}; # Censor the question. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $pollquestion =~ s~\Q$tmpa\E~$tmpb~gi; } $yymain.= qq~
 $img{'pollicon'} $polltxt{'15'}
$polltxt{'16'}: $pollquestion

  ~; $nums = 0; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $yymain .= qq~ ~; $nums++; } $yymain .= qq~
$options[$nums]
$polltxt{'19'}  $lockpoll
~; } } $yymain .= qq~
Sources/MessageIndex.pl $yymain .= qq~ $menusep$img{'newthread'}  $yymain .= qq~ $menusep$img{'newthread'} $img{'createpoll'}  $yymain .= qq~ $menusep$img{'newthread'}  $yymain .= qq~ $menusep$img{'newthread'} $img{'createpoll'}  foreach $curnum (@stickys) { if ($mnum == $curnum) { if($threadclass eq 'locked') { $threadclass = 'stickylock'; } else { $threadclass = 'sticky'; } } } $pollthread = 0; if (-e "$datadir/$mnum.poll") { $pollthread = 1; } if (-e "$datadir/$mnum.polll") {$pollimg = qq~$img{'polliconclosed'}~;} else { $pollimg = qq~$img{'pollicon'}~; } $mydate = &timeformat($mdate); $yymain .= qq~ $new $msub $pages $mname $mreplies $views $mydate
$txt{'525'} $lastpostername
~; ++$counter;
$mydate = &timeformat($mdate); if ($pollthread eq 1) { $yymain .= qq~ $new $msub $pages $mname $mreplies $views $mydate
$txt{'525'} $lastpostername
$pollimg ~; } else { $yymain .= qq~ $new $msub $pages $mname $mreplies $views $mydate
$txt{'525'} $lastpostername
~; } ++$counter;
Sources/RemoveThread.pl unlink("$datadir/$thread.txt"); unlink("$datadir/$thread.mail"); unlink("$datadir/$thread.data"); unlink("$datadir/$thread.poll"); unlink("$datadir/$thread.polled"); unlink("$datadir/$thread.polll"); Sources/RemoveOldThreads.pl unlink("$datadir/$num.txt"); unlink("$datadir/$num.mail"); unlink("$datadir/$num.data"); unlink("$datadir/$num.poll"); unlink("$datadir/$num.polled"); unlink("$datadir/$num.polll"); Sources/ModifyMessage.pl unlink("$datadir/$tnum.txt"); unlink("$datadir/$tnum.mail"); unlink("$datadir/$tnum.data"); unlink("$datadir/$tnum.poll"); unlink("$datadir/$tnum.polled"); unlink("$datadir/$tnum.polll"); Sources/ManageBoards.pl unlink("$datadir/$id\.txt"); unlink("$datadir/$id\.mail"); unlink("$datadir/$id\.data"); unlink("$datadir/$id\.poll"); unlink("$datadir/$id\.polled"); unlink("$datadir/$id\.polll"); Sources/ManageCats.pl unlink("$datadir/$id.txt"); unlink("$datadir/$id.mail"); unlink("$datadir/$id.data"); unlink("$datadir/$id.poll"); unlink("$datadir/$id.polled"); unlink("$datadir/$id.polll"); Sources/Subs.pl $message =~ s~~\n~g; &ToHTML($message); $message =~ s~\t~      ~g; $message =~ s~\n~
~g;
$message =~ s~\[poll\](.+?)\[/poll\]~~isg; English.lng $txt{'796'} = "Your Instant Messages:"; $polltxt{'1'} = "Create Poll"; $polltxt{'2'} = "Create+Poll"; $polltxt{'3'} = "Create Poll"; $polltxt{'4'} = "Poll Question"; $polltxt{'5'} = "shortcuts (IE and NS6 only): hit alt+s to send or alt+r to reset"; $polltxt{'6'} = "Question"; $polltxt{'7'} = "Option 1"; $polltxt{'8'} = "Option 2"; $polltxt{'9'} = "Option 3"; $polltxt{'10'} = "Option 4"; $polltxt{'11'} = "Option 5"; $polltxt{'12'} = "Option 6"; $polltxt{'13'} = "Option 7"; $polltxt{'14'} = "Option 8"; $polltxt{'15'} = "Poll"; $polltxt{'16'} = "Question"; $polltxt{'17'} = "Total votes"; $polltxt{'18'} = "Submit Vote"; $polltxt{'19'} = "View Results"; $polltxt{'20'} = "Lock voting"; $polltxt{'21'} = "Unlock voting"; $polltxt{'22'} = "This poll has ended. Here are the results:"; $polltxt{'23'} = "A closed poll"; $polltxt{'24'} = "An open poll"; $img{'website_sm'} = qq~$txt{'515'}~; $img{'createpoll'} = qq~$polltxt{'1'}~; $img{'website_sm'} = qq~$txt{'515'}~; $img{'createpoll'} = qq~$polltxt{'1'} $polltxt{'1'}~; $img{'pollicon'} = qq~$polltxt{'24'}~; $img{'polliconclosed'} = qq~$polltxt{'23'}~; YaBB.pl if ($action eq 'createcat') { require "$sourcedir/ManageCats.pl"; &CreateCat; } elsif ($action eq 'clean_log') { require "$sourcedir/Admin.pl"; &clean_log; } elsif ($action eq 'createpoll') { require "$sourcedir/Poll.pl"; &CreatePoll; } elsif ($action eq 'createpoll2') { require "$sourcedir/Poll.pl"; &CreatePoll2; } elsif ($action eq 'editnews2') { require "$sourcedir/AdminEdit.pl"; &EditNews2; } elsif ($action eq 'editnews2gm') { require "$sourcedir/MemberGroups.pl"; &EditNews2; } elsif ($action eq 'usersrecentposts') { require "$sourcedir/Profile.pl"; &usersrecentposts; } elsif ($action eq 'vote') { require "$sourcedir/Poll.pl"; &DoVote; } elsif ($action eq 'unlockpoll') { require "$sourcedir/Poll.pl"; &UnlockPoll; } elsif ($action eq 'login2') { require "$sourcedir/LogInOut.pl"; &Login2; } elsif ($action eq 'logout') { require "$sourcedir/LogInOut.pl"; &Logout; } elsif ($action eq 'lock') { require "$sourcedir/LockThread.pl"; &LockThread; } elsif ($action eq 'lockpoll') { require "$sourcedir/Poll.pl"; &LockPoll; }