X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/c60477228c6b4d5e00c7bdb3b895e9f30d00ea97..5c0e0e19d17ceb8f2ad3027db652f3ef147212fe:/IkiWiki/Plugin/poll.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 4eae6a349..41ebd74a0 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -3,11 +3,11 @@ package IkiWiki::Plugin::poll; 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 ($) { #{{{ @@ -74,8 +74,9 @@ sub preprocess (@) { #{{{ return "
$ret
"; } # }}} -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) { @@ -92,7 +93,6 @@ sub cgi ($) { #{{{ # 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) { @@ -125,12 +125,12 @@ sub cgi ($) { #{{{ 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();