/usr/share/usermin/authentic-theme
Edit: /usr/share/usermin/authentic-theme/authentic-lib.pl (90283B)
#
# Authentic Theme (https://github.com/authentic-theme/authentic-theme)
# Copyright Ilia Rostovtsev
# Licensed under MIT (https://github.com/authentic-theme/authentic-theme/blob/master/LICENSE)
#
use strict;
use lib ($ENV{'LIBROOT'} . "/vendor_perl");
use File::Grep qw( fgrep fmap fdo );
use Encode qw( encode decode );
use Time::Local;
use File::Find;
BEGIN {push(@INC, "..");}
use WebminCore;
our (
%in, %text, %config, %gconfig, %tconfig, %gaccess, $current_lang, $title, $base_remote_user, $remote_user,
$theme_root_directory,
$current_theme, $root_directory, $config_directory, $var_directory,
%theme_text, %module_text_full, %theme_config, $theme_info, $get_user_level, $theme_webprefix, $http_x_url,
$has_virtualmin, $has_cloudmin, $theme_server_webprefix,
$has_usermin, $has_usermin_version, $has_usermin_root_dir, $has_usermin_conf_dir, $has_usermin_var_dir);
init_type();
init_config();
do($ENV{'THEME_ROOT'} . "/authentic-init.pl");
sub authentic
{
init();
header([$title]);
content();
footer();
}
sub get_sysinfo_warning
{
my ($info_ref) = @_;
my $returned_data = '';
# Show notifications first
if (ref($info_ref)) {
@{$info_ref} =
sort {($b->{'type'} eq 'warning') <=> ($a->{'type'} eq 'warning')} @{$info_ref};
$returned_data .= '
';
foreach my $info (@{$info_ref}) {
if ($info->{'type'} eq 'warning') {
my $def_level = $info->{'level'} || 'warn';
my $info_data = $info->{'warning'};
# Customize hardcode types
if ($info_data &&
$info_data =~ /\/fix_os\.cgi/m)
{
$def_level = 'info';
}
if (ref($info_data) eq 'HASH') {
$returned_data .= $info_data->{'alert'};
} else {
$returned_data .=
replace("ui_submit ui_form_end_submit",
"btn-tiny ui_submit ui_form_end_submit",
&ui_alert_box($info_data, $def_level, undef, 1, $info->{'desc'}));
}
}
}
}
return $returned_data;
}
sub get_extended_sysinfo
{
my ($info_ref, $x) = @_;
my $returned_sysinfo = '';
if ($info_ref) {
$returned_sysinfo .=
'';
foreach my $info (@{$info_ref}) {
if ($info->{'id'} ne 'notifications' &&
$info->{'type'} ne 'link' &&
$info->{'module'} ne 'mailbox' &&
$info->{'module'} ne 'system-status' &&
$info->{'type'} ne 'warning')
{
our $charts_not_supported = 'no';
if ($info->{'type'} eq 'chart') {
foreach my $t (@{ $info->{'chart'} }) {
if ($t->{'chart'}[0] < 0 || $t->{'chart'}[1] < 0) {
$charts_not_supported = 'yes';
}
}
}
if ($theme_config{'settings_sysinfo_hidden_panels_user'} =~ /\'$info->{'id'}\'/) {
next;
}
if ($info->{'id'} && $charts_not_supported eq 'no') {
my $open =
($info->{'open'} || $info->{'id'} eq 'domain') ? ' in' :
($theme_config{'settings_sysinfo_expand_all_accordions'} eq 'true' ? ' in' : '');
my $formatted_title = (
$info->{'id'} . '-' .
$info->{'module'} eq 'status_services-status' ?
$theme_text{'theme_xhred_sysinfo_system_monitors'} :
($info->{'id'} . '-' .
$info->{'module'} eq 'sysinfo-virtual-server' ?
$theme_text{'theme_xhred_sysinfo_software_versions'} :
($info->{'id'} . '-' .
$info->{'module'} eq 'status-virtual-server' ?
$theme_text{'theme_xhred_sysinfo_server_status'} :
($info->{'id'} . '-' .
$info->{'module'} eq 'quota-virtual-server' ?
$theme_text{'theme_xhred_sysinfo_disk_quotas'} :
($info->{'id'} . '-' .
$info->{'module'} eq 'bw-virtual-server' ?
$theme_text{'theme_xhred_sysinfo_bandwidth_quotas'} :
($info->{'id'} . '-' .
$info->{'module'} eq 'updates-virtual-server' ?
$theme_text{'theme_xhred_sysinfo_vm_package_updates'} :
($info->{'id'} . '-' . $info->{'module'} eq 'acl_logins-acl' ?
$theme_text{'theme_xhred_sysinfo_recent_logins'} :
($info->{'desc'}))))))));
$returned_sysinfo .= '
';
if ($info->{'id'} ne 'plugin_virtualmin-notes' && $info->{'id'} ne 'acl_logins') {
$returned_sysinfo .= '
';
}
if ($info->{'type'} ne 'html') {
$returned_sysinfo .= '
';
}
my $status_icons_tpl = {
_fa => 'fa fa-fw fa',
_fa2 => 'fa2 fa-fw fa2',
_fa115x => 'fa-1_15x',
_falg => 'fa-lg',
_text_succ => 'text-success',
_text_warn => 'text-warning text-warning-brighter',
_text_dang => 'text-danger',
_vert_algn_md => 'vertical-align-middle',
};
my $status_icons = {
up => "{'_fa'}-check $status_icons_tpl->{'_falg'} $status_icons_tpl->{'_text_succ'}\">",
stop => "{'_fa'}-times-circle $status_icons_tpl->{'_falg'} $status_icons_tpl->{'_text_warn'}\">",
down => "{'_fa'}-minus-circle $status_icons_tpl->{'_falg'} $status_icons_tpl->{'_text_dang'}\">",
start => "{'_fa'}-play text-success $status_icons_tpl->{'_falg'}\">",
reload => "{'_fa'}-refresh text-info $status_icons_tpl->{'_falg'}\">",
quest => "{'_fa'}-question-circle $status_icons_tpl->{'_fa115x'}\">",
not => "{'_fa2'}-not-interested $status_icons_tpl->{'_fa115x'}\">",
skip => "{'_fa2'}-minus $status_icons_tpl->{'_fa115x'} $status_icons_tpl->{'_vert_algn_md'}\">",
timed => "{'_fa'}-clock $status_icons_tpl->{'_fa115x'} $status_icons_tpl->{'_vert_algn_md'} $status_icons_tpl->{'_text_warn'}\">",
webmin => "{'_fa'}-webmin $status_icons_tpl->{'_fa115x'} $status_icons_tpl->{'_vert_algn_md'} $status_icons_tpl->{'_text_warn'}\">",
};
if ($info->{'id'} eq 'status_services') {
$info->{"html"} =~ s/
/$status_icons->{$1}/g;
}
if ($info->{'type'} eq 'table' &&
( $info->{'module'} ne 'system-status' &&
$info->{'type'} ne 'link'
))
{
foreach my $t (@{ $info->{'table'} }) {
$t->{"desc"} =~ s/^\ //g;
$t->{"desc"} =~ s/
/$status_icons->{$1}/g;
$t->{"value"} =~ s/
/$status_icons->{$1}/g;
$returned_sysinfo .= '
| ' . $t->{"desc"} . ' |
' . $t->{"value"} . ' |
';
}
} elsif ($info->{'type'} eq 'chart') {
$returned_sysinfo .= print_charts($info, $x);
} elsif ($info->{'type'} eq 'html') {
$info->{'html'} =~ s/