From fd4e0619d3e0b952b47a5f88a23624e9a91599fc Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 26 Aug 2024 15:32:04 +0300 Subject: [PATCH] Fix how theme link is displayed in Usermin --- authentic-lib.pl | 9 +-------- sysinfo.cgi | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/authentic-lib.pl b/authentic-lib.pl index 77380bd9d..202649114 100644 --- a/authentic-lib.pl +++ b/authentic-lib.pl @@ -510,7 +510,7 @@ sub print_sysstats_panel_start sub print_sysstats_table { - my ($data, $quota, $prod) = @_; + my ($data, $quota) = @_; if ((defined($data) && scalar(@{$data})) || (defined($quota) && scalar(@{$quota}))) @@ -518,14 +518,7 @@ sub print_sysstats_table print '' . "\n"; if (defined($data) && scalar(@{$data})) { foreach my $t (@{ @{$data}[0]->{'table'} }) { - my $insert = ($t->{"desc"} =~ /\Q$prod/i); - if ($insert && $get_user_level ne '3') { - print_table_row($theme_text{'body_webmin'}, get_webmin_version()); - } print_table_row($t->{"desc"}, $t->{"value"}); - if ($insert) { - print_table_row($theme_text{'theme_version'}, get_theme_user_link()); - } } } if (defined($quota) && scalar(@{$quota})) { diff --git a/sysinfo.cgi b/sysinfo.cgi index cd0ccd886..2cb2729ce 100755 --- a/sysinfo.cgi +++ b/sysinfo.cgi @@ -206,10 +206,23 @@ if ($get_user_level ne '3') { my @mailbox = grep {$_->{'module'} eq 'mailbox'} @info; my @quota = grep {$_->{'module'} eq 'quota'} @info; - my $prod = &get_product_name(); - + # Handle theme link if allowed + if (!defined($gconfig{'ui_show'}) || $gconfig{'ui_show'} =~ /\btver\b/) { + my $link = + { desc => $theme_text{theme_version}, value => get_theme_user_link() }; + foreach my $item (@mailbox) { + for (my $i = 0; $i < @{$item->{'table'}}; $i++) { + if ($item->{'table'}->[$i]->{'type'} =~ /^(version|time)$/) { + splice(@{$item->{'table'}}, $i + ($1 eq 'time' ? -1 : 1), 0, $link); + undef($link); + last; + } + } + } + push(@{$mailbox[0]->{'table'}}, $link) if ($link); + } print_sysstats_panel_start(); - print_sysstats_table(\@mailbox, \@quota, $prod); + print_sysstats_table(\@mailbox, \@quota); print_sysstats_panel_end(); # Common modules