115 lines
3.6 KiB
Perl
Executable File
115 lines
3.6 KiB
Perl
Executable File
#!/usr/bin/perl
|
|
# view.cgi
|
|
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jesús Pérez Lorenzo --- license GNU GPL
|
|
# stta: (@#) 1.31051043346- [2004_01_29_102036]
|
|
# Show details of the action, including changed files
|
|
|
|
require '../webminlog/webminlog-lib.pl';
|
|
require './stta-lib.pl';
|
|
foreach $l (@lang_order_list) {
|
|
&read_file("$root_directory/webminlog/lang/$l", \%text);
|
|
}
|
|
foreach $k (keys %text) {
|
|
$text{$k} =~ s/\$([A-Za-z0-9\.\-\_]+)/text_subs($1,\%text)/ge;
|
|
}
|
|
&ReadParse();
|
|
&headerstta($text{'view_title'}, "", "viewlog" ,undef,1,0,"$text{'headpage_right'}"."$text{'head_logout'}",undef,undef,"$text{head_below}" );
|
|
print "<hr>\n";
|
|
|
|
# find the log record to view
|
|
open(LOG, $webmin_logfile);
|
|
while(<LOG>) {
|
|
if (($act = &parse_logline($_)) && $act->{'id'} eq $in{'id'}) {
|
|
last;
|
|
}
|
|
}
|
|
close(LOG);
|
|
if (-r "../$act->{'module'}/log_parser.pl") {
|
|
&foreign_require($act->{'module'}, "log_parser.pl");
|
|
$parser++;
|
|
}
|
|
|
|
# display info about the action
|
|
print "<table border width=100%>\n";
|
|
print "<tr $tb> <td><font color='$revtext'><b>",&text('view_header', $act->{'id'}),"</b></font></td> </tr>\n";
|
|
print "<tr $cb> <td><table width=100%>\n";
|
|
|
|
$d = &foreign_call($act->{'module'}, "parse_webmin_log",
|
|
$act->{'user'}, $act->{'script'},
|
|
$act->{'action'}, $act->{'type'},
|
|
$act->{'object'}, $act->{'param'}, 1) if ($parser);
|
|
print "<tr> <td valign=top><b>$text{'view_action'}</b></td>\n";
|
|
if ($d) {
|
|
print "<td colspan=3>$d</td> </tr>\n";
|
|
}
|
|
elsif ($act->{'action'} eq '_config_') {
|
|
print "<td colspan=3>$text{'search_config'}</td> </tr>";
|
|
}
|
|
else {
|
|
printf "<td colspan=3>%s %s %s</td> </tr>\n",
|
|
$act->{'action'}, $act->{'type'} ? $act->{'type'} : '',
|
|
$act->{'object'};
|
|
}
|
|
|
|
print "<tr> <td><b>$text{'view_module'}</b></td>\n";
|
|
%minfo = &get_module_info($act->{'module'});
|
|
print "<td>$minfo{'desc'}</td>\n";
|
|
print "<td><b>$text{'view_script'}</b></td>\n";
|
|
print "<td><tt>$act->{'module'}/$act->{'script'}</tt></td> </tr>\n";
|
|
|
|
print "<tr> <td><b>$text{'view_user'}</b></td>\n";
|
|
print "<td>$act->{'user'}</td>\n";
|
|
print "<td><b>$text{'view_ip'}</b></td>\n";
|
|
print "<td>$act->{'ip'}</td> </tr>\n";
|
|
|
|
print "<tr>\n";
|
|
if ($act->{'sid'} ne '-') {
|
|
print "<td><b>$text{'view_sid'}</b></td>\n";
|
|
print "<td><a class='menu1' href='search.cgi?sid=$act->{'sid'}&uall=1&mall=1&tall=1'>$act->{'sid'}</a></td>\n";
|
|
}
|
|
@tm = localtime($act->{'time'});
|
|
print "<td><b>$text{'view_time'}</b></td>\n";
|
|
printf "<td>%2.2d/%s/%4.4d %2.2d:%2.2d:%2.2d</td> </tr>\n",
|
|
$tm[3], $text{"smonth_".($tm[4]+1)}, $tm[5]+1900,
|
|
$tm[2], $tm[1], $tm[0];
|
|
|
|
print "</table></td></tr></table><p>\n";
|
|
|
|
# display modified files
|
|
$i = 0;
|
|
while(open(DIFF, "$ENV{'WEBMIN_VAR'}/diffs/$act->{'id'}.$i")) {
|
|
local ($type, $object, $diff);
|
|
local $line = <DIFF>;
|
|
while(<DIFF>) { $diff .= $_; }
|
|
close(DIFF);
|
|
if ($line =~ /^(\/.*)/) {
|
|
$type = 'modify'; $object = $1;
|
|
}
|
|
elsif ($line =~ /^(\S+)\s+(.*)/) {
|
|
$type = $1; $object = $2;
|
|
}
|
|
local $t = $text{"view_type_$type"};
|
|
if ($t =~ /\$2/ || !$diff) {
|
|
print "<table border width=100%>\n";
|
|
print "<tr $tb> <td><font color='$revtext'><b>",
|
|
&text("view_type_$type", "<tt>$object</tt>",
|
|
"<tt>".&html_escape($diff)."</tt>"),"</b></font></td> </tr>\n";
|
|
print "</table><p>\n";
|
|
}
|
|
else {
|
|
print "<table border width=100%>\n";
|
|
print "<tr $tb> <td><font color='$revtext'><b>",&text("view_type_$type",
|
|
"<tt>$object</tt>"),"</b></font></td> </tr>\n";
|
|
print "<tr $cb> <td><pre>";
|
|
print $diff;
|
|
# print &html_escape($diff);
|
|
print "</pre></td> </tr></table><p>\n";
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
print "<b>$text{'view_nofiles'}</b><p>\n" if (!$i);
|
|
print "<p><p><p>\n";
|
|
do "footer.pl";
|
|
exit;
|