]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/poll.pm
Merge branch 'master' of ssh://git.kitenet.net/srv/git/ikiwiki.info
[ikiwiki.git] / IkiWiki / Plugin / poll.pm
index 4eae6a349383e50edfa60b336cde3aca6a479cb3..41ebd74a00763f2bff17e952c2d72047061d7216 100644 (file)
@@ -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 "<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) {
@@ -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();