From 7cd40ea4eb8955765dc3e61dd3edaf08d1bbab48 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Jul 2008 13:43:32 -0400 Subject: better approach for cgi upload disabling Make it a config setting, this way subtle load order issues don't come into play. (As much?) --- IkiWiki/Plugin/attachment.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin/attachment.pm') diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index d2989bb8b..106660012 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -4,18 +4,21 @@ package IkiWiki::Plugin::attachment; use warnings; use strict; use IkiWiki 2.00; -use CGI; -$CGI::DISABLE_UPLOADS=0; # TODO move to admin prefs $config{valid_attachments}="(*.mp3 and maxsize(15mb)) or (!ispage() and maxsize(50kb))"; sub import { #{{{ + hook(type => "checkconfig", id => "attachment", call => \&checkconfig); hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup); hook(type => "formbuilder", id => "attachment", call => \&formbuilder); } # }}} -sub formbuilder_setup { #{{{ +sub checkconfig () { #{{{ + $config{cgi_disable_uploads}=0; +} #}}} + +sub formbuilder_setup (@) { #{{{ my %params=@_; my $form=$params{form}; -- cgit v1.2.3