2007-02-02 03:33:03 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
package IkiWiki::Plugin::opendiscussion;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2008-12-23 22:34:19 +01:00
|
|
|
use IkiWiki 3.00;
|
2007-02-02 03:33:03 +01:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub import {
|
2008-08-03 23:20:21 +02:00
|
|
|
hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
|
2010-02-06 22:12:29 +01:00
|
|
|
hook(type => "canedit", id => "opendiscussion", call => \&canedit,
|
|
|
|
first => 1);
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2007-02-02 03:33:03 +01:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub getsetup () {
|
2008-08-03 23:20:21 +02:00
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 1,
|
|
|
|
rebuild => 0,
|
2010-02-12 04:24:15 +01:00
|
|
|
section => "auth",
|
2008-08-03 23:20:21 +02:00
|
|
|
},
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2008-08-03 23:20:21 +02:00
|
|
|
|
2008-12-17 21:22:16 +01:00
|
|
|
sub canedit ($$) {
|
2007-02-02 03:33:03 +01:00
|
|
|
my $page=shift;
|
|
|
|
my $cgi=shift;
|
|
|
|
my $session=shift;
|
|
|
|
|
2013-01-02 19:05:33 +01:00
|
|
|
return "" if $config{discussion} && $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
|
2010-02-06 22:19:17 +01:00
|
|
|
return "" if pagespec_match($page, "postcomment(*)");
|
2007-02-02 03:33:03 +01:00
|
|
|
return undef;
|
2008-12-17 21:22:16 +01:00
|
|
|
}
|
2007-02-02 03:33:03 +01:00
|
|
|
|
|
|
|
1
|