return $canedit;
} #}}}
-sub decode_cgi_utf8 ($) { #{{{
- my $cgi = shift;
- foreach my $f ($cgi->param) {
- $cgi->param($f, map { decode_utf8 $_ } $cgi->param($f));
+sub decode_form_utf8 ($) { #{{{
+ my $form = shift;
+ foreach my $f ($form->field) {
+ $form->field(name => $f,
+ value => decode_utf8($form->field($f)),
+ force => 1,
+ );
}
} #}}}
my $q=shift;
my $session=shift;
- decode_cgi_utf8($q);
eval q{use CGI::FormBuilder};
error($@) if $@;
my $form = CGI::FormBuilder->new(
$form->field(name => "do", type => "hidden", value => "signin",
force => 1);
+ decode_form_utf8($form);
run_hooks(formbuilder_setup => sub {
shift->(form => $form, cgi => $q, session => $session,
buttons => $buttons);
});
+ decode_form_utf8($form);
if ($form->submitted) {
$form->validate;
my $session=shift;
needsignin($q, $session);
- decode_cgi_utf8($q);
# The session id is stored on the form and checked to
# guard against CSRF.
],
);
my $buttons=["Save Preferences", "Logout", "Cancel"];
-
+
+ decode_form_utf8($form);
run_hooks(formbuilder_setup => sub {
shift->(form => $form, cgi => $q, session => $session,
buttons => $buttons);
});
+ decode_form_utf8($form);
$form->field(name => "do", type => "hidden", value => "prefs",
force => 1);
my $q=shift;
my $session=shift;
- decode_cgi_utf8($q);
-
my @fields=qw(do rcsinfo subpage from page type editcontent comments);
my @buttons=("Save Page", "Preview", "Cancel");
eval q{use CGI::FormBuilder};
wikiname => $config{wikiname},
);
+ decode_form_utf8($form);
run_hooks(formbuilder_setup => sub {
shift->(form => $form, cgi => $q, session => $session,
buttons => \@buttons);
});
+ decode_form_utf8($form);
# This untaint is safe because titlepage removes any problematic
# characters.
}
my $content=$form->field('editcontent');
+
run_hooks(editcontent => sub {
$content=shift->(
content => $content,
linkify($page, $page,
preprocess($page, $page,
filter($page, $page, $content), 0, 1))));
-
+
if ($new) {
delete $pagesources{$page};
}
eval q{use CGI};
error($@) if $@;
+ binmode(STDIN);
$q=CGI->new;
+ binmode(STDIN, ":utf8");
run_hooks(cgi => sub { shift->($q) });
}