]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/poll.pm
Use local paths for redirection where possible
[ikiwiki.git] / IkiWiki / Plugin / poll.pm
index 5ac5b818de872e16ecd9470f77c2d6a6486cdd20..988f4c11335a00726a23496be8390bb815a96880 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::poll;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 use Encode;
 
 sub import {
@@ -17,6 +17,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => undef,
+                       section => "widget",
                },
 }
 
@@ -102,7 +103,7 @@ sub sessioncgi ($$) {
                my $oldchoice=$session->param($choice_param);
                if (defined $oldchoice && $oldchoice eq $choice) {
                        # Same vote; no-op.
-                       IkiWiki::redirect($cgi, urlto($page, undef, 1));
+                       IkiWiki::redirect($cgi, urlto($page, undef));
                        exit;
                }
 
@@ -133,9 +134,12 @@ sub sessioncgi ($$) {
                $oldchoice=$session->param($choice_param);
                if ($config{rcs}) {
                        IkiWiki::disable_commit_hook();
-                       IkiWiki::rcs_commit($pagesources{$page}, "poll vote ($choice)",
-                               IkiWiki::rcs_prepedit($pagesources{$page}),
-                               $session->param("name"), $ENV{REMOTE_ADDR});
+                       IkiWiki::rcs_commit(
+                               file => $pagesources{$page},
+                               message => "poll vote ($choice)",
+                               token => IkiWiki::rcs_prepedit($pagesources{$page}),
+                               session => $session,
+                       );
                        IkiWiki::enable_commit_hook();
                        IkiWiki::rcs_update();
                }
@@ -149,7 +153,7 @@ sub sessioncgi ($$) {
                error($@) if $@;
                my $cookie = CGI::Cookie->new(-name=> $session->name, -value=> $session->id);
                print $cgi->redirect(-cookie => $cookie,
-                       -url => urlto($page, undef, 1));
+                       -url => urlto($page, undef));
                exit;
        }
 }