Remove use of deprecated defined(@foo)
authorJamie Cameron <jcameron@webmin.com>
Fri, 17 Dec 2010 19:37:04 +0000 (11:37 -0800)
committerJamie Cameron <jcameron@webmin.com>
Fri, 17 Dec 2010 19:37:04 +0000 (11:37 -0800)
https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3138980&group_id=17457

42 files changed:
bind8/bind8-lib.pl
cfengine/cfengine-lib.pl
cron/cron-lib.pl
dovecot/dovecot-lib.pl
fdisk/fdisk-lib.pl
frox/frox-lib.pl
htaccess-htpasswd/htaccess-lib.pl
ipsec/ipsec-lib.pl
ldap-client/ldap-client-lib.pl
ldap-client/switch-lib.pl
ldap-server/ldap-server-lib.pl
ldap-useradmin/ldap-useradmin-lib.pl
lilo/lilo-lib.pl
lpadmin/freebsd-lib.pl
lpadmin/linux-lib.pl
lpadmin/lprng-lib.pl
mailboxes/mailboxes-lib.pl
mailcap/mailcap-lib.pl
miniserv.pl
mscstyle3/theme.pl
mscstyle_mini/theme.pl [new file with mode: 0755]
msctheme-enhanced/theme.pl [new file with mode: 0644]
mysql/mysql-lib.pl
osx-theme/theme.pl [new file with mode: 0644]
package-updates/package-updates-lib.pl
postfix/postfix-lib.pl
qmailadmin/qmail-lib.pl
quota/cgi_args.pl
raid/raid-lib.pl
rbac/rbac-lib.pl
sarg/sarg-lib.pl
sendmail/access-lib.pl
sendmail/domain-lib.pl
sendmail/generics-lib.pl
sendmail/mailers-lib.pl
sendmail/virtusers-lib.pl
spam/spam-lib.pl
status/nut-monitor.pl
status/sensors-monitor.pl
syslog-ng/syslog-ng-lib.pl
useradmin/user-lib.pl
zones/zones-lib.pl

index adf7a7f..4b2913d 100755 (executable)
@@ -1960,7 +1960,7 @@ if ($changed || !$filecount || $znc{'version'} != $zone_names_version ||
        }
 
 # Use in-memory cache
-if (defined(@list_zone_names_cache)) {
+if (length(@list_zone_names_cache)) {
        return @list_zone_names_cache;
        }
 
index c78fe3b..17b52ea 100755 (executable)
@@ -29,7 +29,7 @@ $cfrun_hosts = $config{'cfrun_hosts'} ? $config{'cfrun_hosts'} :
 # a list of classes, each containing options for the section type.
 sub get_config
 {
-if (!defined(@get_config_cache)) {
+if (!length(@get_config_cache)) {
        @get_config_cache = &get_config_file($cfengine_conf);
        }
 return \@get_config_cache;
@@ -39,7 +39,7 @@ return \@get_config_cache;
 # Parses the cfd.conf file
 sub get_cfd_config
 {
-if (!defined(@get_cfd_config_cache)) {
+if (!length(@get_cfd_config_cache)) {
        @get_cfd_config_cache = &get_config_file($cfd_conf);
        }
 return \@get_cfd_config_cache;
index c8cc2ba..11f1f34 100755 (executable)
@@ -59,7 +59,7 @@ reference with the following keys :
 sub list_cron_jobs
 {
 local (@rv, $lnum, $f);
-if (defined(@cron_jobs_cache)) {
+if (length(@cron_jobs_cache)) {
        return @cron_jobs_cache;
        }
 
index 27de8ca..5e54fb5 100755 (executable)
@@ -13,7 +13,7 @@ use WebminCore;
 # Returns a list of dovecot config entries
 sub get_config
 {
-if (!defined(@get_config_cache)) {
+if (!length(@get_config_cache)) {
        @get_config_cache = ( );
        local $lnum = 0;
        local ($section, @sections);
index a20de72..5eed83a 100755 (executable)
@@ -26,7 +26,7 @@ $| = 1;
 # Returns a structure containing the details of all disks and partitions
 sub list_disks_partitions
 {
-if (defined(@list_disks_partitions_cache)) {
+if (length(@list_disks_partitions_cache)) {
        return @list_disks_partitions_cache;
        }
 
@@ -872,7 +872,7 @@ if ($raid_module) {
                }
        }
 if ($lvm_module) {
-       if (!defined(@physical_volumes)) {
+       if (!length(@physical_volumes)) {
                @physical_volumes = ();
                foreach $vg (&foreign_call("lvm", "list_volume_groups")) {
                        push(@physical_volumes,
index 9da47c5..24e65c0 100755 (executable)
@@ -9,7 +9,7 @@ use WebminCore;
 # Returns an array reference containing the contents of the Frox config file
 sub get_config
 {
-    if (!defined(@get_config_cache)) {
+    if (!length(@get_config_cache)) {
            local $lnum = 0;
            open(CONF, $config{'frox_conf'});
            while(<CONF>) {
index 96f871e..d5d3325 100755 (executable)
@@ -30,7 +30,7 @@ else {
        if (&supports_users()) {
                # Include user home
                @uinfo = getpwnam($remote_user);
-               if ($access{'home'} && defined(@uinfo)) {
+               if ($access{'home'} && length(@uinfo)) {
                        push(@accessdirs, &resolve_links($uinfo[7]));
                        }
                }
index c42e8df..d92b051 100755 (executable)
@@ -353,7 +353,7 @@ return undef;
 # Returns a list of IPsec secret keys
 sub list_secrets
 {
-if (!defined(@list_secrets_cache)) {
+if (!length(@list_secrets_cache)) {
        local (@lines);
        local $lnum = 0;
        open(SEC, $config{'secrets'});
index 43fb435..25f9638 100755 (executable)
@@ -12,7 +12,7 @@ use WebminCore;
 sub get_config
 {
 local $file = $_[0] || $config{'auth_ldap'};
-if (!defined(@get_config_cache)) {
+if (!length(@get_config_cache)) {
        local $lnum = 0;
        @get_config_cache = ( );
        &open_readfile(CONF, $file);
index d756e0a..f1ed651 100755 (executable)
@@ -6,7 +6,7 @@ $nsswitch_config_file = $config{'nsswitch_conf'} || "/etc/nsswitch.conf";
 # Returns an array ref of information from nsswitch.conf
 sub get_nsswitch_config
 {
-if (!defined(@get_nsswitch_cache)) {
+if (!length(@get_nsswitch_cache)) {
        @get_nsswitch_cache = ( );
        local $lnum = 0;
        open(CONF, $nsswitch_config_file);
index ec3eb48..8887ec0 100755 (executable)
@@ -635,7 +635,7 @@ sub check_ldap_permissions
 {
 local @uinfo;
 if ($config{'data_dir'} && $config{'ldap_user'} &&
-    defined(@uinfo = getpwnam($config{'ldap_user'}))) {
+    length(@uinfo = getpwnam($config{'ldap_user'}))) {
        opendir(DATADIR, $config{'data_dir'});
        local @datafiles = grep { !/^\./ } readdir(DATADIR);
        closedir(DATADIR);
index c1b993a..9a9a2a4 100755 (executable)
@@ -169,7 +169,7 @@ else {
 # Returns a list of users, in the same format as the useradmin module
 sub list_users
 {
-if (!defined(@list_users_cache)) {
+if (!length(@list_users_cache)) {
        local $ldap = &ldap_connect();
        local $base = &get_user_base();
        local $rv = $ldap->search(base => $base,
@@ -213,7 +213,7 @@ local $rv = $ldap->add($_[0]->{'dn'}, attr => \@attrs);
 if ($rv->code) {
        &error(&text('usave_eadd', $rv->error));
        }
-push(@list_users_cache, $_[0]) if (defined(@list_users_cache));
+push(@list_users_cache, $_[0]) if (length(@list_users_cache));
 $ldap->unbind();
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
@@ -230,7 +230,7 @@ if ($rv->code) {
        }
 $ldap->unbind();
 @list_users_cache = grep { $_ ne $_[0] } @list_users_cache
-        if (defined(@list_users_cache));
+        if (length(@list_users_cache));
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
 
@@ -292,7 +292,7 @@ $ldap->unbind();
 # Returns a list of groups, in the same format as the useradmin module
 sub list_groups
 {
-if (!defined(@list_groups_cache)) {
+if (!length(@list_groups_cache)) {
        local $ldap = &ldap_connect();
        local $base = &get_group_base();
        local $rv = $ldap->search(base => $base,
@@ -325,7 +325,7 @@ local $rv = $ldap->add($_[0]->{'dn'}, attr => \@attrs);
 if ($rv->code) {
        &error(&text('gsave_eadd', $rv->error));
        }
-push(@list_groups_cache, $_[0]) if (defined(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
 $ldap->unbind();
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
@@ -342,7 +342,7 @@ if ($rv->code) {
        }
 $ldap->unbind();
 @list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
-        if (defined(@list_groups_cache));
+        if (length(@list_groups_cache));
 &useradmin::refresh_nscd() if (!$batch_mode);
 }
 
index 9986453..ae6d27e 100755 (executable)
@@ -20,7 +20,7 @@ if (open(VERSION, "$module_config_directory/version")) {
 # Parses lilo.conf and returns a list of directives
 sub get_lilo_conf
 {
-return @lilo_conf_cache if (defined(@lilo_conf_cache));
+return @lilo_conf_cache if (length(@lilo_conf_cache));
 open(CONF, $config{'lilo_conf'});
 local $lnum = -1;
 local ($image, $line);
index e4a83b6..1038cc0 100755 (executable)
@@ -177,7 +177,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (defined(@list_printcap_cache));
+return @list_printcap_cache if (length(@list_printcap_cache));
 local(@rv, @line, $line, $cont, $lnum, $i, %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
        next if (!$capfile || $done{$capfile}++);
index a2d4dd4..709b9de 100755 (executable)
@@ -212,7 +212,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (defined(@list_printcap_cache));
+return @list_printcap_cache if (length(@list_printcap_cache));
 local(@rv, @line, @comment, @eline, @sline, $line, $cont, $lnum, $i,
       %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
index 6cdc829..a230f0c 100755 (executable)
@@ -255,7 +255,7 @@ return $rv;
 # Returns an array of associative arrays containing printcap fields
 sub list_printcap
 {
-return @list_printcap_cache if (defined(@list_printcap_cache));
+return @list_printcap_cache if (length(@list_printcap_cache));
 local(@rv, @line, @comment, $line, $cont, $lnum, $i, %done, $capfile);
 foreach $capfile ($config{'printcap_file'}, $config{'ro_printcap_file'}) {
        next if (!$capfile || $done{$capfile}++);
index 120498b..2c54df3 100755 (executable)
@@ -201,7 +201,7 @@ return &list_user_folders(@_);
 # mail file in home dir, and maildir in home dir
 sub get_mail_style
 {
-if (!defined(@mail_style_cache)) {
+if (!length(@mail_style_cache)) {
        if ($config{'auto'}) {
                # Based on mail server
                if ($config{'mail_system'} == 1) {
index 37d4eb1..d6cd2c5 100755 (executable)
@@ -19,7 +19,7 @@ else {
 # Returns a list of /etc/mailcap entries
 sub list_mailcap
 {
-if (!defined(@list_mailcap_cache)) {
+if (!length(@list_mailcap_cache)) {
   @list_mailcap_cache = ( );
   open(CAP, $mailcap_file);
   local $lnum = 0;
index feef5a4..2d69ec0 100755 (executable)
@@ -3508,12 +3508,12 @@ if (!$uinfo) {
        return ( undef, 0, 1, undef ) if (!@uinfo && !$pamany);
 
        if (@uinfo) {
-               if (defined(@allowusers)) {
+               if (length(@allowusers)) {
                        # Only allow people on the allow list
                        return ( undef, 0, 0, undef )
                                if (!&users_match(\@uinfo, @allowusers));
                        }
-               elsif (defined(@denyusers)) {
+               elsif (length(@denyusers)) {
                        # Disallow people on the deny list
                        return ( undef, 0, 0, undef )
                                if (&users_match(\@uinfo, @denyusers));
index b500cd5..57efc82 100755 (executable)
@@ -219,7 +219,7 @@ if (@_ > 0) {
     }
 
 @msc_modules = &get_visible_module_infos()
-       if (!defined(@msc_modules));
+       if (!length(@msc_modules));
 
 print "</head>\n";
 local $dir = $current_lang_info->{'dir'} ? "dir=\"$current_lang_info->{'dir'}\""
diff --git a/mscstyle_mini/theme.pl b/mscstyle_mini/theme.pl
new file mode 100755 (executable)
index 0000000..fb059c6
--- /dev/null
@@ -0,0 +1,385 @@
+#!/usr/local/bin/perl
+
+#theme_prebody - called just before the main body of every page, so it can print any HTML it likes.
+#theme_postbody - called just after the main body of every page.
+#theme_header - called instead of the normal header function, with the same parameters. You could use this to re-write the header function in your own style with help and index links whereever you want them.
+#theme_footer - called instead of the footer function with the same parameters.
+#theme_error - called instead of the error function, with the same parameters.
+
+
+sub theme_header {
+
+local @available = ("webmin", "system", "servers", "cluster", "hardware", "", "net", "kororaweb");
+
+local($ll, %access);
+print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
+print "<html>\n";
+if ($charset) {
+    print "<meta http-equiv=\"Content-Type\" ",
+          "content=\"text/html; Charset=$charset\">\n";
+    }
+local $os_type = $gconfig{'real_os_type'} ? $gconfig{'real_os_type'}
+                      : $gconfig{'os_type'};
+local $os_version = $gconfig{'real_os_version'} ? $gconfig{'real_os_version'}
+                            : $gconfig{'os_version'};
+print "<head>\n";
+if (@_ > 0) {
+    if ($gconfig{'sysinfo'} == 1) {
+        printf "<title>%s : %s on %s (%s %s)</title>\n",
+            $_[0], $remote_user, &get_display_hostname(),
+            $os_type, $os_version;
+        }
+    elsif ($gconfig{'sysinfo'} == 4) {
+        printf "<title>%s on %s (%s %s)</title>\n",
+            $remote_user, &get_display_hostname(),
+            $os_type, $os_version;
+        }
+    else {
+        print "<title>$_[0]</title>\n";
+        }
+    print $_[7] if ($_[7]);
+    if ($gconfig{'sysinfo'} == 0 && $remote_user) {
+        print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
+        printf
+        "defaultStatus=\"%s%s logged into Webmin %s on %s (%s %s)\";\n",
+            $remote_user,
+            $ENV{'SSL_USER'} ? " (SSL certified)" :
+            $ENV{'LOCAL_USER'} ? " (Local user)" : "",
+            &get_webmin_version(), &get_display_hostname(),
+            $os_type, $os_version;
+        print "</SCRIPT>\n";
+        }
+    }
+
+@msc_modules = &get_visible_module_infos()
+       if (!length(@msc_modules));
+
+print '<body bgcolor=#424242 link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
+
+if ($remote_user && @_ > 1) {
+       # Show basic header with webmin.com link and logout button
+       local $logout = $main::session_id ? "/session_login.cgi?logout=1"
+                                         : "/switch_user.cgi";
+       print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/top_bar.jpg">
+         <tr>
+           <td width="100%" nowrap><a href="http://www.webmin.com"><img src="/images/webmin_top.jpg" border="0" alt="Webmin home page"></a></td>
+           <td nowrap><a href='$logout'><img src="/images/logout.jpg" border="0" alt="$text{'main_logout'}"></a></td>
+         </tr>
+       </table>~;
+       }
+
+local $one = @msc_modules == 1 && $gconfig{'gotoone'};
+if (@_ > 1 && !$one && $remote_user) {
+    # Display module categories
+    print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0">
+  <tr>
+    <td background="/images/shadow.jpg" nowrap><img src="/images/shadow.jpg"></td>
+  </tr>
+</table>~;
+
+    &read_file("$config_directory/webmin.catnames", \%catnames);
+    foreach $m (@msc_modules) {
+        $c = $m->{'category'};
+        next if ($cats{$c});
+        if (defined($catnames{$c})) {
+            $cats{$c} = $catnames{$c};
+            }
+        elsif ($text{"category_$c"}) {
+            $cats{$c} = $text{"category_$c"};
+            }
+        else {
+            # try to get category name from module ..
+            local %mtext = &load_language($m->{'dir'});
+            if ($mtext{"category_$c"}) {
+                $cats{$c} = $mtext{"category_$c"};
+                }
+            else {
+                $c = $m->{'category'} = "";
+                $cats{$c} = $text{"category_$c"};
+                }
+            }
+        }
+    @cats = sort { $b cmp $a } keys %cats;
+    $cats = @cats;
+    $per = $cats ? 100.0 / $cats : 100;
+
+    if (!defined($in{'cat'})) {
+       
+        # Use default category
+        if (defined($gconfig{'deftab'}) &&
+            &indexof($gconfig{'deftab'}, @cats) >= 0) {
+            $in{'cat'} = $gconfig{'deftab'};
+            }
+        else {
+            $in{'cat'} = $cats[0];
+            }
+        }
+    elsif (!$cats{$in{'cat'}}) {
+        $in{'cat'} = "";
+        }
+
+#####Navigation Bar START#####
+    print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#848484">
+  <tr><td><center>~;
+
+    foreach $c (@cats) {
+        $t = $cats{$c};
+           $inlist    = "false";
+           foreach $testet (@available) {
+               if ($testet eq $c) {
+                $inlist = "true";
+               } 
+            }
+        if ($in{'cat'} eq $c) {
+           if ($inlist eq "true") {
+
+              if ($c eq "") {
+                print qq~<img src="/images/cats_over/others.jpg">~;
+
+              } elsif ($c eq "webmin") {
+               if (@_ > 1) {
+               print qq~<a href=/?cat=$c><img src="/images/cats_over/$c.jpg" border=0></a>~;
+                } else {
+               print qq~<img src="/images/cats_over/$c.jpg" border=0>~;
+                }
+               } else {
+               print qq~<img src="/images/cats_over/$c.jpg">~;
+
+
+              }
+
+        } else {
+            print qq~<img src="/images/cats_over/unknown.jpg">~;
+
+
+           }
+        }
+        else {
+            if ($inlist eq "true") {
+              if ($c eq "") {
+                print qq~<a href=/?cat=$c><img src="/images/cats/others.jpg" border=0 alt=$c></a>~;
+
+
+              } else {
+               print qq~<a href=/?cat=$c><img src="/images/cats/$c.jpg" border=0 alt=$c></a>~;
+
+
+              }
+        } else {
+            print qq~<a href=/?cat=$c><img src="/images/cats/unknown.jpg" border=0 alt=$c></a>~;
+
+
+        }
+           
+            }
+        }
+
+    print qq~
+    </center></td>
+  </tr>
+</table>~;
+    print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/shadow2.jpg" height="4">
+  <tr>
+    <td width="100%"><img src="/images/shadow2.jpg"></td>
+  </tr>
+</table>~;
+
+
+   }
+
+if (@_ > 1 && (!$_[5] || $ENV{'HTTP_WEBMIN_SERVERS'})) {
+   # Show tabs under module categories
+print '<table width=100% border="0" cellspacing="0" cellpadding="0" background="/images/tabs/bgimage.jpg"><tr><td>';
+   
+     if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
+       &tab_start();
+       print "<a href='$ENV{'HTTP_WEBMIN_SERVERS'}'>",
+             "$text{'header_servers'}</a><br>\n";
+       &tab_end();
+       }
+       if (!$_[4]) { &tab_start; print "<a href=\"/$module_name/\">",
+                           "$text{'header_module'}</a>"; &tab_end;}
+       if (ref($_[2]) eq "ARRAY") {
+               &tab_start; print &hlink($text{'header_help'}, $_[2]->[0], $_[2]->[1]); &tab_end;
+               }
+       elsif (defined($_[2])) {
+               &tab_start; 
+print &hlink($text{'header_help'}, $_[2]); 
+&tab_end;
+               }
+       if ($_[3]) {
+               local %access = &get_module_acl();
+               if (!$access{'noconfig'}) {
+                       &tab_start; print "<a href=\"/config.cgi?$module_name\">",
+                             $text{'header_config'},"</a>"; &tab_end;
+                       }
+               }
+
+    foreach $t (split(/<br>/, $_[6])) {
+      if ($t =~ /\S/) {
+             &tab_start; print $t; &tab_end;
+      }
+    }
+
+print "</td></tr></table>";
+
+    if (!$_[5]) {
+           # Show page title in tab
+           local $title = $_[0];
+           $title =~ s/&auml;/ä/g;
+           $title =~ s/&ouml;/ö/g;
+           $title =~ s/&uuml;/ü/g;
+           $title =~ s/&nbsp;/ /g;
+
+#          print "<p><table border=0 cellpadding=0 cellspacing=0 width=95% align=center><tr><td><table border=0 cellpadding=0 cellspacing=0 height=20><tr>\n";
+           $usercol = defined($gconfig{'cs_header'}) ||
+                  defined($gconfig{'cs_table'}) ||
+                  defined($gconfig{'cs_page'});
+#          print "<td bgcolor=#bae3ff>",
+#            "<img src=/images/tabs/blue_left.jpg alt=\"\">","</td>\n";
+#          print "<td bgcolor=#bae3ff>&nbsp;<b>$title</b>&nbsp;</td>\n";
+#          print "<td bgcolor=#bae3ff>",
+#            "<img src=/images/tabs/blue_right.jpg alt=\"\">","</td>\n";
+#          print "</tr></table></td></tr></table>"; 
+
+print "<center><font color=#FFFFFF><b>$title</b></font></center>";
+&make_sep;
+            &theme_prebody;
+       }
+    } 
+@header_arguments = @_;
+}
+
+sub theme_prebody
+{
+print "<table border=0 width=100% align=center cellspacing=0 cellpadding=0><tr><td background=/images/msctile.jpg>\n";
+}
+
+sub theme_postbody
+{
+print "</table>\n" if (@header_arguments > 1 && !$header_arguments[5]);
+}
+
+sub theme_footer {
+local $i;
+
+print "</table></table><br>\n"
+       if (@header_arguments > 1 && !$header_arguments[5]);
+
+print "<table border=0 width=100% align=center cellspacing=0 cellpadding=0><tr><td>\n";
+
+for($i=0; $i+1<@_; $i+=2) {
+    local $url = $_[$i];
+    if ($url eq '/') {
+        $url = "/?cat=$module_info{'category'}";
+        }
+    elsif ($url eq '' && $module_name) {
+        $url = "/$module_name/";
+        }
+    elsif ($url =~ /^\?/ && $module_name) {
+        $url = "/$module_name/$url";
+        }
+    if ($i == 0) {
+        print "&nbsp;<a href=\"$url\"><img alt=\"<-\" align=middle border=0 src=/images/arrow.jpg></a>\n";
+        }
+    else {
+        print "&nbsp;|\n";
+        }
+    print "&nbsp;<a href=\"$url\"><font color=#FFFFFF>",&text('main_return', $_[$i+1]),"</font></a>\n";
+    }
+print "</td></tr></table>\n";
+
+print "<br>\n";
+if (!$_[$i]) {
+    local $postbody = $tconfig{'postbody'};
+    if ($postbody) {
+        local $hostname = &get_display_hostname();
+        local $version = &get_webmin_version();
+        local $os_type = $gconfig{'real_os_type'} ?
+                $gconfig{'real_os_type'} : $gconfig{'os_type'};
+        local $os_version = $gconfig{'real_os_version'} ?
+                $gconfig{'real_os_version'} : $gconfig{'os_version'};
+        $postbody =~ s/%HOSTNAME%/$hostname/g;
+        $postbody =~ s/%VERSION%/$version/g;
+        $postbody =~ s/%USER%/$remote_user/g;
+        $postbody =~ s/%OS%/$os_type $os_version/g;
+        print "$postbody\n";
+        }
+    if ($tconfig{'postbodyinclude'}) {
+        open(INC, $module_name ?
+            "../$gconfig{'theme'}/$tconfig{'postbodyinclude'}" :
+            "$gconfig{'theme'}/$tconfig{'postbodyinclude'}");
+        while(<INC>) {
+            print;
+            }
+        close(INC);
+        }
+    if (defined(&theme_postbody)) {
+        &theme_postbody(@_);
+        }
+    print "</body></html>\n";
+    }
+
+}
+
+#sub theme_error {
+
+#print "error";
+
+#}
+
+
+sub chop_font {
+
+if (!$lang->{'titles'} || $gconfig{'texttitles'}) {
+       print $t;
+} else {
+        foreach $l (split(//, $t)) {
+            $ll = ord($l);
+            if ($ll > 127 && $lang->{'charset'}) {
+                print "<img src=/images/letters2/$ll.$lang->{'charset'}.gif alt=\"$l\" align=bottom border=0>";
+                }
+            elsif ($l eq " ") {
+                print "<img src=/images/letters2/$ll.gif alt=\"\&nbsp;\" align=bottom border=0>";
+                }
+            else {
+                print "<img src=/images/letters2/$ll.gif alt=\"$l\" align=bottom border=0>";
+                }
+            }
+       }
+}
+
+sub tab_start {
+    print qq~    <td nowrap>
+      <table border="0" cellspacing="0" cellpadding="0">
+        <tr>
+          <td background="/images/tabs/bg.jpg"><img src="/images/tabs/left.jpg" nowrap></td>
+          <td background="/images/tabs/bg.jpg" nowrap>
+          ~;
+}
+
+
+sub tab_end {
+     print qq~</td>
+          <td background="/images/tabs/bg.jpg" nowrap><img src="/images/tabs/right.jpg"></td>
+        </tr>
+      </table>
+
+    </td>~;
+}
+
+1;
+
+sub make_sep {
+
+print qq~
+<table cellpadding="0" cellspacing="0" border="0" width="100%" background="/images/cat_sep.jpg">
+    <tr>
+    <td valign="Top" width="100%"><img src="/images/left_cat_sep.jpg" alt=" ">
+    </td>
+    <td valign="Top"><img src="/images/right_cat_sep.jpg" alt=" "></td>
+    </tr>
+</table>
+~;
+
+}
diff --git a/msctheme-enhanced/theme.pl b/msctheme-enhanced/theme.pl
new file mode 100644 (file)
index 0000000..1cae660
--- /dev/null
@@ -0,0 +1,821 @@
+#!/usr/local/bin/perl
+
+#theme_prebody - called just before the main body of every page, so it can print any HTML it likes.
+#theme_postbody - called just after the main body of every page.
+#theme_header - called instead of the normal header function, with the same parameters. You could use this to re-write the header function in your own style with help and index links whereever you want them.
+#theme_footer - called instead of the footer function with the same parameters.
+#theme_error - called instead of the error function, with the same parameters.
+
+%letter_sizes = (
+       '100.gif', [ 10, 16 ],
+       '101.gif', [ 11, 16 ],
+       '102.gif', [ 6, 16 ],
+       '103.gif', [ 10, 16 ],
+       '104.gif', [ 9, 16 ],
+       '105.gif', [ 4, 16 ],
+       '106.gif', [ 5, 16 ],
+       '107.gif', [ 9, 16 ],
+       '108.gif', [ 4, 16 ],
+       '109.gif', [ 14, 16 ],
+       '110.gif', [ 9, 16 ],
+       '111.gif', [ 11, 16 ],
+       '112.gif', [ 10, 16 ],
+       '113.gif', [ 10, 16 ],
+       '114.gif', [ 6, 16 ],
+       '115.gif', [ 8, 16 ],
+       '116.gif', [ 6, 16 ],
+       '117.gif', [ 9, 16 ],
+       '118.gif', [ 10, 16 ],
+       '119.gif', [ 13, 16 ],
+       '120.gif', [ 10, 16 ],
+       '121.gif', [ 10, 16 ],
+       '122.gif', [ 8, 16 ],
+       '123.gif', [ 7, 16 ],
+       '124.gif', [ 4, 16 ],
+       '125.gif', [ 7, 16 ],
+       '126.gif', [ 9, 16 ],
+       '177.iso-8859-2.gif', [ 10, 16 ],
+       '179.iso-8859-2.gif', [ 7, 16 ],
+       '182.iso-8859-2.gif', [ 9, 16 ],
+       '188.iso-8859-2.gif', [ 9, 16 ],
+       '191.iso-8859-2.gif', [ 9, 16 ],
+       '192.gif', [ 12, 16 ],
+       '193.gif', [ 12, 16 ],
+       '194.gif', [ 11, 16 ],
+       '195.gif', [ 12, 16 ],
+       '196.gif', [ 12, 16 ],
+       '197.gif', [ 12, 16 ],
+       '198.gif', [ 13, 16 ],
+       '199.gif', [ 12, 16 ],
+       '200.gif', [ 7, 16 ],
+       '201.gif', [ 8, 16 ],
+       '202.gif', [ 8, 16 ],
+       '203.gif', [ 7, 16 ],
+       '204.gif', [ 6, 16 ],
+       '205.gif', [ 5, 16 ],
+       '206.gif', [ 7, 16 ],
+       '207.gif', [ 7, 16 ],
+       '208.gif', [ 11, 16 ],
+       '208.iso-8859-9.gif', [ 13, 16 ],
+       '209.gif', [ 10, 16 ],
+       '210.gif', [ 13, 16 ],
+       '211.gif', [ 13, 16 ],
+       '211.iso-8859-2.gif', [ 13, 16 ],
+       '212.gif', [ 12, 16 ],
+       '213.gif', [ 13, 16 ],
+       '214.gif', [ 13, 16 ],
+       '214.iso-8859-9.gif', [ 13, 16 ],
+       '215.gif', [ 9, 16 ],
+       '216.gif', [ 13, 16 ],
+       '217.gif', [ 9, 16 ],
+       '218.gif', [ 9, 16 ],
+       '219.gif', [ 9, 16 ],
+       '220.gif', [ 9, 16 ],
+       '220.iso-8859-9.gif', [ 9, 16 ],
+       '221.gif', [ 11, 16 ],
+       '221.iso-8859-9.gif', [ 5, 16 ],
+       '222.gif', [ 9, 16 ],
+       '222.iso-8859-9.gif', [ 11, 16 ],
+       '223.gif', [ 9, 16 ],
+       '224.gif', [ 10, 16 ],
+       '225.gif', [ 10, 16 ],
+       '226.gif', [ 11, 16 ],
+       '227.gif', [ 10, 16 ],
+       '228.gif', [ 10, 16 ],
+       '229.gif', [ 11, 16 ],
+       '230.gif', [ 16, 16 ],
+       '230.iso-8859-2.gif', [ 9, 16 ],
+       '231.gif', [ 10, 16 ],
+       '231.iso-8859-9.gif', [ 10, 16 ],
+       '231.iso.8859-9.gif', [ 10, 16 ],
+       '232.gif', [ 11, 16 ],
+       '233.gif', [ 11, 16 ],
+       '234.gif', [ 11, 16 ],
+       '234.iso-8859-2.gif', [ 9, 16 ],
+       '235.gif', [ 11, 16 ],
+       '236.gif', [ 6, 16 ],
+       '237.gif', [ 6, 16 ],
+       '238.gif', [ 6, 16 ],
+       '239.gif', [ 7, 16 ],
+       '240.gif', [ 10, 16 ],
+       '240.iso-8859-9.gif', [ 10, 16 ],
+       '241.gif', [ 9, 16 ],
+       '241.iso-8859-2.gif', [ 9, 16 ],
+       '242.gif', [ 11, 16 ],
+       '243.gif', [ 11, 16 ],
+       '243.iso-8859-2.gif', [ 11, 16 ],
+       '244.gif', [ 11, 16 ],
+       '245.gif', [ 11, 16 ],
+       '246.gif', [ 11, 16 ],
+       '246.iso-8859-9.gif', [ 11, 16 ],
+       '247.gif', [ 9, 16 ],
+       '248.gif', [ 10, 16 ],
+       '249.gif', [ 9, 16 ],
+       '250.gif', [ 9, 16 ],
+       '251.gif', [ 9, 16 ],
+       '252.gif', [ 9, 16 ],
+       '252.iso-8859-9.gif', [ 9, 16 ],
+       '253.gif', [ 10, 16 ],
+       '253.iso-8859-9.gif', [ 5, 16 ],
+       '254.gif', [ 10, 16 ],
+       '255.gif', [ 9, 16 ],
+       '32.gif', [ 6, 16 ],
+       '33.gif', [ 4, 16 ],
+       '34.gif', [ 7, 16 ],
+       '35.gif', [ 9, 16 ],
+       '36.gif', [ 8, 16 ],
+       '37.gif', [ 13, 16 ],
+       '38.gif', [ 11, 16 ],
+       '39.gif', [ 3, 16 ],
+       '40.gif', [ 6, 16 ],
+       '41.gif', [ 6, 16 ],
+       '42.gif', [ 7, 16 ],
+       '43.gif', [ 9, 16 ],
+       '44.gif', [ 4, 16 ],
+       '45.gif', [ 6, 16 ],
+       '46.gif', [ 4, 16 ],
+       '47.gif', [ 7, 16 ],
+       '48.gif', [ 9, 16 ],
+       '49.gif', [ 6, 16 ],
+       '50.gif', [ 9, 16 ],
+       '51.gif', [ 9, 16 ],
+       '52.gif', [ 10, 16 ],
+       '53.gif', [ 9, 16 ],
+       '54.gif', [ 10, 16 ],
+       '55.gif', [ 8, 16 ],
+       '56.gif', [ 9, 16 ],
+       '57.gif', [ 10, 16 ],
+       '58.gif', [ 5, 16 ],
+       '59.gif', [ 4, 16 ],
+       '60.gif', [ 9, 16 ],
+       '61.gif', [ 10, 16 ],
+       '62.gif', [ 10, 16 ],
+       '63.gif', [ 9, 16 ],
+       '64.gif', [ 12, 16 ],
+       '65.gif', [ 12, 16 ],
+       '66.gif', [ 9, 16 ],
+       '67.gif', [ 12, 16 ],
+       '68.gif', [ 10, 16 ],
+       '69.gif', [ 7, 16 ],
+       '70.gif', [ 7, 16 ],
+       '71.gif', [ 13, 16 ],
+       '72.gif', [ 9, 16 ],
+       '73.gif', [ 5, 16 ],
+       '74.gif', [ 8, 16 ],
+       '75.gif', [ 9, 16 ],
+       '76.gif', [ 8, 16 ],
+       '77.gif', [ 12, 16 ],
+       '78.gif', [ 10, 16 ],
+       '79.gif', [ 12, 16 ],
+       '80.gif', [ 9, 16 ],
+       '81.gif', [ 13, 16 ],
+       '82.gif', [ 9, 16 ],
+       '83.gif', [ 9, 16 ],
+       '84.gif', [ 8, 16 ],
+       '85.gif', [ 9, 16 ],
+       '86.gif', [ 11, 16 ],
+       '87.gif', [ 14, 16 ],
+       '88.gif', [ 11, 16 ],
+       '89.gif', [ 11, 16 ],
+       '90.gif', [ 9, 16 ],
+       '91.gif', [ 5, 16 ],
+       '93.gif', [ 6, 16 ],
+       '94.gif', [ 9, 16 ],
+       '95.gif', [ 9, 16 ],
+       '96.gif', [ 6, 16 ],
+       '97.gif', [ 11, 16 ],
+       '98.gif', [ 10, 16 ],
+       '99.gif', [ 10, 16 ]
+       );
+
+sub theme_header {
+
+local @available = ("webmin", "system", "servers", "cluster", "hardware", "", "net", "kororaweb");
+
+local $ll;
+local %access = &get_module_acl();
+local %gaccess = &get_module_acl(undef, "");
+print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
+print "<html>\n";
+local $os_type = $gconfig{'real_os_type'} ? $gconfig{'real_os_type'}
+                      : $gconfig{'os_type'};
+local $os_version = $gconfig{'real_os_version'} ? $gconfig{'real_os_version'}
+                            : $gconfig{'os_version'};
+print "<head>\n";
+if ($charset) {
+    print "<meta http-equiv=\"Content-Type\" ",
+          "content=\"text/html; Charset=$charset\">\n";
+    }
+print "<link rel='icon' href='/images/webmin_icon.png' type='image/png'>\n";
+if (@_ > 0) {
+    if ($gconfig{'sysinfo'} == 1) {
+        printf "<title>%s : %s on %s (%s %s)</title>\n",
+            $_[0], $remote_user, &get_system_hostname(),
+            $os_type, $os_version;
+        }
+    else {
+        print "<title>$_[0]</title>\n";
+        }
+    print $_[7] if ($_[7]);
+    if ($gconfig{'sysinfo'} == 0 && $remote_user) {
+        print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
+        printf
+        "defaultStatus=\"%s%s logged into %s %s on %s (%s %s)\";\n",
+            $ENV{'ANONYMOUS_USER'} ? "Anonymous user" : $remote_user,
+            $ENV{'SSL_USER'} ? " (SSL certified)" :
+            $ENV{'LOCAL_USER'} ? " (Local user)" : "",
+           $text{'programname'},
+            &get_webmin_version(), &get_system_hostname(),
+            $os_type, $os_version;
+
+#########JAVA & CSS FOR MENUS START###########
+print qq~
+   var r;
+   var menuLive;
+   var shouldSet;
+   var image_name;
+   var image_over;
+   var image_out;
+
+   function showMenu(cat) {
+     if (menuLive) {
+       if (r) {
+           r.style.display='none'
+       }
+       r = document.getElementById(cat)
+       r.style.display=''
+     }
+   }
+
+   function setLive() {
+       if (menuLive) {
+          menuLive ='' 
+          hideMenu()
+       } else {
+          menuLive = '1'
+       }
+   }
+
+   function hideMenu() {
+      if (r) {
+         r.style.display='none'
+      }
+   }
+
+   function mouseover(image_name, image_over) {
+      this.document[image_name].src= image_over;
+   }
+   function mouseout(image_name, image_out) {
+      this.document[image_name].src=image_out;
+   }
+
+
+</script>
+                                                                                
+<style type="text/css">
+div.menucontainer {
+    padding: 2px 2px;
+    border: 1px groove gray;
+    background: lightgrey;
+    border-width: 2px;
+    position: absolute;
+}
+
+div.menu a  {
+    font: 1em sans-serif;
+    text-decoration: none;
+}
+
+div.menu {
+    border-bottom: 1px solid silver;
+}
+
+div.menu div:hover {
+    color: white;
+    background: grey;
+}
+
+
+div.title_menu {
+    border-bottom: 1px solid silver;
+    font: 1em sans-serif;
+    list-style-type: none;
+    background: black;
+    color: white;
+    font-weight: bold;
+}
+
+</style>
+~;
+#########JAVA & CSS FOR MENUS STOP###########
+
+        }
+    }
+
+@msc_modules = &get_available_module_infos()
+       if (!length(@msc_modules));
+
+print "</head>\n";
+if ($theme_no_table) {
+       print '<body bgcolor=#6696bc link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
+       }
+else {
+       print '<body bgcolor=#6696bc link=#000000 vlink=#000000 text=#000000 leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" '.$_[8].'>';
+       }
+
+if ($remote_user && @_ > 1) {
+       # Show basic header with webmin.com link and logout button
+       local $logout = $main::session_id ? "/session_login.cgi?logout=1"
+                                         : "/switch_user.cgi";
+       local $loicon = $main::session_id ? "logout.jpg" : "switch.jpg";
+       local $lowidth = $main::session_id ? 84 : 27;
+       local $lotext = $main::session_id ? $text{'main_logout'}
+                                         : $text{'main_switch'};
+       print qq~
+          <table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/top_bar/bg.jpg" height="32">
+         <tr>
+           <td width="4" nowrap><img src="/images/top_bar/left.jpg" width="4" height="32"></td>
+           <td width="100%" nowrap><a href="http://www.webmin.com"><img src="/images/top_bar/webmin_logo.jpg" width="99" height="32" border="0" alt="Webmin home page"></a></td>~;
+       if (!$ENV{'ANONYMOUS_USER'}) {
+               if ($gconfig{'nofeedbackcc'} != 2 && $gaccess{'feedback'}) {
+                       print qq~<td><a href='/feedback_form.cgi?module=$module_name'><img src=/images/top_bar/feedback.jpg width=97 height=32 alt="$text{'main_feedback'}" border=0></a></td>~;
+                       }
+               if (!$ENV{'SSL_USER'} && !$ENV{'LOCAL_USER'} &&
+                   !$ENV{'HTTP_WEBMIN_SERVERS'}) {
+                       if ($gconfig{'nofeedbackcc'} != 2 &&
+                           $gaccess{'feedback'}) {
+                               print qq~<td><img src=/images/top_bar/top_sep.jpg width=12 height=32></td>~;
+                               }
+                       print qq~<td width="84" nowrap><a href='$logout'><img src="/images/top_bar/$loicon" height="31" width=$lowidth border="0" alt="$lotext"></a></td>~;
+                       }
+               }
+       print qq~<td width="3" nowrap>
+             <div align="right"><img src="/images/top_bar/right.jpg" width="3" height="32"></div>
+           </td>
+         </tr>
+       </table>~;
+       }
+
+local $one = @msc_modules == 1 && $gconfig{'gotoone'};
+local $notabs = $gconfig{"notabs_${base_remote_user}"} == 2 ||
+       $gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'};
+if (@_ > 1 && !$one && $remote_user && !$notabs) {
+    # Display module categories
+    print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" height="7">
+  <tr>
+    <td background="/images/top_bar/shadow_bg.jpg" nowrap><img src="/images/top_bar/shadow.jpg" width="8" height="7"></td>
+  </tr>
+</table>~;
+
+    local %catnames;
+    &read_file("$config_directory/webmin.catnames", \%catnames);
+    foreach $m (@msc_modules) {
+        local $c = $m->{'category'};
+        next if ($cats{$c});
+        if (defined($catnames{$c})) {
+            $cats{$c} = $catnames{$c};
+            }
+        elsif ($text{"category_$c"}) {
+            $cats{$c} = $text{"category_$c"};
+            }
+        else {
+            # try to get category name from module ..
+            local %mtext = &load_language($m->{'dir'});
+            if ($mtext{"category_$c"}) {
+                $cats{$c} = $mtext{"category_$c"};
+                }
+            else {
+                $c = $m->{'category'} = "";
+                $cats{$c} = $text{"category_$c"};
+                }
+            }
+        }
+    @cats = sort { $b cmp $a } keys %cats;
+    $cats = @cats;
+    $per = $cats ? 100.0 / $cats : 100;
+
+    if ($theme_index_page) {
+           if (!defined($in{'cat'})) {
+              
+               # Use default category
+               if (defined($gconfig{'deftab'}) &&
+                   &indexof($gconfig{'deftab'}, @cats) >= 0) {
+                   $in{'cat'} = $gconfig{'deftab'};
+                   }
+               else {
+                   $in{'cat'} = $cats[0];
+                   }
+               }
+           elsif (!$cats{$in{'cat'}}) {
+               $in{'cat'} = "";
+               }
+    }
+
+#####Navigation Bar START#####
+    print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" height="57" background="/images/nav/bg.jpg">
+  <tr background="/images/nav/bg.jpg">
+    <td width="6" nowrap><img src="/images/nav/left.jpg" width="3" height="57"></td>~;
+
+    foreach $c (@cats) {
+        local $t = $cats{$c};
+           $inlist    = "false";
+           foreach $testet (@available) {
+               if ($testet eq $c) {
+                $inlist = "true";
+               } 
+            }
+        if ($in{'cat'} eq $c && $theme_index_page) {
+           if ($inlist eq "true") {
+
+              if ($c eq "") {
+
+###OTHER MENU [ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=" onMouseOver="showMenu('other_menu');"><img src="/images/cats/other_over.jpg" alt="$t" width="43" height="44" border="0" name="other_image"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('other_menu');" onMouseOver="showMenu('other_menu');"><br><a href="/?cat=" onMouseOver="showMenu('other_menu');">~;
+
+            &chop_font;
+
+                print "</a></center>";
+&create_menu();
+                print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~; 
+              } elsif ($c eq "webmin") {
+
+###WEBMIN MENU [ACTIVE]
+
+               if (@_ > 1) {
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><img src="/images/cats/$c\_over.jpg" alt="$t" width="43" height="44" border="0"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><br>~;
+
+
+            &chop_font;
+                          print "</a></center>";
+&create_menu();
+                          print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+                } else {
+
+###UNKNOWN MENU [ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><img src="/images/cats/unknown_over.jpg" alt="$t" width="43" height="44" border="0"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><br>~;
+                     &chop_font;
+                     print "</a></center>";
+&create_menu();
+                     print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+                }
+               } else {
+
+###REST OF MENUS [ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><img src="/images/cats/$c\_over.jpg" alt="$t" width="43" height="44" border="0"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><br>~;
+
+            &chop_font;
+
+               print "</a></center>";
+&create_menu();
+               print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+              }
+
+        } else {
+
+###UNKNOWN CATAGORY [ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><img src="/images/cats/unknown_over.jpg" alt="$t" width="43" height="44" border="0"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu');"><br>~;
+
+            &chop_font;
+
+            print "</a></center>";
+&create_menu();
+            print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+           }
+        }
+        else {
+            if ($inlist eq "true") {
+              if ($c eq "") {
+
+###OTHER MENU [NON-ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=" onMouseOver="showMenu('other_menu'); mouseover('other_image','/images/cats/other_over.jpg');" onMouseOut="mouseout('other_image','/images/cats/other.jpg');"><img src="/images/cats/other.jpg" alt="$t" width="43" height="44" border="0" name="other_image"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('other_menu');" onMouseOver="showMenu('other_menu'); mouseover('other_image','/images/cats/other_over.jpg');" onMouseOut="mouseout('other_image','/images/cats/other.jpg');"><a href="/?cat=" onMouseOver="showMenu('other_menu'); mouseover('other_image','/images/cats/other_over.jpg');" onMouseOut="mouseout('other_image','/images/cats/other.jpg');"><br>~;
+
+
+            &chop_font;
+
+                print "</a></center>";
+&create_menu();
+                print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~; 
+              } else {
+
+###REST OF MENUS [NON-ACTIVE]
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/$c\_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/$c.jpg');"><img src="/images/cats/$c.jpg" alt="$t" width="43" height="44" border="0" name="$c\_image"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/$c\_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/$c.jpg');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/$c\_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/$c.jpg');"><br>~;
+
+
+            &chop_font;
+
+               print "</a></center>";
+&create_menu();
+               print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+              }
+        } else {
+
+###UNKNOWN CATAGORY [NON-ACTIVE]
+
+                print qq~<td nowrap><center><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/unknown_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/unknown.jpg');"><img src="/images/cats/unknown.jpg" alt="$t" width="43" height="44" border="0" name="$c\_image"></a><img src="/images/list.gif" width="10" height="44" border="0" onClick="setLive(); showMenu('$c\_menu');" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/unknown_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/unknown.jpg');"><a href="/?cat=$c" onMouseOver="if (menuLive) showMenu('$c\_menu'); mouseover('$c\_image','/images/cats/unknown_over.jpg');" onMouseOut="mouseout('$c\_image','/images/cats/unknown.jpg');"><br>~;
+
+            &chop_font;
+
+            print "</a></center>";
+&create_menu();
+            print qq~</td>
+    <td width="17" nowrap><img src="/images/nav/sep.jpg" width="17" height="57"></td>~;
+        }
+           
+            }
+        }
+
+    print qq~<td width="100%" nowrap><div onClick="hideMenu(); if (menuLive) setLive();">&nbsp;</td>
+    <td nowrap>&nbsp;</td>
+  </tr>
+</table>~;
+    print qq~<div onClick="hideMenu(); if (menuLive) setLive();"><table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/nav/bottom_bg.jpg" height="4">
+  <tr>
+    <td width="100%"><img src="/images/nav/bottom_left.jpg" width="3" height="4"></td>
+  </tr>
+</table>~;
+   }
+
+if (@_ > 1 && (!$_[5] || $ENV{'HTTP_WEBMIN_SERVERS'})) {
+   # Show tabs under module categories
+   print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/nav/bottom_shadow2.jpg"> <tr background="/images/nav/bottom_shadow2.jpg">~;
+
+   if ($gconfig{'sysinfo'} == 2 && $remote_user) {
+       &tab_start();
+       printf "%s%s logged into %s %s on %s (%s%s)</td>\n",
+               $ENV{'ANONYMOUS_USER'} ? "Anonymous user" : "<tt>$remote_user</tt>",
+               $ENV{'SSL_USER'} ? " (SSL certified)" :
+               $ENV{'LOCAL_USER'} ? " (Local user)" : "",
+               $text{'programname'},
+               $version, "<tt>".&get_system_hostname()."</tt>",
+               $os_type, $os_version eq "*" ? "" : " $os_version";
+       &tab_end();
+       }
+   if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
+       &tab_start();
+       print "<a href='$ENV{'HTTP_WEBMIN_SERVERS'}'>",
+             "$text{'header_servers'}</a><br>\n";
+       &tab_end();
+       }
+       if ($notabs && !$_[5]) { 
+               &tab_start;
+               print "<a href='$gconfig{'webprefix'}/?cat=$module_info{'category'}'>$text{'header_webmin'}</a><br>\n";
+               &tab_end;
+               }
+       if (!$_[4]) {
+               local $mi = $module_index_link ||
+                           $module_name ? "/$module_name/" : "/";
+               &tab_start; print "<a href=\"$gconfig{'webprefix'}$mi\">",
+                           "$text{'header_module'}</a>"; &tab_end;
+               }
+       if (ref($_[2]) eq "ARRAY" && !$ENV{'ANONYMOUS_USER'}) {
+               &tab_start; print &hlink($text{'header_help'}, $_[2]->[0], $_[2]->[1]); &tab_end;
+               }
+       elsif (defined($_[2]) && !$ENV{'ANONYMOUS_USER'}) {
+               &tab_start; print &hlink($text{'header_help'}, $_[2]); &tab_end;
+               }
+       if ($_[3]) {
+               if (!$access{'noconfig'}) {
+                       &tab_start; print "<a href=\"/config.cgi?$module_name\">",
+                             $text{'header_config'},"</a>"; &tab_end;
+                       }
+               }
+
+    foreach $t (split(/<br>/, $_[6])) {
+      if ($t =~ /\S/) {
+             &tab_start; print $t; &tab_end;
+      }
+    }
+
+print qq~
+    <td nowrap width="100%" background="/images/nav/bottom_shadow2.jpg" valign="top">
+
+      <table width="100%" border="0" cellspacing="0" cellpadding="0" background="/images/nav/bottom_shadow2.jpg">
+        <tr>
+          <td><img src="/unauthenticated/nav/bottom_shadow.jpg" width="43" height="9"></td>
+        </tr>
+      </table>
+
+
+    </td>
+  </tr>
+</table>~;
+
+    if (!$_[5]) {
+           # Show page title in tab
+           local $title = $_[0];
+           $title =~ s/&auml;/ä/g;
+           $title =~ s/&ouml;/ö/g;
+           $title =~ s/&uuml;/ü/g;
+           $title =~ s/&nbsp;/ /g;
+
+           print "<p><table border=0 cellpadding=0 cellspacing=0 width=95% align=center><tr><td><table border=0 cellpadding=0 cellspacing=0 height=20><tr>\n";
+           print "<td bgcolor=#bae3ff>",
+             "<img src=/images/tabs/blue_left.jpg width=13 height=22 ",
+             "alt=\"\">","</td>\n";
+           print "<td bgcolor=#bae3ff>&nbsp;<b>$title</b>&nbsp;</td>\n";
+           print "<td bgcolor=#bae3ff>",
+             "<img src=/images/tabs/blue_right.jpg width=19 height=22 ",
+             "alt=\"\">","</td>\n";
+           if ($_[9]) {
+               print "</tr></table></td> <td align=right><table border=0 cellpadding=0 cellspacing=0 height=20><tr>\n";
+               print "<td bgcolor=#bae3ff>",
+                     "<img src=/images/tabs/blue_left.jpg width=13 height=22 ",
+                     "alt=\"\">","</td>\n";
+               print "<td bgcolor=#bae3ff>&nbsp;<b>$_[9]</b>&nbsp;</td>\n";
+               print "<td bgcolor=#bae3ff>",
+                     "<img src=/images/tabs/blue_right.jpg width=19 height=22",
+                     " alt=\"\">","</td>\n";
+               }
+           print "</tr></table></td></tr></table>"; 
+
+            &theme_prebody;
+       }
+    } elsif (@_ > 1) {
+           print qq~<table width="100%" border="0" cellspacing="0" cellpadding="0" background="/unauthenticated/nav/bottom_shadow.jpg">
+         <tr>
+           <td width="100%" nowrap><img src="/unauthenticated/nav/bottom_shadow.jpg" width="43" height="9"></td>
+         </tr>
+       </table><br>~;
+    }
+@header_arguments = @_;
+}
+
+sub theme_prebody
+{
+if ($theme_no_table) {
+       print "<ul>\n";
+       }
+else {
+       #print "<table border=0 width=95% align=center cellspacing=0 cellpadding=0><tr><td background=/images/msctile2.jpg>\n";
+       print "<table border=0 width=95% align=center cellspacing=0 cellpadding=0><tr><td bgcolor=#ffffff>\n";
+       print "<table border=0 width=95% align=center cellspacing=0 cellpadding=0><tr><td>\n";
+       }
+}
+
+sub theme_footer {
+local $i;
+
+if ($theme_no_table) {
+       print "</ul>\n";
+       }
+elsif (@header_arguments > 1 && !$header_arguments[5]) {
+       print "</table></table><br>\n";
+       }
+
+print "<table border=0 width=100% align=center cellspacing=0 cellpadding=0 bgcolor=#6696bc><tr><td>\n";
+
+for($i=0; $i+1<@_; $i+=2) {
+    local $url = $_[$i];
+    if ($url eq '/') {
+        $url = "/?cat=$module_info{'category'}";
+        }
+    elsif ($url eq '' && $module_name) {
+        $url = "/$module_name/";
+        }
+    elsif ($url =~ /^\?/ && $module_name) {
+        $url = "/$module_name/$url";
+        }
+    if ($i == 0) {
+        print "&nbsp;<a href=\"$url\"><img alt=\"<-\" align=middle border=0 src=/images/arrow.jpg></a>\n";
+        }
+    else {
+        print "&nbsp;|\n";
+        }
+    print "&nbsp;<a href=\"$url\">",&text('main_return', $_[$i+1]),"</a>\n";
+    }
+print "</td></tr></table>\n";
+
+print "<br>\n";
+if (!$_[$i]) {
+    local $postbody = $tconfig{'postbody'};
+    if ($postbody) {
+        local $hostname = &get_system_hostname();
+        local $version = &get_webmin_version();
+        local $os_type = $gconfig{'real_os_type'} ?
+                $gconfig{'real_os_type'} : $gconfig{'os_type'};
+        local $os_version = $gconfig{'real_os_version'} ?
+                $gconfig{'real_os_version'} : $gconfig{'os_version'};
+        $postbody =~ s/%HOSTNAME%/$hostname/g;
+        $postbody =~ s/%VERSION%/$version/g;
+        $postbody =~ s/%USER%/$remote_user/g;
+        $postbody =~ s/%OS%/$os_type $os_version/g;
+        print "$postbody\n";
+        }
+    if ($tconfig{'postbodyinclude'}) {
+        open(INC, $module_name ?
+            "../$gconfig{'theme'}/$tconfig{'postbodyinclude'}" :
+            "$gconfig{'theme'}/$tconfig{'postbodyinclude'}");
+        while(<INC>) {
+            print;
+            }
+        close(INC);
+        }
+    if (defined(&theme_postbody)) {
+        &theme_postbody(@_);
+        }
+    print "</div></body></html>\n";
+    }
+
+}
+
+#sub theme_error {
+
+#print "error";
+
+#}
+
+
+sub chop_font {
+
+if (!$current_lang_info->{'titles'} || $gconfig{'texttitles'}) {
+       print $t;
+} else {
+        foreach $l (split(//, $t)) {
+            $ll = ord($l);
+           local $gif;
+            if ($ll > 127 && $current_lang_info->{'charset'}) {
+               $gif = "$ll.$current_lang_info->{'charset'}.gif";
+               }
+           else {
+               $gif = "$ll.gif";
+               }
+           local $sz = $letter_sizes{$gif};
+           printf "<img src=/images/letters2/%s width=%d height=%d alt=\"%s\" align=bottom border=0>",
+               $gif, $sz->[0], $sz->[1], $ll eq " " ? "&nbsp;" : $l;
+            }
+       }
+}
+
+sub tab_start {
+    print qq~    <td nowrap>
+      <table border="0" cellspacing="0" cellpadding="0">
+        <tr>
+          <td background="/images/tabs/bg.jpg"><img src="/images/tabs/left.jpg" width="12" height="21" nowrap></td>
+          <td background="/images/tabs/bg.jpg" nowrap>
+          ~;
+}
+
+
+sub tab_end {
+     print qq~</td>
+          <td background="/images/tabs/bg.jpg" nowrap><img src="/images/tabs/right.jpg" width="15" height="21"></td>
+        </tr>
+        <tr>
+          <td nowrap><img src="/images/tabs/right_bottom.jpg" width="12" height="4"></td>
+          <td background="/images/tabs/bottom.jpg" nowrap><img src="/images/tabs/bottom.jpg" width="17" height="4"></td>
+          <td nowrap><img src="/images/tabs/left_bottom.jpg" width="15" height="4"></td>        </tr>
+      </table>
+
+    </td>~;
+}
+
+sub create_menu {
+   my $tmpid;
+   if ($c eq "") { $tmpid = "other"; }
+   else { $tmpid = $c; }
+
+   my $tmpimg;
+   if ($c eq "") { $tmpimg = "other"; }
+   if ($inlist eq "true" && $c ne "") { $tmpimg = "$c"; }
+   if ($inlist ne "true" && $c ne "") { $tmpimg = "unknown"; }
+
+   if ($in{'cat'} eq $c) {
+      print qq~
+         <div id="$tmpid\_menu" class="menucontainer" style="display:none" align="left">
+         <div id="$tmpid\_menu" class="title_menu"><center>$t</center></a></div>
+      ~;
+   } else {
+      print qq~
+         <div id="$tmpid\_menu" class="menucontainer" style="display:none" align="left" onMouseOver="mouseover('$tmpid\_image','/images/cats/$tmpimg\_over.jpg');" onMouseOut="mouseout('$tmpid\_image','/images/cats/$tmpimg.jpg');">
+         <div id="$tmpid\_menu" class="title_menu"><center>$t</center></a></div>
+      ~;
+   }
+
+   foreach $m (@msc_modules) {
+      next if ($m->{'category'} ne $c);
+      print "<div id=\"$tmpid\_menu\" class=\"menu\">";
+      print "<a href=/$m->{'dir'}/>";
+      print "<div id=\"$tmpid\_menu\">";
+      print "<img src=\"/$m->{'dir'}/images/icon.gif\" width=\"20\" height=\"20\" border=\"0\"> $m->{'desc'}";
+      print "</div></a></div>";
+   }
+
+   print "</div>";
+}
+
+1;
+
index 0cfe7f3..0564ea1 100755 (executable)
@@ -982,7 +982,7 @@ return $config{'host'} eq '' || $config{'host'} eq 'localhost' ||
 # Returns the parsed my.cnf file
 sub get_mysql_config
 {
-if (!defined(@mysql_config_cache)) {
+if (!length(@mysql_config_cache)) {
        if (!-r $config{'my_cnf'}) {
                return undef;
                }
diff --git a/osx-theme/theme.pl b/osx-theme/theme.pl
new file mode 100644 (file)
index 0000000..0fee3ec
--- /dev/null
@@ -0,0 +1,214 @@
+# theme.pl
+# Override functions for the OSX theme
+# XXX always starts with 'other' category?
+
+# header(title, image, [help], [config], [nomodule], [nowebmin], [rightside],
+#       [header], [body], [below])
+sub theme_header
+{
+print "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n";
+print "<head>\n";
+print $_[7];
+print "<title>$_[0]</title>\n";
+print "<link rel='stylesheet' href='/unauthenticated/style.css' type='text/css'>\n";
+if ($charset) {
+       print "<meta http-equiv=\"Content-Type\" ",
+             "content=\"text/html; Charset=$charset\">\n";
+       }
+print "</head>\n";
+print "<body $_[8]>\n";
+
+# Get all modules visible to this user
+@osx_modules = &get_available_module_infos()
+       if (!length(@osx_modules));
+
+# Show table of categories
+local $one = @osx_modules == 1 && $gconfig{'gotoone'};
+local $notabs = $gconfig{"notabs_${base_remote_user}"} == 2 ||
+       $gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'};
+if (@_ > 1 && !$one && $remote_user && !$notabs) {
+       local $logout;
+       if (!$ENV{'ANONYMOUS_USER'} && !$ENV{'SSL_USER'} &&
+           !$ENV{'LOCAL_USER'} && !$ENV{'HTTP_WEBMIN_SERVERS'}) {
+               if ($main::session_id) {
+                       $logout = "<a href='/session_login.cgi?logout=1'>$text{'main_logout'}</a>";
+                       }
+               else {
+                       $logout = "<a href='/switch_user.cgi'>$text{'main_switch'}</a>";
+                       }
+               }
+       &start_osx_table("Module Categories", $logout);
+       local %catnames;
+       &read_file("$config_directory/webmin.catnames", \%catnames);
+       foreach $m (@osx_modules) {
+               local $c = $m->{'category'};
+               next if ($cats{$c});
+               if (defined($catnames{$c})) {
+                   $cats{$c} = $catnames{$c};
+                   }
+               elsif ($text{"category_$c"}) {
+                   $cats{$c} = $text{"category_$c"};
+                   }
+               else {
+                   # try to get category name from module ..
+                   local %mtext = &load_language($m->{'dir'});
+                   if ($mtext{"category_$c"}) {
+                       $cats{$c} = $mtext{"category_$c"};
+                       }
+                   else {
+                       $c = $m->{'category'} = "";
+                       $cats{$c} = $text{"category_$c"};
+                       }
+                   }
+               }
+       @cats = sort { $b cmp $a } keys %cats;
+       $cats = @cats;
+       $per = $cats ? 100.0 / $cats : 100;
+
+       # Actually show category icons
+       # XXX spacing?
+       local (@icons, @titles, @links);
+       foreach $c (@cats) {
+               local $t = $cats{$c};
+               push(@titles, $t);
+               push(@icons, -r "$root_directory/$current_theme/cats/$c.gif" ?
+                       "/$current_theme/cats/$c.gif" :
+                       "/$current_theme/cats/unknown.gif");
+               push(@links, "/?cat=$c");
+               }
+       &icons_table(\@links, \@titles, \@icons,
+                    @links > 7 ? scalar(@links) : 7);
+
+       &end_osx_table();
+       }
+
+if (@_ > 1) {
+       # Open table for main page
+       local @right;
+       if ($ENV{'HTTP_WEBMIN_SERVERS'}) {
+               push(@right, "<a href='$ENV{'HTTP_WEBMIN_SERVERS'}'>".
+                            "$text{'header_servers'}</a>");
+               }
+       if (!$_[4]) {
+               # Module index link
+               local $idx = $module_info{'index_link'};
+               local $mi = $module_index_link || "/$module_name/$idx";
+               push(@right, "<a href=\"$gconfig{'webprefix'}$mi\">".
+                            "$text{'header_module'}</a>");
+               }
+       if (ref($_[2]) eq "ARRAY" && !$ENV{'ANONYMOUS_USER'}) {
+               # Help link
+               push(@right, &hlink($text{'header_help'},
+                                   $_[2]->[0], $_[2]->[1]));
+               }
+       elsif (defined($_[2]) && !$ENV{'ANONYMOUS_USER'}) {
+               # Help link
+               push(@right, &hlink($text{'header_help'}, $_[2]));
+               }
+       if ($_[3]) {
+               local %access = &get_module_acl();
+               if (!$access{'noconfig'} && !$config{'noprefs'}) {
+                       local $cprog = $user_module_config_directory ?
+                                       "uconfig.cgi" : "config.cgi";
+                       push(@right, "<a href=\"$gconfig{'webprefix'}/$cprog?$module_name\">$text{'header_config'}</a>");
+                       }
+               }
+       push(@right, split(/<br>/, $_[6]));
+       &start_osx_table($_[0], join("&nbsp;|&nbsp;", @right));
+       if ($_[9]) {
+               print "<table width=100%><tr><td align=center>",
+                     "$_[9]</td></tr></table>\n";
+               }
+       $started_osx_table++;
+       }
+}
+
+sub theme_footer
+{
+if ($started_osx_table) {
+       # Close table for main page
+       &end_osx_table();
+       }
+
+# Show footer links
+
+print "</body>\n";
+print "</html>\n";
+}
+
+# start_osx_table(title, rightstuff, width)
+sub start_osx_table
+{
+local ($title, $right, $width) = @_;
+$width ||= 100;
+print <<EOF;
+<table align="center" width="$width%" cellspacing="0" cellpadding="0" class="maintablea">
+ <tr>
+  <td>
+   <table width="100%" cellspacing="0" cellpadding="0" class="tableh1a">
+    <tr>
+     <td class="tableh1a"><img src="/unauthenticated/left.gif"></td>
+     <td class="tableh1a" background="/unauthenticated/middle.gif" width="100%"><font class="optionx" color="#ffffff">&#160;&#160;$title</font></td>
+     <td class="tableh1a" background="/unauthenticated/middle.gif" align=right nowrap><font class="optionx" color="#ffffff">$right</font></td>
+     <td class="tableh1a"><img src="/unauthenticated/right.gif"></td>
+    </tr>
+   </table>
+  </td>
+ </tr>
+</table>
+
+<table align="center" width="$width%" cellspacing="0" cellpadding="0">
+ <tr>
+  <td background="/unauthenticated/c1b.gif" valign="top"><img name="main_table_r1_c1" src="/unauthenticated/c1.gif" border="0" id="main_table_r1_c1" alt="" /></td>
+   <td width="100%"><table width="100%" cellspacing="0" cellpadding="5" class="maintableb" border="1" bordercolor="7F7F7F">
+    <tr valign="top">
+     <td>
+EOF
+}
+
+sub end_osx_table
+{
+print <<EOF;
+     </td>
+    </tr>
+   </table>
+  </td>
+  <td background="/unauthenticated/c3b.gif" valign="top"><img name="main_table_r1_c3" src="/unauthenticated/c3.gif" border="0" id="main_table_r1_c3" alt="" /></td>
+ </tr>
+ <tr>
+  <td><img name="main_table_r2_c1" src="/unauthenticated/2c1.gif" width="10" height="4" border="0" id="main_table_r2_c1" alt="" /></td>
+  <td background="/unauthenticated/c2b.gif"><img name="main_table_r2_c2" src="/unauthenticated/c2.gif" border="0" id="main_table_r2_c2" alt="" /></td>
+  <td><img name="main_table_r2_c3" src="/unauthenticated/c3.gif" width="10" height="4" border="0" id="main_table_r2_c3" alt="" /></td>
+ </tr>
+</table>
+EOF
+}
+
+sub theme_ui_post_header
+{
+local ($text) = @_;
+local $rv;
+if (defined($text)) {
+        $rv .= "<center><font size=+1>$text</font></center><br>\n";
+        }
+return $rv;
+}
+
+sub theme_ui_pre_footer
+{
+return "";
+}
+
+# Hack to prevent the display of <hr> lines
+#package miniserv;
+#sub PRINT
+#{
+#if ($_[1] !~ /^<hr>(<p>|<br>)?\s*$/) {
+#      $r = shift;
+#      $$r++;
+#      &write_to_sock(@_);
+#      }
+#}
+
+
+
index 04c3d1d..5a71471 100644 (file)
@@ -255,7 +255,7 @@ return defined(&software::update_system_updates);
 sub updates_available
 {
 my ($nocache) = @_;
-if (!defined(@updates_available_cache)) {
+if (!length(@updates_available_cache)) {
        if ($nocache || &cache_expired($updates_cache_file)) {
                # Get from original source
                @updates_available_cache = &software::update_system_updates();
index ca62ea5..e3263dc 100755 (executable)
@@ -1283,7 +1283,7 @@ else {
 #         2 and the maildir name for ~/Maildir style
 sub postfix_mail_system
 {
-if (!defined(@mail_system_cache)) {
+if (!length(@mail_system_cache)) {
        local $home_mailbox = &get_current_value("home_mailbox");
        if ($home_mailbox) {
                @mail_system_cache = $home_mailbox =~ /^(.*)\/$/ ?
@@ -1535,7 +1535,7 @@ return &parse_value_header_checks(@_);
 # Returns an array reference of entries from the Postfix master.cf file
 sub get_master_config
 {
-if (!defined(@master_config_cache)) {
+if (!length(@master_config_cache)) {
        @master_config_cache = ( );
        local $lnum = 0;
        local $prog;
@@ -2080,7 +2080,7 @@ sub supports_map_type
 {
 local ($type) = @_;
 return 1 if ($type eq 'hash'); # Assume always supported
-if (!defined(@supports_map_type_cache)) {
+if (!length(@supports_map_type_cache)) {
        @supports_map_type = ( );
        open(POSTCONF, "$config{'postfix_config_command'} -m |");
        while(<POSTCONF>) {
index 410b597..ffb9156 100755 (executable)
@@ -261,7 +261,7 @@ else {
 # Returns a list of all SMTP routes
 sub list_routes
 {
-if (!defined(@list_routes_cache)) {
+if (!length(@list_routes_cache)) {
        local $lnum = 0;
        local @rv;
        open(ROUTES, $qmail_routes_file);
@@ -387,7 +387,7 @@ print "</table></td></tr></table></form>\n";
 # Returns a list of all virtualdomains file entries
 sub list_virts
 {
-if (!defined(@list_virts_cache)) {
+if (!length(@list_virts_cache)) {
        local $lnum = 0;
        local @rv;
        open(VIRTS, $qmail_virts_file);
@@ -592,7 +592,7 @@ return $r;
 # Returns a list of qmail user assignments
 sub list_assigns
 {
-if (!defined(@list_assigns_cache)) {
+if (!length(@list_assigns_cache)) {
        local @rv;
        local $lnum = 0;
        open(ASSIGNS, $qmail_assigns_file);
index b23fa49..6f8bd44 100755 (executable)
@@ -23,13 +23,13 @@ elsif ($cgi eq 'edit_group_quota.cgi') {
                    '&group='.&urlize($group{0,'group'}) : 'none';
        }
 elsif ($cgi eq 'user_filesys.cgi' || $cgi eq 'copy_user_form.cgi') {
-       return defined(@uinfo) ?
+       return length(@uinfo) ?
                'user='.&urlize($remote_user) : 'user=root';
        }
 elsif ($cgi eq 'group_filesys.cgi' || $cgi eq 'copy_group_form.cgi') {
-       if (defined(@uinfo)) {
+       if (length(@uinfo)) {
                my @ginfo = getgrgid($uinfo[3]);
-               return 'group='.&urlize($ginfo[0]) if (defined(@ginfo));
+               return 'group='.&urlize($ginfo[0]) if (length(@ginfo));
                }
        return 'group=bin';
        }
index ae8df84..bb89d81 100755 (executable)
@@ -65,7 +65,7 @@ return %mdstat;
 sub get_raidtab
 {
 local ($raiddev, $device, %mdstat);
-return \@get_raidtab_cache if (defined(@get_raidtab_cache));
+return \@get_raidtab_cache if (length(@get_raidtab_cache));
 %mdstat = &get_mdstat();
 
 if ($raid_mode eq "raidtools") {
@@ -601,7 +601,7 @@ if ($mounted) { return ($mounted->[0], $mounted->[2], 1,
                        &indexof($mounted, @mounted)); }
 elsif ($mount) { return ($mount->[0], $mount->[2], 0,
                         &indexof($mount, @mounts)); }
-if (!defined(@physical_volumes)) {
+if (!length(@physical_volumes)) {
        @physical_volumes = ();
        foreach $vg (&lvm::list_volume_groups()) {
                push(@physical_volumes,
index b62f7bc..05f3f65 100755 (executable)
@@ -11,7 +11,7 @@ use WebminCore;
 # Returns a list of user attribute objects
 sub list_user_attrs
 {
-if (!defined(@list_user_attrs_cache)) {
+if (!length(@list_user_attrs_cache)) {
        @list_user_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'user_attr'});
@@ -142,7 +142,7 @@ return @rv;
 # Returns a list of all profiles
 sub list_prof_attrs
 {
-if (!defined(@list_prof_attrs_cache)) {
+if (!length(@list_prof_attrs_cache)) {
        @list_prof_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'prof_attr'});
@@ -285,7 +285,7 @@ return @rv;
 # Returns a user of all authorizations
 sub list_auth_attrs
 {
-if (!defined(@list_auth_attrs_cache)) {
+if (!length(@list_auth_attrs_cache)) {
        @list_auth_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'auth_attr'});
@@ -406,7 +406,7 @@ return join(",", @auths);
 # Returns a user of all execorizations
 sub list_exec_attrs
 {
-if (!defined(@list_exec_attrs_cache)) {
+if (!length(@list_exec_attrs_cache)) {
        @list_exec_attrs_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'exec_attr'});
@@ -496,7 +496,7 @@ return $rv;
 # Returns a list of policy config file directives
 sub get_policy_config
 {
-if (!defined(@policy_conf_cache)) {
+if (!length(@policy_conf_cache)) {
        @policy_conf_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'policy_conf'});
@@ -571,7 +571,7 @@ elsif ($old && $old->{'enabled'} && !$value) {
 # Returns a list of project objects
 sub list_projects
 {
-if (!defined(@list_projects_cache)) {
+if (!length(@list_projects_cache)) {
        @list_projects_cache = ( );
        local $lnum = 0;
        open(ATTR, $config{'project'});
@@ -808,7 +808,7 @@ foreach $c (&rbac_config_files()) {
 # Returns 1 list of all encryption algorithms, including the internal __unix__
 sub list_crypt_algorithms
 {
-if (!defined(@list_crypt_algorithms_cache)) {
+if (!length(@list_crypt_algorithms_cache)) {
        push(@list_crypt_algorithms_cache, { 'name' => '__unix__' } );
        local $lnum = 0;
        open(CRYPT, $config{'crypt_conf'});
index 3da6a80..a7e5073 100755 (executable)
@@ -13,7 +13,7 @@ $cron_cmd = "$module_config_directory/generate.pl";
 # Parses the sarg config file into directives
 sub get_config
 {
-if (!defined(@get_config_cache)) {
+if (!length(@get_config_cache)) {
        local $lnum = 0;
        open(CONF, $config{'sarg_conf'});
        while(<CONF>) {
index b8b860f..bb7409e 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'access_file'}, &access_dbm($_[0]));
 # list_access(textfile)
 sub list_access
 {
-if (!defined(@list_access_cache)) {
+if (!length(@list_access_cache)) {
        @list_access_cache = ( );
        local $lnum = 0;
        open(ACC, $_[0]);
index 71e4905..8139a82 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'domains_file'}, &domains_dbm($_[0]));
 # list_domains(textfile)
 sub list_domains
 {
-if (!defined(@list_domains_cache)) {
+if (!length(@list_domains_cache)) {
        @list_domains_cache = ( );
        local $lnum = 0;
        local $cmt;
index dd91df1..1bc0336 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'generics_file'}, &generics_dbm($_[0]));
 # list_generics(textfile)
 sub list_generics
 {
-if (!defined(@list_generics_cache)) {
+if (!length(@list_generics_cache)) {
        @list_generics_cache = ( );
        local $lnum = 0;
        local $cmt;
index 245ec68..731edd8 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'mailers_file'}, &mailers_dbm($_[0]));
 # list_mailers(textfile)
 sub list_mailers
 {
-if (!defined(@list_mailers_cache)) {
+if (!length(@list_mailers_cache)) {
        local $lnum = 0;
        @list_mailers_cache = ( );
        local $cmt;
index 7ba3d39..8157bd9 100755 (executable)
@@ -23,7 +23,7 @@ return &find_textfile($config{'virtusers_file'}, &virtusers_dbm($_[0]));
 # list_virtusers(textfile)
 sub list_virtusers
 {
-if (!defined(@list_virtusers_cache)) {
+if (!length(@list_virtusers_cache)) {
        @list_virtusers_cache = ( );
        local $lnum = 0;
        local $cmt;
index 4c3f3e9..1a50884 100755 (executable)
@@ -1044,9 +1044,9 @@ elsif ($access{'awl_groups'}) {
        # Check if the user is a member of any of the allowed groups
        local %ugroups;
        local @uinfo = getpwnam($user);
-       return 0 if (!defined(@uinfo));
+       return 0 if (!length(@uinfo));
        local @ginfo = getgrgid($uinfo[3]);
-       $ugroups{$ginfo[0]}++ if (defined(@ginfo));
+       $ugroups{$ginfo[0]}++ if (length(@ginfo));
        foreach my $o (&other_groups($user)) {
                $ugroups{$o}++;
                }
index b2f2f36..2f8bbca 100755 (executable)
@@ -72,7 +72,7 @@ elsif ($in{'mode'} == 2) {
 # Returns a list of NUT attribute names and values for some UPS
 sub get_ups_values
 {
-if (!defined(@get_ups_cache)) {
+if (!length(@get_ups_cache)) {
        local @rv;
        open(SENS, "upsc ".quotemeta($_[0])." |");
        while(<SENS>) {
index ffa18fc..43a5fef 100755 (executable)
@@ -63,7 +63,7 @@ elsif ($in{'mode'} == 2) {
 # Returns a list of lm_sensors names, values and maxes
 sub get_sensors_values
 {
-if (!defined(@get_sensors_cache)) {
+if (!length(@get_sensors_cache)) {
        local @rv;
        open(SENS, "sensors 2>/dev/null |");
        while(<SENS>) {
index 5022f5e..c6ee836 100755 (executable)
@@ -23,7 +23,7 @@ return $gconfig{'os_type'} eq 'solaris';
 # Parses the syslog-ng config file into an array ref of objects
 sub get_config
 {
-if (!defined(@get_config_cache)) {
+if (!length(@get_config_cache)) {
        # First read file into tokens
        @get_config_cache = &read_config_file($config{'syslogng_conf'});
        }
index 554b779..2ad24ed 100755 (executable)
@@ -97,7 +97,7 @@ Or if it supports FreeBSD master.passwd info, it will also have keys :
 =cut
 sub list_users
 {
-return @list_users_cache if (defined(@list_users_cache));
+return @list_users_cache if (length(@list_users_cache));
 
 # read the password file
 local (@rv, $_, %idx, $lnum, @pw, $p, $i, $j);
@@ -306,7 +306,7 @@ if ($pft == 1) {
               "$_[0]->{'gid'}:$_[0]->{'class'}:$_[0]->{'change'}:".
               "$_[0]->{'expire'}:$_[0]->{'real'}:$_[0]->{'home'}:".
               "$_[0]->{'shell'}");
-       if (defined(@list_users_cache)) {
+       if (length(@list_users_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_users_cache;
                }
@@ -337,7 +337,7 @@ else {
        # add to /etc/passwd
        $lref = &read_file_lines($config{'passwd_file'});
        $_[0]->{'line'} = &nis_index($lref);
-       if (defined(@list_users_cache)) {
+       if (length(@list_users_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_users_cache;
                }
@@ -351,7 +351,7 @@ else {
                # Find correct place to insert in shadow file
                $lref = &read_file_lines($config{'shadow_file'});
                $_[0]->{'sline'} = &nis_index($lref);
-               if (defined(@list_users_cache)) {
+               if (length(@list_users_cache)) {
                        map { $_->{'sline'}++
                              if ($_->{'sline'} >= $_[0]->{'sline'}) }
                            @list_users_cache;
@@ -400,7 +400,7 @@ else {
                }
        }
 &flush_file_lines() if (!$batch_mode);
-push(@list_users_cache, $_[0]) if (defined(@list_users_cache));
+push(@list_users_cache, $_[0]) if (length(@list_users_cache));
 &refresh_nscd() if (!$batch_mode);
 }
 
@@ -568,7 +568,7 @@ else {
                }
        }
 @list_users_cache = grep { $_->{'user'} ne $_[0]->{'user'} } @list_users_cache
-       if (defined(@list_users_cache));
+       if (length(@list_users_cache));
 if (!$batch_mode) {
        &flush_file_lines();
        &refresh_nscd();
@@ -591,7 +591,7 @@ contain the keys :
 =cut
 sub list_groups
 {
-return @list_groups_cache if (defined(@list_groups_cache));
+return @list_groups_cache if (length(@list_groups_cache));
 
 local(@rv, $lnum, $_, %idx, $g, $i, $j, @gr);
 $lnum = 0;
@@ -740,7 +740,7 @@ else {
        local $lref;
        $lref = &read_file_lines($config{'group_file'});
        $_[0]->{'line'} = &nis_index($lref);
-       if (defined(@list_groups_cache)) {
+       if (length(@list_groups_cache)) {
                map { $_->{'line'}++ if ($_->{'line'} >= $_[0]->{'line'}) }
                    @list_groups_cache;
                }
@@ -751,7 +751,7 @@ else {
        if ($gft == 2) {
                $lref = &read_file_lines($config{'gshadow_file'});
                $_[0]->{'sline'} = &nis_index($lref);
-               if (defined(@list_groups_cache)) {
+               if (length(@list_groups_cache)) {
                        map { $_->{'sline'}++
                              if ($_->{'sline'} >= $_[0]->{'sline'}) }
                            @list_groups_cache;
@@ -767,7 +767,7 @@ else {
        &flush_file_lines();
        }
 &refresh_nscd();
-push(@list_groups_cache, $_[0]) if (defined(@list_groups_cache));
+push(@list_groups_cache, $_[0]) if (length(@list_groups_cache));
 }
 
 =head2 modify_group(&old, &details)
@@ -860,7 +860,7 @@ else {
                }
        }
 @list_groups_cache = grep { $_ ne $_[0] } @list_groups_cache
-       if (defined(@list_groups_cache));
+       if (length(@list_groups_cache));
 &refresh_nscd();
 }
 
index f6847cf..f0fecdf 100755 (executable)
@@ -289,7 +289,7 @@ return &ui_opt_textbox($name, $value, 10, $text{'pool_none'});
 sub get_active_interface
 {
 local ($zinfo, $net) = @_;
-if (!defined(@active_interfaces_cache)) {
+if (!length(@active_interfaces_cache)) {
        @active_interfaces_cache = &net::active_interfaces();
        }
 local $address = $net->{'address'};
@@ -307,7 +307,7 @@ sub get_active_mount
 {
 local ($zinfo, $fs) = @_;
 local $dir = &get_zone_root($zinfo).$fs->{'dir'};
-if (!defined(@active_mounts_cache)) {
+if (!length(@active_mounts_cache)) {
        @active_mounts_cache = &mount::list_mounted();
        }
 local ($mount) = grep { $_->[0] eq $dir } @active_mounts_cache;