summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/opendiscussion.pm
blob: 5a455940b8b9fc286aec4816973d09f39f0510b7 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::opendiscussion;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 3.00;
  6. sub import {
  7. hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
  8. hook(type => "canedit", id => "opendiscussion", call => \&canedit,
  9. first => 1);
  10. }
  11. sub getsetup () {
  12. return
  13. plugin => {
  14. safe => 1,
  15. rebuild => 0,
  16. },
  17. }
  18. sub canedit ($$) {
  19. my $page=shift;
  20. my $cgi=shift;
  21. my $session=shift;
  22. return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
  23. return "" if pagespec_match($page, "postcomment(*)");
  24. return undef;
  25. }
  26. 1