$r = shift;
my($buf,$len,$offset) = @_;
&write_to_sock(substr($buf, $offset, $len));
+$miniserv::page_capture_out .= substr($buf, $offset, $len)
+ if ($miniserv::page_capture);
}
sub PRINT
my $buf = join(defined($,) ? $, : "", @_);
$buf .= $\ if defined($\);
&write_to_sock($buf);
+$miniserv::page_capture_out .= $buf
+ if ($miniserv::page_capture);
}
sub PRINTF
{
shift;
my $fmt = shift;
-&write_to_sock(sprintf $fmt, @_);
+my $buf = sprintf $fmt, @_;
+&write_to_sock($buf);
+$miniserv::page_capture_out .= $buf
+ if ($miniserv::page_capture);
}
# Send back already read data while we have it, then read from SOCK
if (defined(&theme_header)) {
$module_name = &get_module_name();
&theme_header(@_);
+ $miniserv::page_capture = 1;
return;
}
print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
print "</td></tr></table>\n";
print $tconfig{'postheader'};
}
+$miniserv::page_capture = 1;
}
=head2 get_html_title(title)
&load_theme_library();
if (defined(&theme_popup_header)) {
&theme_popup_header(@_);
+ $miniserv::page_capture = 1;
return;
}
print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
&theme_popup_prebody(@_);
}
}
+$miniserv::page_capture = 1;
}
=head2 footer([page, name]+, [noendbody])
=cut
sub footer
{
+$miniserv::page_capture = 0;
&load_theme_library();
my %this_module_info = &get_module_info(&get_module_name());
if (defined(&theme_footer)) {
=cut
sub popup_footer
{
+$miniserv::page_capture = 0;
&load_theme_library();
if (defined(&theme_popup_footer)) {
&theme_popup_footer(@_);
}
@main::locked_file_diff = undef;
}
+
if ($gconfig{'logfullfiles'}) {
# Save the original contents of any modified files
my $i = 0;
%main::orig_file_type = undef;
}
+if ($miniserv::page_capture_out) {
+ # Save the whole page output
+ mkdir("$ENV{'WEBMIN_VAR'}/output", 0700);
+ open(PAGEOUT, ">$ENV{'WEBMIN_VAR'}/output/$id");
+ print PAGEOUT $miniserv::page_capture_out;
+ close(PAGEOUT);
+ if ($gconfig{'logperms'}) {
+ chmod(oct($gconfig{'logperms'}),
+ "$ENV{'WEBMIN_VAR'}/output/$id");
+ }
+ }
+
# Log to syslog too
if ($gconfig{'logsyslog'}) {
eval 'use Sys::Syslog qw(:DEFAULT setlogsock);
eval { syslog("info", "%s", "[$info{'desc'}] $msg"); };
}
}
+
+print STDERR $miniserv::page_capture_out,"\n";
}
=head2 additional_log(type, object, data, [input])