- /g;
+ } else {
+ $changelog_data =
+ (read_file_contents($root_directory . '/' . $current_theme . "/CHANGELOG.md") =~
+ /### Version(.*?)/s)[0];
+ }
+ my @changelog_version = split /\n/, $changelog_data;
+
+ $changelog_data =~ s/^[^\n]*\n/\n/s;
+ $changelog_data =~ s/`(.*?)`/
- $1<\/li>/g;
+
+ my $changelog_content = '
+
+# Licensed under MIT (https://github.com/qooob/authentic-theme/blob/master/LICENSE) +# + +do "$current_theme/authentic-init.pm"; + +sub theme_header +{ + + (get_raw() && return); + embed_header(($_[0], $_[7], theme_mode(), (@_ > 1 ? '1' : '0'))); + + print '' . "\n"; + if (@_ > 1 && $_[1] ne 'stripped') { + print ' ' . "\n"; + my %this_module_info = &get_module_info(&get_module_name()); + print '' . "\n"; + print '' . "\n"; + print "' . "\n"; + print '
\n"; + print $tconfig{'postheader'}; + print '\n"; + + print ' '; + if (get_env('http_webmin_servers') && !$tconfig{'framed'}) { + print "", "$text{'header_servers'} \n"; + if ($_[1]) { + print "
\n"; + } + if (!$_[5] && !$tconfig{'noindex'}) { + my @avail = &get_available_module_infos(1); + my $nolo = get_env('anonymous_user') || + get_env('ssl_user') || + get_env('local_user') || + get_env('http_user_agent') =~ /webmin/i; + if ($gconfig{'gotoone'} && + $main::session_id && + @avail == 1 && + !$nolo) + { + print + "", + "$text{'main_logout'}
"; + } elsif ($gconfig{'gotoone'} && @avail == 1 && !$nolo) { + print "", "$text{'main_switch'}
"; + } + + } + if (!$_[4] && !$tconfig{'nomoduleindex'}) { + my $idx = $this_module_info{'index_link'}; + my $mi = $module_index_link || "/" . &get_module_name() . "/$idx"; + my $mt = $module_index_name || $text{'header_module'}; + print "$mt
\n"; + } + if (ref($_[2]) eq "ARRAY" && + !get_env('anonymous_user') && + !$tconfig{'nohelp'}) + { + print &hlink($text{'header_help'}, $_[2]->[0], $_[2]->[1]), "
\n"; + } elsif (defined($_[2]) && + !get_env('anonymous_user') && + !$tconfig{'nohelp'}) + { + print &hlink($text{'header_help'}, $_[2]), "
\n"; + } + if ($_[3]) { + my %access = &get_module_acl(); + if (!$access{'noconfig'} && !$config{'noprefs'}) { + my $cprog = + $user_module_config_directory ? "uconfig.cgi" : + "config.cgi"; + print "", $text{'header_config'}, + "
\n"; + } + } + print "", " \n"; + } else { + my $ts = + defined($tconfig{'titlesize'}) ? $tconfig{'titlesize'} : + "+2"; + print "", ($ts ? "" : ""), $_[0], ($ts ? "" : ""); + print " \n"; + } + print "
$_[9]\n" if ($_[9]); + print ""; + print $_[6]; + print " ' . "\n"; + } + $miniserv::page_capture = 1; +} + +sub theme_footer +{ + (get_raw() && return); + for (my $i = 0; $i + 1 < @_; $i += 2) { + my $url = $_[$i]; + if ($url ne '/' || !$tconfig{'noindex'}) { + if ($url eq '/') { + $url = "/?cat=$this_module_info{'category'}"; + } elsif ($url eq '' && &get_module_name()) { + $url = "/" . &get_module_name() . "/" . $this_module_info{'index_link'}; + } elsif ($url =~ /^\?/ && &get_module_name()) { + $url = "/" . &get_module_name() . "/$url"; + } + $url = "$gconfig{'webprefix'}$url" if ($url =~ /^\//); + $url = $url . "/" if ($url =~ /[^\/]$/ && $url !~ /.cgi/ && $url !~ /javascript:history/); + print +" ", + &text('main_return', $_[$i + 1]), "\n"; + } + } + + print "\n"; + if (!@_ && get_env('script_name') ne '/session_login.cgi' && get_env('script_name') ne '/pam_login.cgi') { + my $prefix; + my $hostname = ($prefix) = split(/\./, get_display_hostname()); + print '+', "\n"; + } + embed_footer((theme_mode()), + ( + (get_module_name() || + get_env('request_uri') =~ /\/config.cgi\?/ || + get_env('request_uri') =~ /\/uconfig.cgi\?/ || + get_env('request_uri') =~ /\/webmin_search.cgi\?/ || + get_env('request_uri') =~ /\/settings-user.cgi/ || + get_env('request_uri') =~ /\/settings-editor_read.cgi/ || + get_env('request_uri') =~ /\/settings-upload.cgi/ + ) ? '1' : '0' + ), + $_[0]); + embed_pm_scripts(); + + if (get_env('script_name') eq '/session_login.cgi' || + get_env('script_name') eq '/pam_login.cgi') + { + embed_js_scripts(); + } + print '', "\n"; + print '++++ [' + . $remote_user . + '@' . ($prefix ? $prefix : get_display_hostname()) . ' ~]' . ($get_user_level eq '0' ? '#' : '$') . +' ++ ';
+ return $changelog_content;
+}
+
+sub get_json
+{
+ if (@_) {
+ return JSON->new->latin1->encode(@_);
+ } else {
+ return JSON->new->latin1->encode({});
+ }
+}
+
+sub get_json_empty
+{
+ return JSON->new->latin1->encode({});
+}
+
+sub get_cookies
+{
+
+ my @r = split /; /, get_env('http_cookie');
+ my %c;
+
+ foreach (@r) {
+ my ($k, $v) = split /=/, $_;
+ $c{$k} = $v;
+ }
+
+ return %c;
+}
+
+sub get_access_data
+{
+ my ($key) = @_;
+ if ($key) {
+ if ($key eq 'root' && $gaccess{'root'} eq '/') {
+ return undef;
+ } else {
+ return $gaccess{$key};
+ }
+ } else {
+ return %gaccess;
+ }
+}
+
+sub get_available_modules
+{
+ my ($json) = @_;
+ my @mods;
+
+ foreach my $x (get_all_module_infos()) {
+ if ($x->{'dir'} ne undef && &foreign_available($x->{'dir'})) {
+ push @mods, $x->{'dir'};
+ }
+ }
+ if ($json eq 'json') {
+ get_json(\@mods);
+ } else {
+ return @mods;
+ }
+
+}
+
+sub manage_theme_config
+{
+ my ($action) = @_;
+ my %tuconfig;
+
+ if ($action eq 'save') {
+ my %i = settings_filter(%in);
+ write_file(get_tuconfig_file(), \%i);
+ } elsif ($action eq 'load') {
+ my $tuconfig_file = (get_tuconfig_file());
+ if (-f $tuconfig_file) {
+ my %tuconfig = (settings($tuconfig_file, 'config_portable_'));
+ get_json(\%tuconfig);
+ } else {
+ get_json_empty();
+ }
+ }
+}
+
+sub get_button_tooltip
+{
+ my ($label, $key, $placement) = @_;
+
+ my $mod_key = $__settings{'settings_hotkey_toggle_modifier'};
+ my $the_key = ucfirst($__settings{$key});
+
+ return ($__settings{'settings_button_tooltip'} ne 'false' ?
+ (' data-placement="' . $placement . '" data-toggle="tooltip" data-title="'
+ .
+ ($Atext{$label}
+ .
+ (length $__settings{'settings_hotkeys_active'} &&
+ $__settings{'settings_hotkeys_active'} ne 'false' &&
+ $the_key ?
+ " (" .
+ ($mod_key eq "altKey" ? "Alt" : $mod_key eq "ctrlKey" ? "Ctrl" : "Meta") . '+' . $the_key . ")" :
+ ''
+ )
+ ) .
+ '"'
+ ) :
+ ' ');
+}
+
+sub get_theme_language
+{
+
+ my %text = &load_language($current_theme);
+
+ my %s;
+ foreach my $key (keys %text) {
+ if ($key !~ /_xhred_/ &&
+ $key !~ /body_/ &&
+ $key !~ /right_/)
+ {
+ next;
+ }
+ $s{$key} .= $Atext{$key};
+ }
+
+ get_json(\%s);
+
+}
+
+sub get_module_config_data
+{
+ my ($module, $key) = @_;
+
+ if (-r $config_directory . '/' . $module . '/config') {
+
+ my $config = &read_file_contents($config_directory . '/' . $module . '/config');
+ my %config = $config =~ /(.*?)=(.*)/g;
+
+ if ($key) {
+ return $config{$key};
+ } else {
+ return %config;
+ }
+ } else {
+ return undef;
+ }
+
+}
+
+sub get_autocomplete_shell
+{
+ my ($type, $string) = @_;
+ my ($cd, $cmd, $cd_cmd, $command, @rs);
+
+ if ($type eq 'commands') {
+ $command = '-c';
+ } elsif ($type eq 'groups') {
+ $command = '-g';
+ } elsif ($type eq 'service') {
+ (!string_starts_with($string, '::::') && ($command = '-s'));
+ } elsif ($type eq 'systemctl') {
+ $command = undef;
+ } elsif ($type eq 'users') {
+ $command = '-u';
+ } else {
+ my @strings =
+ split /::::/, $string;
+ ($cd, $string, $cmd, $cmd2) = @strings[0, 1, 2, 3];
+ $cd_cmd = "cd $cd; ";
+ $command = '-o default';
+ }
+
+ if ($command) {
+ @rs =
+ array_unique(
+ backquote_command($cd_cmd . "bash -c 'compgen " . $command . " '" . quotemeta($cmd2 ? $cmd2 : $string) . ""));
+
+ } else {
+ if ($type eq 'service' && has_command('service')) {
+ my @cmd = split /::::/, $string;
+ my $units_tmp =
+ backquote_command("service " . quotemeta($cmd[1]));
+ my ($unit_tmp) = $units_tmp =~ / \( ( [^\)]+ ) \) /x;
+ if (!$unit_tmp) {
+ ($unit_tmp) = $units_tmp =~ / { ( [^}]+ ) } /x;
+ }
+ if (!$unit_tmp) {
+ ($unit_tmp) = $units_tmp =~ / \[ ( [^]]+ ) \] /x;
+ }
+
+ $unit_tmp =~ s/\s+//g;
+ $unit_tmp =~ s/\|/,/g;
+ $unit_tmp =~ s/;/,/g;
+
+ my @units_tmp = split /,/, $unit_tmp;
+ my @units_possible_tmp = ('start', 'stop', 'restart', 'try-restart', 'reload', 'force-reload', 'status');
+ @rs_tmp = (@units_tmp ? @units_tmp : @units_possible_tmp);
+ my @rs_cmd;
+
+ if ($cmd[2]) {
+ foreach my $cmd (@rs_tmp) {
+ if (string_starts_with($cmd, $cmd[2])) {
+ push @rs_cmd, $cmd;
+ }
+ }
+ @rs = @rs_cmd;
+ } else {
+ @rs = @rs_tmp;
+ }
+ }
+ if ($type eq 'systemctl' && has_command('systemctl')) {
+ my (@units, @units_tmp);
+
+ @units_tmp = array_unique(backquote_command("systemctl list-unit-files"));
+ my $i = 0;
+ my $n = $#units_tmp;
+ foreach my $unit (@units_tmp) {
+ my @tmp = split / {1,}/, $unit;
+ my ($unit_tmp, $status_tmp) = @tmp[0, 1];
+
+ if ($i &&
+ --$n &&
+ $unit_tmp &&
+ (!$string ||
+ string_starts_with($unit_tmp, $string)))
+ {
+ push @units, $unit_tmp;
+ }
+
+ $i++;
+ }
+ @rs = @units;
+ }
+ }
+ if ($cd || $cmd2) {
+ my @rs_tmp;
+ foreach my $file (@rs) {
+ if (-d $file || -d ($cd . $file)) {
+ push @rs_tmp, ($file . '/');
+ } else {
+ if ($cmd ne 'cd') {
+ push @rs_tmp, $file;
+ }
+ }
+ }
+ @rs = @rs_tmp;
+ }
+ return @rs;
+}
+
+sub string_starts_with
+{
+ my ($string, $search) = @_;
+ if ($string =~ m/^\Q$search/) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub array_unique
+{
+ my @unique;
+ my %seen;
+
+ foreach my $value (@_) {
+ if (!$seen{$value}++) {
+ $value =~ tr/\r\n//d;
+ push @unique, $value;
+ }
+ }
+ return @unique;
+}
+
+1;
diff --git a/authentic.pm b/authentic.pm
new file mode 100644
index 000000000..23d167963
--- /dev/null
+++ b/authentic.pm
@@ -0,0 +1,1066 @@
+#
+# Authentic Theme (https://github.com/qooob/authentic-theme)
+# Copyright Ilia Rostovtsev
$1<\/code>/g;
+ $changelog_data =~ s/__(.*?)__/$1<\/strong>/g;
+ $changelog_data =~ s/_(.*?)_/$1<\/em>/g;
+ $changelog_data =~ s/(Fixed bugs)/$1<\/span>/g;
+ $changelog_data =~ s/\[([^\[]+)\]\(([^\)]+)\)/$1<\/a>/g;
+ $changelog_data =~ s/\n\*(.*)/\n