]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/opendiscussion.pm
Remember to run all the tests before committing!
[git.ikiwiki.info.git] / IkiWiki / Plugin / opendiscussion.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::opendiscussion;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9         hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
10         hook(type => "canedit", id => "opendiscussion", call => \&canedit,
11                 first => 1);
12 }
14 sub getsetup () {
15         return 
16                 plugin => {
17                         safe => 1,
18                         rebuild => 0,
19                         section => "auth",
20                 },
21 }
23 sub canedit ($$) {
24         my $page=shift;
25         my $cgi=shift;
26         my $session=shift;
28         return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
29         return "" if pagespec_match($page, "postcomment(*)");
30         return undef;
31 }
33 1