Embedded Polls (addon) 2.2a This is an addon for PollMod 2.2 which makes it possible to let Guests vote. - Guests can only vote once - You can enable it with [GUEST] (default when starting a Poll) ATTENTION: - The file ubbc.js must be in the same directory as YaBB.pl to apply MOD D2N ubbc.js function poll() { AddTxt="[poll]\r[opt] 1 [/opt]\r[opt] 2 [/opt]\r[opt] 3 [/opt]\r[/poll] \r [LOCK]"; AddText(AddTxt); } function poll() { AddTxt="[poll]\r[opt] 1 [/opt]\r[opt] 2 [/opt]\r[opt] 3 [/opt]\r[/poll] \r[LOCK]\r[GUEST]"; AddText(AddTxt); } sources/Subs.pl if( $message =~ m~\[poll\]~i ) { $chk = 'checked'; $message =~ s~\n{0,1}\[poll\]\n*(.+?)\n*\[/poll\]\n{0,1}~
$1

~isg; while( $message =~ s~\
~ $2 $3
~is ) {$chk = "";} }
if( $message =~ m~\[poll\]~i ) { $chk = 'checked'; if( $message =~ m~\[guest\]~i ) { $message =~ s/\[GUEST\]//gi; $HiddenGuest = ""; } else { $HiddenGuest = ""; } $message =~ s~\n{0,1}\[poll\]\n*(.+?)\n*\[/poll\]\n{0,1}~
$HiddenGuest $1

~isg; while( $message =~ s~\
~ $2 $3
~is ) {$chk = "";} }
sources/Display.pl #if the person has voted lets remove the submit and all and let him just see what the choices were/ if( $message =~ m~\[poll\]~i ) { $message =~ s/\[POLL\]//gi; $message =~ s/\[\/POLL\]//gi; $message =~ s~\[opt\](.+?)\[/opt\]~$txt{'901'} $1~isg; } #if the person has voted lets remove the submit and all and let him just see what the choices were/ if( $message =~ m~\[poll\]~i ) { $message =~ s/\[POLL\]//gi; $message =~ s/\[\/POLL\]//gi; $message =~ s~\[opt\](.+?)\[/opt\]~$txt{'901'} $1~isg; $message =~ s/\[GUEST\]//gi; } sources/Poll.pl if($username eq 'Guest') { &fatal_error($txt{'223'}); } &readform; &readform; # When [GUEST] is used, a quest can vote! $message = $FORM{'message'}; if($username eq 'Guest' && $INFO{'guest'} eq "no") { &fatal_error($txt{'223'}); } #lets see if this person has rated before! foreach $curpolled (@polled) { ($polledkey,$polledname) = split(/\|/,$curpolled); if($settings[2] eq "$polledkey") { $haspolled = 1; break; } } #lets see if this person has rated before! foreach $curpolled (@polled) { ($polledkey,$polledname) = split(/\|/,$curpolled); if($username ne 'Guest' && $settings[2] eq "$polledkey") { $haspolled = 1; break; } if($username eq 'Guest' && 'Guest' . $ENV{'REMOTE_ADDR'} eq "$polledname") { $haspolled = 1; break; } } fopen(FILE, ">>$datadir/$viewnum.polled", 1) || &fatal_error("$txt{'23'} $viewnum.polled"); print FILE "$settings[2]|$username\n"; fclose(FILE); fopen(FILE, ">>$datadir/$viewnum.polled", 1) || &fatal_error("$txt{'23'} $viewnum.polled"); if ($username ne 'Guest') { print FILE "$settings[2]|$username\n"; } else { print FILE "$settings[2]|$username . $ENV{'REMOTE_ADDR'}\n"; } fclose(FILE);