181 lines
5.9 KiB
Perl
181 lines
5.9 KiB
Perl
|
#!/usr/bin/perl
|
|||
|
# STTA Rev. 1.3 Copyright (c) 2001-2004 Jes<65>s P<>rez Lorenzo --- license GNU GPL
|
|||
|
# stta: (@#) 1.31051043346- [2004_01_29_102036]
|
|||
|
|
|||
|
$debug=2;
|
|||
|
$do_reload = $ARGV[0];
|
|||
|
|
|||
|
#if ( $do_reload eq "?" || $do_reload eq "help" | $do_reload eq "-h" ) {
|
|||
|
# print "brandmgr: \"$task_type\" unknown option task \n";
|
|||
|
# print "brandmgr [ -r | reload | true]\n";
|
|||
|
# exit 1;
|
|||
|
#};
|
|||
|
# where is config file for parameters .... (same as Webmin)
|
|||
|
$config_directory="/etc/webmin";
|
|||
|
|
|||
|
do './base-lib.pl';
|
|||
|
do './global-lib.pl';
|
|||
|
do './lists-lib.pl';
|
|||
|
do './print-lib.pl';
|
|||
|
do './html-lib.pl';
|
|||
|
|
|||
|
$tool_name="brandmgr";
|
|||
|
$tta_logfile="/tmp/.webmin/stta_log";
|
|||
|
$default_lang = "en";
|
|||
|
$current_lang = "en";
|
|||
|
$module_name = "stta";
|
|||
|
$remote_user="admin";
|
|||
|
$session_id="$$";
|
|||
|
$hostname=`hostname`;
|
|||
|
$hostname=~s/\n//g;
|
|||
|
$ENV{'REMOTE_HOST'}=$hostname;
|
|||
|
$action_id_count=0;
|
|||
|
%ttaprops=();
|
|||
|
@ttahosts=();
|
|||
|
%sttaparams=();
|
|||
|
$cginame= $0 =~ /([^\/]+)$/ ? $1 : '-';
|
|||
|
$ldap_ok=true;
|
|||
|
$ldapcache_ok=true;
|
|||
|
$tta_ok=true;
|
|||
|
$ENV{'WEBMIN_CONFIG'}="/etc/webmin/config";
|
|||
|
|
|||
|
&initialize();
|
|||
|
&load_dataconf();
|
|||
|
&start_debug();
|
|||
|
%access = &get_module_acl();
|
|||
|
%text = &load_language();
|
|||
|
|
|||
|
# globals to keep STTA info
|
|||
|
%ttaprops=();
|
|||
|
@ttahosts=();
|
|||
|
%sttaparams=();
|
|||
|
$ldap_ok=true;
|
|||
|
$ldapcache_ok=true;
|
|||
|
$tta_ok=true;
|
|||
|
|
|||
|
$hostname = `hostname`;
|
|||
|
$hostname =~ s/\r|\n//g;;
|
|||
|
#$ver = `uname -a`;
|
|||
|
$ostr = `uname -a`;
|
|||
|
$ostr =~ s/\r|\n//g;
|
|||
|
%access = &get_module_acl();
|
|||
|
%ttaprops=();
|
|||
|
@ttahosts=();
|
|||
|
%sttaparams=();
|
|||
|
$cginame= $0 =~ /([^\/]+)$/ ? $1 : '-';
|
|||
|
$ldap_ok=true;
|
|||
|
$ldapcache_ok=true;
|
|||
|
$tta_ok=true;
|
|||
|
$button_lock=0;
|
|||
|
@access_types = $access{'types'} eq '*' ? (0 .. 100)
|
|||
|
: split(/\s+/, $access{'types'});
|
|||
|
map { $access_types{$_}++ } @access_types;
|
|||
|
$debug=$config{debug_code};
|
|||
|
$debug=3;
|
|||
|
|
|||
|
$task=$in{task} || "";
|
|||
|
$fileName=$in{file} || "" ;
|
|||
|
$brandid=$in{brandid} || "" ;
|
|||
|
$password=$in{password} || "" ;
|
|||
|
$now = time();
|
|||
|
$passData=`cat $root_directory/$module_name/install/.passwd 2>/dev/null`;
|
|||
|
$passData=~ s/\r|\n//g;
|
|||
|
|
|||
|
if ( ! $access{'global'} || $access{'admin'} ne 1) { $redir="stta" };
|
|||
|
|
|||
|
if ( $redir ne "" ) {
|
|||
|
print "<h1>$text{'brand_list'}</h1>";
|
|||
|
exit;
|
|||
|
}
|
|||
|
$ahora=&set_now();
|
|||
|
print "<table border=0><tr><td $cb><h1>$text{'brand_list'}<h1></td>></tr></table>";
|
|||
|
|
|||
|
local %minfo=&load_minfo("$root_directory/$module_name/");
|
|||
|
|
|||
|
sub out_debuglog
|
|||
|
{
|
|||
|
if ( $debug gt 0 ) { print DebugLog "@_ \n"; }
|
|||
|
}
|
|||
|
|
|||
|
sub err_file_open
|
|||
|
{
|
|||
|
print "$text{f_error} $fileName";
|
|||
|
exit;
|
|||
|
}
|
|||
|
&out_debuglog("# -> $ahora");
|
|||
|
print "<table width=100% border>\n";
|
|||
|
print "<tr $tb> <td valig=top><font color='$revtext'><b> $text{'titidx_brandmgr'}</b>";
|
|||
|
print " <br>\n";
|
|||
|
print "Webmin - $hostname - $ostr";
|
|||
|
&out_debuglog("Webmin - $hostname - $ostr ");
|
|||
|
print "</td></td> </tr>\n";
|
|||
|
print "<tr><td><b> $minfo{name} -- $minfo{version} -- $minfo{brand} -- $minfo{stamp} </b></td></tr>\n";
|
|||
|
&out_debuglog(" $minfo{name} -- $minfo{version} -- $minfo{brand} -- $minfo{stamp}");
|
|||
|
&out_debuglog("_______________________________________________");
|
|||
|
print "<tr><td><table width=100% >\n";
|
|||
|
print "<tr $tb>\n";
|
|||
|
print "<td><font color='$revtext'><center><B>".$text{f_filelistName} . "</B></center></font></td>\n";
|
|||
|
print "<td><font color='$revtext'><center><B>".$text{f_fsize} . "</B></center></font></td>\n";
|
|||
|
print "<td><font color='$revtext'><center><B>".$text{brand_data} . "</B></center></font></td>\n";
|
|||
|
print "<td><font color='$revtext'><center><B>".$text{brand_desc} . "</B></center></font></td>\n";
|
|||
|
%h_brandInfo=&load_brandinfo();
|
|||
|
$lins=0;
|
|||
|
$touchFiles=0;
|
|||
|
foreach $item (keys (%h_brandInfo)) { push (@brandInfoList,$h_brandInfo{$item}); }
|
|||
|
@brandInfo = sort {$a->{fname} cmp $b->{fname}} @brandInfoList;
|
|||
|
$brand_warn="0";
|
|||
|
$totSize=0;
|
|||
|
foreach $item (@brandInfo) {
|
|||
|
$lins++;
|
|||
|
my @st = stat("$root_directory/$item->{fname}");
|
|||
|
my $data_check=&check_brand_data($item->{fname});
|
|||
|
|
|||
|
if ( $st[7] ne $item->{'size'} || $data_check eq "false" ) {
|
|||
|
print "<tr $cb>";
|
|||
|
print "<td><b>$item->{'fname'}</b></td>";
|
|||
|
&out_debuglog("$item->{'fname'} - $item->{'size'} != $st[7] - $item->{'brand'} - $item->{'descrip'}");
|
|||
|
} else {
|
|||
|
print "<tr background=\"$config{'bgimage'}\">";
|
|||
|
print "<td>$item->{'fname'}</td>";
|
|||
|
}
|
|||
|
if ( $st[7] ne $item->{'size'} || $data_check eq "false" ) { print "<td>"; }
|
|||
|
if ( $st[7] ne $item->{'size'} ) {
|
|||
|
$n=0;
|
|||
|
$n= $n + $item->{'size'};
|
|||
|
$n= $st[7] - $n;
|
|||
|
print " $item->{'size'} != $st[7] = $n ";
|
|||
|
$totSize=$totSize + $n;
|
|||
|
}
|
|||
|
if ( $data_check eq "false" ) { print " $text{changed} ";}
|
|||
|
if ( $st[7] ne $item->{'size'} || $data_check eq "false" ) {
|
|||
|
print "</td>";
|
|||
|
$brand_warn="1";
|
|||
|
$touchFiles++;
|
|||
|
} else {
|
|||
|
print "<td>$item->{'size'}</td>";
|
|||
|
}
|
|||
|
print "<td>";
|
|||
|
if ( $st[7] ne $item->{'size'} ) { print "<b>" }
|
|||
|
print $item->{'brand'};
|
|||
|
if ( $st[7] ne $item->{'size'} ) { print "</b>" }
|
|||
|
print "</td>";
|
|||
|
print "<td>";
|
|||
|
if ( $st[7] ne $item->{'size'} ) { print "<b>" }
|
|||
|
print $item->{'descrip'};
|
|||
|
if ( $st[7] ne $item->{'size'} ) { print "</b>" }
|
|||
|
print "</td>";
|
|||
|
print "</tr>\n";
|
|||
|
}
|
|||
|
print "</table></td></tr><p>\n";
|
|||
|
print "<tr><tr></table></table><p>\n";
|
|||
|
print "<p><tr><td><b> ".&text('l_total',$lins)."</b></td><td><p>\n";
|
|||
|
&out_debuglog("_______________________________________________");
|
|||
|
&out_debuglog(&text('l_total',$lins));
|
|||
|
if ( $brand_warn eq "1" ) {
|
|||
|
print "<table border><tr><td $cb><font size=+1><b>".&text("msgerr_brandinfo",$touchFiles)."</b> $totSize $text{changed}</font></td></tr></table><br>";
|
|||
|
&out_debuglog(&text("msgerr_brandinfo",$touchFiles));
|
|||
|
}
|
|||
|
print "<h2>$ahora</h2>\n";
|
|||
|
if ( $debug gt 0 ) { &endclose_debug(); }
|
|||
|
exit;
|