diff options
Diffstat (limited to 'IkiWiki/CGI.pm')
-rw-r--r-- | IkiWiki/CGI.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 197eabcf0..a6695b3a5 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -20,7 +20,7 @@ sub printheader ($) { #{{{ } } #}}} - + sub showform ($$$$) { #{{{ my $form=shift; my $buttons=shift; @@ -57,15 +57,22 @@ sub check_canedit ($$$;$) { #{{{ my $nonfatal=shift; my $canedit; + my $callback; run_hooks(canedit => sub { return if defined $canedit; my $ret=shift->($page, $q, $session); - if (defined $ret && $ret eq "") { - $canedit=1; - } - elsif (defined $ret) { - $canedit=0; - error($ret) unless $nonfatal; + if (defined $ret) { + if ($ret eq "") { + $canedit=1; + } + elsif (ref $ret eq 'CODE') { + $canedit=0; + $callback->() unless $nonfatal; + } + elsif (defined $ret) { + $canedit=0; + error($ret) unless $nonfatal; + } } }); return $canedit; |