Skip to content

Commit

Permalink
Fix how theme link is displayed in Usermin
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Aug 26, 2024
1 parent 12aec50 commit fd4e061
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
9 changes: 1 addition & 8 deletions authentic-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -510,22 +510,15 @@ 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})))
{
print '<table class="table table-hover">' . "\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})) {
Expand Down
19 changes: 16 additions & 3 deletions sysinfo.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd4e061

Please sign in to comment.