]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/remove.pm
avoid standalone -e or foo syntax
[git.ikiwiki.info.git] / IkiWiki / Plugin / remove.pm
index 21989aff3ff1c812af0ca83f5d8ecd72046393aa..f62bfb1d75d55d0f78096567085e9f993a194307 100644 (file)
@@ -54,6 +54,26 @@ sub check_canremove ($$$) {
                        error("renaming of attachments is not allowed");
                }
        }
+
+       my $canremove;
+       IkiWiki::run_hooks(canremove => sub {
+               return if defined $canremove;
+               my $ret=shift->($page, $q, $session);
+               if (defined $ret) {
+                       if ($ret eq "") {
+                               $canremove=1;
+                       }
+                       elsif (ref $ret eq 'CODE') {
+                               $ret->();
+                               $canremove=0;
+                       }
+                       elsif (defined $ret) {
+                               error($ret);
+                               $canremove=0;
+                       }
+               }
+       });
+       return $canremove;
 }
 
 sub formbuilder_setup (@) {
@@ -218,7 +238,7 @@ sub sessioncgi ($$) {
                        }
                }
                else {
-                       IkiWiki::showform($form, $buttons, $session, $q);
+                       removal_confirm($q, $session, 0, $q->param("page"));
                }
 
                exit 0;