summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/opendiscussion.pm
blob: 2805f60efdb6d415a19aeb17195df8ff2543487b (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. section => "auth",
  17. },
  18. }
  19. sub canedit ($$) {
  20. my $page=shift;
  21. my $cgi=shift;
  22. my $session=shift;
  23. return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/i;
  24. return "" if pagespec_match($page, "postcomment(*)");
  25. return undef;
  26. }
  27. 1