From: Joey Hess Date: Fri, 25 Jul 2008 23:27:15 +0000 (-0400) Subject: Merge branch 'master' into autoconfig X-Git-Url: https://scripts.mit.edu/gitweb/www/ikiwiki.git/commitdiff_plain/d0bd30824ec9c1f2af04d9e3d9b13473c8fcb9d8?hp=-c Merge branch 'master' into autoconfig --- d0bd30824ec9c1f2af04d9e3d9b13473c8fcb9d8 diff --combined IkiWiki/Plugin/attachment.pm index 8fa330e6d,720078be1..3fe33c858 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@@ -6,24 -6,11 +6,24 @@@ use strict use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "attachment", call => \&getsetup); hook(type => "checkconfig", id => "attachment", call => \&checkconfig); hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup); hook(type => "formbuilder", id => "attachment", call => \&formbuilder); } # }}} +sub getsetup () { #{{{ + return + => { + type => "string", + default => "", + example => "clamdscan -", + description => "virus checker program (reads STDIN, returns nonzero if virus found)", + safe => 0, # executed + rebuild => 0, + }, +} #}}} + sub check_canattach ($$;$) { #{{{ my $session=shift; my $dest=shift; # where it's going to be put, under the srcdir @@@ -206,8 -193,10 +206,10 @@@ sub formbuilder (@) { #{{ IkiWiki::saveindex(); } elsif ($form->submitted eq "Insert Links") { + my $page=quotemeta($q->param("page")); my $add=""; foreach my $f ($q->param("attachment_select")) { + $f=~s/^$page\///; $add.="[[$f]]\n"; } $form->field(name => 'editcontent',