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);
|
2007-02-02 03:33:03 +01:00
|
|
|
hook(type => "canedit", id => "opendiscussion", call => \&canedit);
|
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,
|
|
|
|
},
|
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;
|
|
|
|
|
2010-01-02 21:42:20 +01:00
|
|
|
return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
|
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
|