#!/usr/local/bin/perl
require './web-lib.pl';
@available = ("webmin", "system", "servers", "cluster", "hardware", "", "net");
&init_config();
$hostname = &get_system_hostname();
$ver = &get_webmin_version();
&get_miniserv_config(\%miniserv);
if ($gconfig{'real_os_type'}) {
if ($gconfig{'os_version'} eq "*") {
$ostr = $gconfig{'real_os_type'};
}
else {
$ostr = "$gconfig{'real_os_type'} $gconfig{'real_os_version'}";
}
}
else {
$ostr = "$gconfig{'os_type'} $gconfig{'os_version'}";
}
&ReadParse();
# Redirect if the user has only one module
@msc_modules = &get_available_module_infos()
if (!scalar(@msc_modules));
if (@msc_modules == 1 && $gconfig{'gotoone'}) {
&redirect("$msc_modules[0]->{'dir'}/");
exit;
}
# Show standard header
$gconfig{'sysinfo'} = 0 if ($gconfig{'sysinfo'} == 1);
$theme_index_page = 1;
&header($gconfig{'nohostname'} ? $text{'main_title2'} :
&text('main_title', $ver, $hostname, $ostr), "",
undef, undef, 1, 1);
if (!@msc_modules) {
# use has no modules!
print "
$text{'main_none'}
\n";
}
elsif ($gconfig{"notabs_${base_remote_user}"} == 2 ||
$gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'}) {
# Generate main menu with all modules on one page
print "
\n";
$pos = 0;
$cols = $gconfig{'nocols'} ? $gconfig{'nocols'} : 4;
$per = 100.0 / $cols;
foreach $m (@msc_modules) {
if ($pos % $cols == 0) { print "\n"; }
print "\n";
print "\n";
print "{'dir'}/>$m->{'desc'} | \n";
if ($pos % $cols == $cols - 1) { print "
\n"; }
$pos++;
}
print "
\n";
}
else {
# Generate categorized module list
print "\n";
$usercol = defined($gconfig{'cs_header'}) ||
defined($gconfig{'cs_table'}) ||
defined($gconfig{'cs_page'});
foreach $c (@cats) {
$t = $cats{$c};
if ($in{'cat'} eq $c) {
print "",
""," | \n";
print " $t | \n";
print "",
""," | \n";
}
# print " | \n";
}
print " \n";
print "\n";
# Display the modules in this category
$pos = 0;
$cols = $gconfig{'nocols'} ? $gconfig{'nocols'} : 4;
$per = 100.0 / $cols;
foreach $m (@msc_modules) {
next if ($m->{'category'} ne $in{'cat'});
if ($pos % $cols == 0) { print "\n"; }
print "\n";
print "\n";
print "{'dir'}/>$m->{'desc'} | \n";
if ($pos++ % $cols == $cols - 1) { print " \n"; }
}
while($pos++ % $cols) {
print " | \n";
}
print " | |
";
print qq~~;
print qq~~;
}
if ($miniserv{'logout'} && !$gconfig{'alt_startpage'} &&
!$ENV{'SSL_USER'} && !$ENV{'LOCAL_USER'} &&
$ENV{'HTTP_USER_AGENT'} !~ /webmin/i) {
print "
\n";
if ($gconfig{'skill_'.$base_remote_user}) {
print "$text{'main_skill'}:\n";
foreach $s ('high', 'medium', 'low') {
print " | " if ($done_first_skill++);
if ($gconfig{'skill_'.$base_remote_user} eq $s) {
print $text{'skill_'.$s};
}
else {
print "", "", $text{'skill_'.$s},"";
}
}
print " | \n";
}
print " ";
print &text('main_version', $ver, $hostname, $ostr)
if (!$gconfig{'nohostname'});
print "\n";
print " | \n";
print "",
" \n";
print " |
\n";
}
&footer();
sub chop_font {
foreach $l (split(//, $t)) {
$ll = ord($l);
if ($ll > 127 && $lang->{'charset'}) {
print "{'charset'}.gif alt=\"$l\" align=bottom border=0>";
}
elsif ($l eq " ") {
print "";
}
else {
print "";
}
}
}