use warnings;
use strict;
-use IkiWiki;
+use IkiWiki 2.00;
sub import { #{{{
hook(type => "preprocess", id => "poll", call => \&preprocess);
- hook(type => "cgi", id => "poll", call => \&cgi);
+ hook(type => "sessioncgi", id => "poll", call => \&sessioncgi);
} # }}}
sub yesno ($) { #{{{
return "<div class=poll>$ret</div>";
} # }}}
-sub cgi ($) { #{{{
+sub sessioncgi ($$) { #{{{
my $cgi=shift;
+ my $session=shift;
if (defined $cgi->param('do') && $cgi->param('do') eq "poll") {
my $choice=$cgi->param('choice');
if (! defined $choice) {
# Did they vote before? If so, let them change their vote,
# and check for dups.
- my $session=IkiWiki::cgi_getsession();
my $choice_param="poll_choice_${page}_$num";
my $oldchoice=$session->param($choice_param);
if (defined $oldchoice && $oldchoice eq $choice) {
IkiWiki::cgi_savesession($session);
$oldchoice=$session->param($choice_param);
if ($config{rcs}) {
- disable_commit_hook();
+ IkiWiki::disable_commit_hook();
IkiWiki::rcs_commit($pagesources{$page}, "poll vote ($choice)",
IkiWiki::rcs_prepedit($pagesources{$page}),
$session->param("name"), $ENV{REMOTE_ADDR});
- enable_commit_hook();
- rcs_update();
+ IkiWiki::enable_commit_hook();
+ IkiWiki::rcs_update();
}
require IkiWiki::Render;
IkiWiki::refresh();