Make it a config setting, this way subtle load order issues don't come into
play. (As much?)
account_creation_password => "",
prefix_directives => 0,
hardlink => 0,
account_creation_password => "",
prefix_directives => 0,
hardlink => 0,
+ cgi_disable_uploads => 1,
} #}}}
sub checkconfig () { #{{{
} #}}}
sub checkconfig () { #{{{
use IkiWiki::UserInfo;
use open qw{:utf8 :std};
use Encode;
use IkiWiki::UserInfo;
use open qw{:utf8 :std};
use Encode;
-use CGI;
-$CGI::DISABLE_UPLOADS=1;
my $q=shift;
my $session=shift;
my $q=shift;
my $session=shift;
+ eval q{use CGI};
+ error($@) if $@;
+ $CGI::DISABLE_UPLOADS=$config{cgi_disable_uploads};
+
if (! $q) {
binmode(STDIN);
$q=CGI->new;
if (! $q) {
binmode(STDIN);
$q=CGI->new;
use warnings;
use strict;
use IkiWiki 2.00;
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 { #{{{
# 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);
} # }}}
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};
my %params=@_;
my $form=$params{form};