2007-02-02 03:33:03 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
package IkiWiki::Plugin::anonok;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2007-04-27 04:55:52 +02:00
|
|
|
use IkiWiki 2.00;
|
2007-02-02 03:33:03 +01:00
|
|
|
|
|
|
|
sub import { #{{{
|
|
|
|
hook(type => "canedit", id => "anonok", call => \&canedit,);
|
|
|
|
} # }}}
|
|
|
|
|
|
|
|
sub canedit ($$$) { #{{{
|
2008-05-01 20:58:23 +02:00
|
|
|
my $page=shift;
|
|
|
|
my $cgi=shift;
|
|
|
|
my $session=shift;
|
|
|
|
|
|
|
|
my $ret;
|
|
|
|
|
2008-05-02 19:01:51 +02:00
|
|
|
if (exists $config{anonok_pagespec} && length $config{anonok_pagespec}) {
|
2008-05-01 20:58:23 +02:00
|
|
|
if (pagespec_match($page, $config{anonok_pagespec},
|
|
|
|
location => $page)) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return undef;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return "";
|
|
|
|
}
|
2007-02-02 03:33:03 +01:00
|
|
|
} #}}}
|
|
|
|
|
|
|
|
1
|