# characters.
my ($page)=$form->field('page');
$page=titlepage(possibly_foolish_untaint($page));
- if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+ if (! defined $page || ! length $page ||
+ file_pruned($page, $config{srcdir}) || $page=~/^\//) {
error("bad page name");
}
return;
}
elsif ($form->submitted eq "Preview") {
+ my $content=$form->field('editcontent');
+ run_hooks(editcontent => sub {
+ $content=shift->(
+ content => $content,
+ page => $page,
+ cgi => $q,
+ session => $session,
+ );
+ });
$form->tmpl_param("page_preview",
htmlize($page, $type,
linkify($page, "",
preprocess($page, $page,
- filter($page, $page, $form->field('editcontent')), 0, 1))));
+ filter($page, $page, $content), 0, 1))));
}
elsif ($form->submitted eq "Save Page") {
$form->tmpl_param("page_preview", "");
}
$form->tmpl_param("page_conflict", "");
- if ($form->submitted ne "Save Page" ||
- ! $form->validate) {
+ if ($form->submitted ne "Save Page" || ! $form->validate) {
if ($form->field("do") eq "create") {
my @page_locs;
my $best_loc;
}
showform($form, \@buttons, $session, $q);
+ saveindex();
}
else {
# save page
my $exists=-e "$config{srcdir}/$file";
- if ($form->field("do") ne "create" &&
- ! $exists && ! -e "$config{underlaydir}/$file") {
+ if ($form->field("do") ne "create" && ! $exists &&
+ ! eval { srcfile($file) }) {
$form->tmpl_param("page_gone", 1);
$form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0);
}
my $content=$form->field('editcontent');
-
+ run_hooks(editcontent => sub {
+ $content=shift->(
+ content => $content,
+ page => $page,
+ cgi => $q,
+ session => $session,
+ );
+ });
$content=~s/\r\n/\n/g;
$content=~s/\r/\n/g;