]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/comments.pm
comment: Better fix to avoid showing comments of subpages, while not breaking manual...
[ikiwiki.git] / IkiWiki / Plugin / comments.pm
index f3d6f20d6a3d9dab224e5ddff140f1a86edb772e..8d46ed57983e6a0d0e7cac3c568a6cb368ec34a6 100644 (file)
@@ -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")),
                                "<p>".
                                gettext("Your comment will be posted after moderator review").
                                "</p>");
@@ -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;
 }
 
@@ -755,10 +755,8 @@ sub previewcomment ($$$) {
 sub commentsshown ($) {
        my $page=shift;
 
-       return ! pagespec_match($page, "comment(*)",
-                               location => $page) &&
-              pagespec_match($page, $config{comments_pagespec},
-                             location => $page);
+       return pagespec_match($page, $config{comments_pagespec},
+               location => $page);
 }
 
 sub commentsopen ($) {
@@ -785,7 +783,7 @@ sub pagetemplate (@) {
                my $comments = undef;
                if ($shown) {
                        $comments = IkiWiki::preprocess_inline(
-                               pages => "comment($page)",
+                               pages => "comment($page) and !comment($page/*)",
                                template => 'comment',
                                show => 0,
                                reverse => 'yes',