Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[ikiwiki] / IkiWiki / Plugin / opendiscussion.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::opendiscussion;
3
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
7
8 sub import {
9         hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
10         hook(type => "canedit", id => "opendiscussion", call => \&canedit,
11                 first => 1);
12 }
13
14 sub getsetup () {
15         return 
16                 plugin => {
17                         safe => 1,
18                         rebuild => 0,
19                         section => "auth",
20                 },
21 }
22
23 sub canedit ($$) {
24         my $page=shift;
25         my $cgi=shift;
26         my $session=shift;
27
28         return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
29         return "" if pagespec_match($page, "postcomment(*)");
30         return undef;
31 }
32
33 1