X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/3eabf323f057686796a7dbf9da2fbf0fed4c5728..b34d31142b9fed28ec9cf77fe0c5d9f405d48c84:/IkiWiki/Plugin/comments.pm diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index cdb926271..8f475aa56 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -237,7 +237,7 @@ sub preprocess { } if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) { - $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef, 1). + $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page})). "#".page_to_id($params{page}); } @@ -364,8 +364,8 @@ sub editcomment ($$) { } # The untaint is OK (as in editpage) because we're about to pass - # it to file_pruned anyway - my $page = $form->field('page'); + # it to file_pruned and wiki_file_regexp anyway. + my ($page) = $form->field('page')=~/$config{wiki_file_regexp}/; $page = IkiWiki::possibly_foolish_untaint($page); if (! defined $page || ! length $page || IkiWiki::file_pruned($page)) { @@ -504,7 +504,7 @@ sub editcomment ($$) { IkiWiki::saveindex(); IkiWiki::printheader($session); - print IkiWiki::misctemplate(gettext(gettext("comment stored for moderation")), + print IkiWiki::cgitemplate($cgi, gettext(gettext("comment stored for moderation")), "

". gettext("Your comment will be posted after moderator review"). "

"); @@ -554,7 +554,7 @@ sub editcomment ($$) { } else { - IkiWiki::showform_preview($form, \@buttons, $session, $cgi, + IkiWiki::showform($form, \@buttons, $session, $cgi, page => $page); } @@ -660,7 +660,7 @@ sub commentmoderation ($$) { IkiWiki::run_hooks(format => sub { $out = shift->(page => "", content => $out); }); - print IkiWiki::misctemplate(gettext("comment moderation"), $out); + print IkiWiki::cgitemplate($cgi, gettext("comment moderation"), $out); exit; } @@ -957,7 +957,8 @@ sub match_comment ($$;@) { } } - return match_glob($page, "$glob/*", internal => 1, @_); + return match_glob($page, "$glob/*", internal => 1, @_) && + ! match_glob($page, "$glob/*/*", internal => 1, @_); } sub match_comment_pending ($$;@) { @@ -972,7 +973,8 @@ sub match_comment_pending ($$;@) { return IkiWiki::FailReason->new("$page is not a pending comment"); } - return match_glob($page, "$glob/*", internal => 1, @_); + return match_glob($page, "$glob/*", internal => 1, @_) && + ! match_glob($page, "$glob/*/*", internal => 1, @_); } 1