return @ret;
} #}}}
-sub genpage ($$$) { #{{{
+sub genpage ($$) { #{{{
my $page=shift;
my $content=shift;
- my $mtime=shift;
my $templatefile;
run_hooks(templatefile => sub {
content => $content,
backlinks => $backlinks,
more_backlinks => $more_backlinks,
- mtime => displaytime($mtime),
+ mtime => displaytime($pagemtime{$page}),
baseurl => baseurl($page),
);
filter($page, $page,
readfile($srcfile)))));
- writefile(htmlpage($page), $config{destdir},
- genpage($page, $content, mtime($srcfile)));
+ my $output=htmlpage($page);
+ writefile($output, $config{destdir}, genpage($page, $content));
+ utime($pagemtime{$page}, $pagemtime{$page}, $config{destdir}."/".$output);
}
else {
my $srcfd=readfile($srcfile, 1, 1);
}
}
});
+ utime($pagemtime{$file}, $pagemtime{$file}, $config{destdir}."/".$file);
}
} #}}}
} #}}}
sub refresh () { #{{{
+ # security check, avoid following symlinks in the srcdir path
+ my $test=$config{srcdir};
+ while (length $test) {
+ if (-l $test) {
+ error("symlink found in srcdir path ($test)");
+ }
+ unless ($test=~s/\/+$//) {
+ $test=dirname($test);
+ }
+ }
+
# find existing pages
my %exists;
my @files;
$content=preprocess($page, $page, $content);
$content=linkify($page, $page, $content);
$content=htmlize($page, $type, $content);
+ $pagemtime{$page}=mtime($srcfile);
- print genpage($page, $content, mtime($srcfile));
+ print genpage($page, $content);
exit 0;
} #}}}