web commit by http://ethan.betacantrips.com/: like this
[ikiwiki.git] / doc / todo / cgi_hooks_get_session_objects.mdwn
1 This patch gives CGI hooks access to the session object. This enables more 
2 complicated CGI plugins (that require access control, for example). --Ethan
3
4 <pre>
5 Index: IkiWiki/CGI.pm
6 ===================================================================
7 --- IkiWiki/CGI.pm      (revision 3946)
8 +++ IkiWiki/CGI.pm      (working copy)
9 @@ -636,7 +636,7 @@
10         
11                 $q=CGI->new;
12         
13 -               run_hooks(cgi => sub { shift->($q) });
14 +               run_hooks(cgi => sub { shift->($q, $session) });
15         }
16  
17         my $do=$q->param('do');
18 Index: IkiWiki/Plugin/search.pm
19 ===================================================================
20 --- IkiWiki/Plugin/search.pm    (revision 3946)
21 +++ IkiWiki/Plugin/search.pm    (working copy)
22 @@ -72,7 +72,7 @@
23         estcfg();
24  } #}}}
25  
26 -sub cgi ($) { #{{{
27 +sub cgi ($$) { #{{{
28         my $cgi=shift;
29  
30         if (defined $cgi->param('phrase') || defined $cgi->param("navi")) {
31 Index: IkiWiki/Plugin/poll.pm
32 ===================================================================
33 --- IkiWiki/Plugin/poll.pm      (revision 3946)
34 +++ IkiWiki/Plugin/poll.pm      (working copy)
35 @@ -74,7 +74,7 @@
36         return "<div class=poll>$ret</div>";
37  } # }}}
38  
39 -sub cgi ($) { #{{{
40 +sub cgi ($$) { #{{{
41         my $cgi=shift;
42         if (defined $cgi->param('do') && $cgi->param('do') eq "poll") {
43                 my $choice=$cgi->param('choice');
44 </pre>