diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Domains.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Domains.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Domains.pm 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Domains.pm 2020-02-12 10:19:08.000000000 +0400 @@ -0,0 +1,492 @@ +package SrvMngr::Controller::Domains; + +use strict; +use warnings; +use Mojo::Base 'Mojolicious::Controller'; + +use Locale::gettext; +use SrvMngr::I18N; + +use SrvMngr qw(theme_list init_session_cgi); + +#use Data::Dumper; + +#use esmith::FormMagick::Panel::domains; + +use esmith::DomainsDB; +use esmith::AccountsDB; +#use URI::Escape; + + +our $ddb = esmith::DomainsDB->open || die "Couldn't open domains db"; +our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db"; +our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db"; + +our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+); + + +sub main { + + my $c = shift; + $c->app->log->info($c->log_req); + + my %dom_datas = (); + my $title = $c->l('dom_FORM_TITLE'); + my $notif = ''; + + $dom_datas{trt} = 'LIST'; + + my @domains; + for ($ddb->domains()) + { + my $ns = $_->prop('Nameservers') || 'internet'; + + push @domains, + { Domain => $_->key, $_->props, + Nameservers => $ns, + } + } + $dom_datas{forwarder} = $cdb->get_prop('dnscache', 'Forwarder'); + $dom_datas{forwarder2} = $cdb->get_prop('dnscache', 'Forwarder2') || ''; + + $c->stash( title => $title, notif => $notif, dom_datas => \%dom_datas, domains => \@domains ); + $c->render(template => 'domains'); + +}; + + +sub do_display { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = $c->param('trt'); + my $domain = $c->param('Domain') || ''; + + $trt = 'DEL' if ( $rt eq 'domaindel1' ); + $trt = 'UPD' if ( $rt eq 'domainupd1' ); + $trt = 'UP2' if ( $rt eq 'domainup21' ); + $trt = 'ADD' if ( $rt eq 'domainadd1' ); + + my %dom_datas = (); + my $title = $c->l('dom_FORM_TITLE'); + my $notif = ''; + + $dom_datas{'trt'} = $trt; + + if ( $trt eq 'ADD' ) { + + } + + if ( $trt eq 'UPD' ) { + + my $rec = $ddb->get($domain); + if ( $rec ) { + $dom_datas{domain} = $domain; + $dom_datas{description} = $rec->prop('Description') || ''; + $dom_datas{content} = $rec->prop('Content') || ''; + $dom_datas{nameservers} = $rec->prop('Nameservers') || 'internet'; + } else { + $notif = "Domain $domain not found !" + } + } + + if ( $trt eq 'UP2' ) { + + $dom_datas{forwarder} = $cdb->get_prop('dnscache', 'Forwarder') || ''; + $dom_datas{forwarder2} = $cdb->get_prop('dnscache', 'Forwarder2') || ''; + + } + + if ( $trt eq 'DEL' ) { + + my $rec = $ddb->get($domain); + if ( $rec ) { + $dom_datas{domain} = $domain; + $dom_datas{description} = $rec->prop('Description') || ''; + } + } + + if ( $trt eq 'LIST' ) { + my @domains; + if ($adb) { + @domains = $ddb->domains(); + } + $c->stash( domains => \@domains ); + + } + + $c->stash( title => $title, notif => $notif, dom_datas => \%dom_datas ); + $c->render( template => 'domains' ); + +}; + + +sub do_update { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = ($c->param('trt') || 'LIST'); + + my %dom_datas = (); + my $result = ''; + + #my $domain = uri_unescape($c->param('domain')); + my $domain = $c->param('Domain'); + + if ( $trt eq 'ADD' ) { + + my $account = $c->param('Account'); + + # controls (validate ?????) + my $res = ''; + # validate_new_domain_name( $c, $domain, $account ); + $result .= $res unless $res eq 'OK'; + + #$result .= ' blocked'; + + if ( ! $result ) { + $res = create_modify_domain( $c, 'create', $domain ); + $result .= $res unless $res eq 'OK'; + } + + if ( ! $result ) { + $result = $c->l('dom_CREATE_SUCCEEDED') . ' ' . $domain; + $trt = 'SUC'; + } + } + + if ( $trt eq 'UPD' ) { + + my $description = $c->param('Description'); + my $content = $c->param('Content'); + my $nameservers = $c->param('Nameservers'); + + #my %props = ('Account' => $account); + + # controls + my $res = ''; + #$res = validate_description( $c, $account ); + $result .= $res unless $res eq 'OK'; + + #$result .= 'blocked'; + + if ( ! $result ) { + $res = create_modify_domain( $c, 'update', $domain ); + $result .= $res unless $res eq 'OK'; + } + + if ( ! $result ) { + $result = $c->l('dom_MODIFY_SUCCEEDED') . ' ' . $domain; + $trt = 'SUC'; + } + } + + + if ( $trt eq 'UP2' ) { + + my $forwarder = $c->param('Forwarder'); + my $forwarder2 = $c->param('Forwarder2'); + + # controls + my $res = ''; + + $res = ip_number_or_blank( $c, $forwarder); + $result .= $res unless $res eq 'OK'; + + $res = ip_number_or_blank( $c, $forwarder2); + $result .= $res unless $res eq 'OK'; + + #$result .= 'blocked'; + + if ( ! $result ) { + my $res = modify_dns( $c, $forwarder, $forwarder2 ); + $result .= $res unless $res eq 'OK'; + } + if ( ! $result ) { + $result = $c->l('SUCCESS') . ' ' . $domain; + $trt = 'SUC'; + } + } + + + if ( $trt eq 'DEL' ) { + + # controls + my $res = ''; + #$res = validate_is_domain($c, $domain); + $result .= $res unless $res eq 'OK'; + + #$result .= 'blocked'; + + if ( ! $result ) { + my $res = delete_domain( $c, $domain ); + $result .= $res unless $res eq 'OK'; + } + if ( ! $result ) { + $result = $c->l('dom_REMOVE_SUCCEEDED') . ' ' . $domain; + $trt = 'SUC'; + } + } + + my $title = $c->l('dom_FORM_TITLE'); + $dom_datas{'domain'} = $domain; + $dom_datas{'trt'} = $trt; + +# $c->stash( title => $title, notif => $result ); +# $c->render(template => 'module'); + $c->stash( title => $title, notif => $result, dom_datas => \%dom_datas ); + if ($dom_datas{trt} ne 'SUC') { + return $c->render(template => 'domains'); + } + $c->redirect_to('/domains'); + + +}; + + +sub create_modify_domain { + + my ($c, $action, $domain) = @_; + + $domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/); + unless ($domain) { + return $c->l($action eq 'create' ? 'dom_ERROR_CREATING_DOMAIN' + : 'dom_ERROR_MODIFYING_DOMAIN'); + } + + my $rec = $ddb->get($domain); + if ($rec and $action eq 'create') { + return $c->l('dom_DOMAIN_IN_USE_ERROR'); + } + if (not $rec and $action eq 'modify') { + return $c->l('dom_NONEXISTENT_DOMAIN_ERROR'); + } + + $rec ||= $ddb->new_record($domain, { type => 'domain' }); + my %props; + $props{$_} = $c->param($_) for ( qw(Content Description Nameservers) ); + $rec->merge_props(%props); + + my $status = system( "/sbin/e-smith/signal-event", + "domain-$action", "$domain" ); + + if ($status) { + return ($action eq 'create' ? 'dom_ERROR_CREATING_DOMAIN' + : 'dom_ERROR_MODIFYING_DOMAIN'); + } + + return 'OK'; +} + + +sub delete_domain { + + my ($c, $domain) = @_; + + $domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/); + return ($c->l('dom_ERROR_WHILE_REMOVING_DOMAIN')) unless ($domain); + + my $rec = $ddb->get($domain); + return ($c->l('dom_NONEXISTENT_DOMAIN_ERROR')) if (not $rec); + + $rec->set_prop('type', 'domain-deleted'); + + if (system("/sbin/e-smith/signal-event", "domain-delete", "$domain") == 0) { + $rec->delete; + return 'OK'; + } + return ($c->l('dom_ERROR_WHILE_REMOVING_DOMAIN')); +} + + +sub existing_accounts_list { + + my $c = shift; + + my @existingAccounts = ( ['Administrator' => 'admin']); + + foreach my $a ($adb->get_all) { + if ($a->prop('type') =~ /(user|group)/) { + push @existingAccounts, [ $a->key => $a->key ]; + } + if ($a->prop('type') eq "domain") { + my $target = $adb->get($a->prop('Account')); + + unless ($target) + { + warn "WARNING: domain (" . $a->key . ") => missing Account(" + . $a->prop('Account') . ")\n"; + next; + } + + push @existingAccounts, [ $a->key, $a->key ] + unless ($target->prop('type') eq "domain"); + } + } + + return(\@existingAccounts); +} + + +sub content_options_list { + + my $c = shift; + + my @options = ( [ $c->l('dom_PRIMARY_SITE') => 'Primary' ]); + + foreach ($adb->ibays) { + push @options, [ $_->prop('Name') => $_->key ] + if ($_->key ne 'Primary'); + } + + return \@options +} + + +sub get_content_value +{ + my $c = shift; + my $domain = shift; + + return $domain ? $ddb->get_prop($domain, 'Content') : 'Primary'; +} + + +sub get_description_value +{ + my $c = shift; + + my $domain = $c->param('Domain') || undef; + + return $ddb->get_prop($domain, 'Description'); +} + + +sub nameserver_options_list { + + my $c = shift; + my $domain = $c->param('Domain') || undef; + + my @opts = qw(localhost internet); + push @opts, 'corporate' if ($cdb->get_prop('dnscache', 'Forwarder')); + my $ns = ($ddb->get_prop($domain, 'Nameservers') || 'internet'); + push @opts, $ns unless scalar grep { /^$ns$/ } @opts; + + my @options; + foreach (@opts) { + push @options, [ $c->l( "dom_$_" ) => $_ ]; + } + + return \@options; +} + + +sub get_nameserver_value { + my $c = shift; + + my $domain = $c->param('Domain') || undef; + + return ($ddb->get_prop($domain, 'Nameservers') || 'internet'); +} + + +sub validate_Domain +{ + my $c = shift; + my $domain = lc shift; + + return ($domain =~ /^($REGEXP_DOMAIN)$/) ? 'OK' : + 'DOMAIN_NAME_VALIDATION_ERROR'; +} + + +sub validate_Description +{ + # XXX - FIXME - NOTREACHED + # We used to use the Description in the Appletalk volume name + # which meant it needed validation. I don't see any reason to + # do this any more + + my $c = shift; + my $description = shift; + + return ($description =~ /^([\-\'\w][\-\'\w\s\.]*)$/) ? 'OK' : + 'DOMAIN_DESCRIPTION_VALIDATION_ERROR'; +} + + +sub ip_number_or_blank { + + # XXX - FIXME - we should push this down into CGI::FormMagick + + my $c = shift; + my $ip = shift; + + if (!defined($ip) || $ip eq "") + { + return 'OK'; + } + + return ip_number( $c, $ip ); +} + + +sub ip_number { + +# from CGI::FormMagick::Validator qw( ip_number ); + + my ($c, $data) = @_; + + return undef unless defined $data; + + return $c->l('FM_IP_NUMBER1') unless $data =~ /^[\d.]+$/; + + my @octets = split /\./, $data; + my $dots = ($data =~ tr/.//); + + return $c->l('FM_IP_NUMBER2') unless (scalar @octets == 4 and $dots == 3); + + foreach my $octet (@octets) { + return $c->l("FM_IP_NUMBER3", $octet) if $octet > 255; + } + + return 'OK'; +} + + + +sub modify_dns { + + my ($c, $forwarder, $forwarder2) = @_; + + my $dnscache = $cdb->get('dnscache'); + + ($forwarder, $forwarder2) = ($forwarder2, '') + if ($forwarder2 and not $forwarder); + + if ($forwarder) { + $dnscache->set_prop('Forwarder', $forwarder); + } else { + $dnscache->delete_prop('Forwarder'); + } + + if ($forwarder2) { + $dnscache->set_prop('Forwarder2', $forwarder2); + } else { + $dnscache->delete_prop('Forwarder2'); + } + + unless ( system( "/sbin/e-smith/signal-event", "dns-update" ) == 0 ) + { + return $c->l('dom_ERROR_UPDATING'); + } + + return 'OK'; +} + + +1; diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Hostentries.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Hostentries.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Hostentries.pm 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Hostentries.pm 2020-02-11 22:37:33.000000000 +0400 @@ -0,0 +1,590 @@ +package SrvMngr::Controller::Hostentries; + +use strict; +use warnings; +use Mojo::Base 'Mojolicious::Controller'; + +use Locale::gettext; +use SrvMngr::I18N; + +use SrvMngr qw(theme_list init_session_cgi); + +#use Data::Dumper; + +#use esmith::FormMagick::Panel::hostentries; + +use esmith::DomainsDB; +use esmith::AccountsDB; +use esmith::HostsDB; +use esmith::NetworksDB; +use HTML::Entities; +use Net::IPv4Addr qw(ipv4_in_network); +#use URI::Escape; + + +our $ddb = esmith::DomainsDB->open || die "Couldn't open hostentries db"; +our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db"; +our $hdb = esmith::HostsDB->open || die "Couldn't open hosts db"; +our $ndb = esmith::NetworksDB->open || die "Couldn't open networks db"; + + +sub main { + + my $c = shift; + $c->app->log->info($c->log_req); + + my %hos_datas = (); + my $title = $c->l('hos_FORM_TITLE'); + my $notif = ''; + + $hos_datas{trt} = 'LIST'; + + my %dom_hosts = (); + + foreach my $d ( @{domains_list()} ) + { + $dom_hosts {$d} = { COUNT => 0, HOSTS => [] }; + + if (my @hosts = $hdb->get_hosts_by_domain($d)) + { + $dom_hosts {$d} {'COUNT'} = scalar( @hosts ); + # my @entries; + push @{ $dom_hosts {$d} {'HOSTS'} }, + host_data( $_ ) foreach (@hosts); + } + } + + $c->stash( title => $title, notif => $notif, hos_datas => \%hos_datas, dom_hosts => \%dom_hosts ); + $c->render(template => 'hostentries'); + +}; + + +sub do_display { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = $c->param('trt') || 'LST'; + my $hostname = $c->param('Hostname') || ''; + + $trt = 'ADD' if ( $rt eq 'hostentryadd' ); + $trt = 'LST' if ($trt ne 'DEL' && $trt ne 'UPD' && $trt ne 'ADD'); + + my %hos_datas = (); + my $title = $c->l('hos_FORM_TITLE'); + my $notif = ''; + + $hos_datas{'trt'} = $trt; + + if ( $trt eq 'ADD' ) { + + } + + if ( $trt eq 'UPD' or $trt eq 'DEL' ) { + + my $rec = $hdb->get($hostname); + if ( $rec ) { + $hos_datas{hostname} = $rec->key; + ( $hos_datas{name}, $hos_datas{domain} ) = split_hostname($hostname); + $hos_datas{internalip} = $rec->prop('InternalIP') || ''; + $hos_datas{externalip} = $rec->prop('ExternalIP') || ''; + $hos_datas{macaddress} = $rec->prop('MACAddress') || ''; + $hos_datas{hosttype} = $rec->prop('HostType'); + $hos_datas{comment} = HTML::Entities::encode($rec->prop('Comment')); + } else { + $notif = "Hostname $hostname not found !" + } + } + + #if ( $trt eq 'DEL' ) { + + # my $rec = $hdb->get($hostname); + # if ( $rec ) { + # get_hos_datas( $rec, %hos_datas ); + # } else { + # $notif = "Hostname $hostname not found !" + # } + #} + + if ( $trt eq 'LIST' ) { + + } + + $c->stash( title => $title, notif => $notif, hos_datas => \%hos_datas ); + $c->render( template => 'hostentries' ); + +}; + + +sub do_update { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = ($c->param('trt') || 'LIST'); + + my %hos_datas = (); + my $title = $c->l('hos_FORM_TITLE'); + my $notif = ''; + my $result = ''; + + $hos_datas{'name'} = lc $c->param('Name'); + $hos_datas{'domain'} = lc $c->param('Domain'); + $hos_datas{'hostname'} = $c->param('Hostname'); + $hos_datas{'comment'} = $c->param('Comment'); + $hos_datas{'hosttype'} = $c->param('Hosttype'); + $hos_datas{'internalip'} = $c->param('Internalip'); + $hos_datas{'macaddress'} = $c->param('Macaddress'); + $hos_datas{'externalip'} = $c->param('Externalip'); + my $hostname = "$hos_datas{'name'}.$hos_datas{'domain'}"; + + if ( $trt eq 'ADD' ) { + + # controls + my $res = ''; + unless ( $hos_datas{'name'} =~ /^[a-z0-9][a-z0-9-]*$/ ) { + $result .= $c->l('hos_HOSTNAME_VALIDATOR_ERROR') . '
'; + } + + unless ( $hos_datas{comment} =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/ || $hos_datas{comment} eq '' ) { + $result .= $c->l('hos_HOSTNAME_COMMENT_ERROR') . '
'; + } + + # Look for duplicate hosts. + my $hostrec = undef; + if ( $hostrec = $hdb->get($hostname) ) { + $result .= $c->l('hos_HOSTNAME_EXISTS_ERROR', + {fullHostName => $hostname, type => $hostrec->prop('HostType')}) . '
',; + } + + if ( ! $result and $hos_datas{hosttype} ne 'Self' ) { + if ( $hos_datas{hosttype} eq 'Local' ) { + $hos_datas{'trt'} = 'ALC'; # ADD/LOCAL + } else { + $hos_datas{'trt'} = 'ARM'; # ADD/REMOVE + } + + $c->stash( title => $title, notif => '', hos_datas => \%hos_datas ); + return $c->render( template => 'hostentries' ); + } + + #!#$result .= ' blocked'; + + if ( ! $result ) { + $res = create_modify_hostentry( $c, $trt, %hos_datas ); + $result .= $res unless $res eq 'OK'; + } + if ( ! $result ) { + $result = $c->l('hos_CREATE_OR_MODIFY_SUCCEEDED') . ' ' . $hostname; + $trt = 'SUC'; + } + } + + + if ( $trt eq 'UPD' ) { + + # controls + my $res = ''; + #$res = validate_description( $c, $account ); + #$result .= $res unless $res eq 'OK'; + + unless ( $hos_datas{comment} =~ /^([a-zA-Z0-9][\_\.\-,A-Za-z0-9\s]*)$/ || $hos_datas{comment} eq '' ) { + $result .= $c->l('hos_HOSTNAME_COMMENT_ERROR') . '
'; + } + + if ( ! $result and $hos_datas{hosttype} ne 'Self' ) { + if ( $hos_datas{hosttype} eq 'Local' ) { + $hos_datas{'trt'} = 'ULC'; # UPDATE/LOCAL + } else { + $hos_datas{'trt'} = 'URM'; # UPDATE/REMOVE + } + + $c->stash( title => $title, notif => '', hos_datas => \%hos_datas ); + return $c->render( template => 'hostentries' ); + } + + #!#$result .= 'blocked'; + + if ( ! $result ) { + $res = create_modify_hostentry( $c, $trt, %hos_datas ); + $result .= $res unless $res eq 'OK'; + } + + if ( ! $result ) { + $result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname; + $trt = 'SUC'; + } + } + + + if ( $trt =~ /^.LC$/ ) { + + # controls + my $res = ''; + $res = ip_number( $c, $hos_datas{internalip} ); + $result .= $res . ' ' unless $res eq 'OK'; + + $res = not_in_dhcp_range( $c, $hos_datas{internalip} ); + $result .= $res . ' ' unless $res eq 'OK'; + + $res = not_taken( $c, $hos_datas{internalip} ); + $result .= $res . ' ' unless $res eq 'OK'; + + $res = must_be_local( $c, $hos_datas{internalip} ); + $result .= $res . ' ' unless $res eq 'OK'; + + $res = mac_address_or_blank( $c, $hos_datas{macaddress} ); + $result .= $res . ' ' unless $res eq 'OK'; + + #!#$result .= 'blocked'; + + if ( ! $result ) { + $res = create_modify_hostentry( $c, $trt, %hos_datas ); + $result .= $res unless $res eq 'OK'; + } + + if ( ! $result ) { + $result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname; + $trt = 'SUC'; + } + } + + + if ( $trt =~ /^.RM$/ ) { + + # controls + my $res = ''; + $res = ip_number_or_blank( $c, $hos_datas{externalip} ); + $result .= $res . '
' unless $res eq 'OK'; + + #!#$result .= 'blocked'; + + if ( ! $result ) { + $res = create_modify_hostentry( $c, $trt, %hos_datas ); + $result .= $res unless $res eq 'OK'; + } + + if ( ! $result ) { + $result = $c->l('hos_MODIFY_SUCCEEDED') . ' ' . $hostname; + $trt = 'SUC'; + } + + } + + + #if ( $trt eq 'ULC' ) { + #} + + + #if ( $trt eq 'URM' ) { + #} + + + if ( $trt eq 'DEL' ) { + + # controls + my $res = ''; + #$res = validate_is_hostentry($c, $hostname); + #$result .= $res unless $res eq 'OK'; + + #!#$result .= 'blocked'; + + if ( ! $result ) { + my $res = delete_hostentry( $c, $hos_datas{hostname} ); + $result .= $res unless $res eq 'OK'; + } + if ( ! $result ) { + $result = $c->l('hos_REMOVE_SUCCEEDED') . ' ' . $hostname; + $trt = 'SUC'; + } + } + + $hos_datas{'hostname'} = $hostname; + $hos_datas{'trt'} = $trt; + + $c->stash( title => $title, notif => $result, hos_datas => \%hos_datas ); + + if ($hos_datas{trt} ne 'SUC') { + return $c->render(template => 'hostentries'); + } + $c->redirect_to('/hostentries'); + + +}; + + +sub create_modify_hostentry { + + my ($c, $trt, %hos_datas) = @_; + + my $hostname = $hos_datas{hostname}; + my $action; + + if ($trt eq 'ADD' or $trt eq 'ALC' or $trt eq 'ARM') { + $action = 'create'; + } + if ( $trt eq 'UPD' or $trt eq 'ULC' or $trt eq 'URM') { + $action = 'modify'; + } + + unless ($hostname) { + return $c->l($action eq 'create' ? $c->l('hos_ERROR_CREATING_HOST') + : $c->l('hos_ERROR_MODIFYING_HOST')); + } + + # Untaint and lowercase $hostname + $hostname =~ /([\w\.-]+)/; $hostname = lc($1); + + my $rec = $hdb->get($hostname); + if ($rec and $action eq 'create') { + return $c->l('hos_HOSTNAME_IN_USE_ERROR'); + } + if (not $rec and $action eq 'modify') { + return $c->l('hos_NONEXISTENT_HOSTNAME_ERROR'); + } + + my %props = ( + type => 'host', + HostType => $hos_datas{hosttype}, + ExternalIP => $hos_datas{externalip}, + InternalIP => $hos_datas{internalip}, + MACAddress => $hos_datas{macaddress}, + Comment => $hos_datas{comment}, + ); + + if ($action eq 'create') { + if ($hdb->new_record($hostname, \%props)) { + if (system("/sbin/e-smith/signal-event", "host-$action", $hostname) != 0) { + return $c->l('hos_ERROR_WHILE_CREATING_HOST'); + } + } + } + + if ($action eq 'modify') { + if ($rec->merge_props(%props)) { + if (system("/sbin/e-smith/signal-event", "host-$action", $hostname) != 0) { + rturn $c->l('hos_ERROR_WHILE_MODIFYING_HOST'); + } + } + } + return 'OK'; + +} + + +sub delete_hostentry { + + my ($c, $hostname) = @_; + + # Untaint $hostname before use in system() + $hostname =~ /([\w\.-]+)/; $hostname = $1; + + return ($c->l('hos_ERROR_WHILE_REMOVING_HOST')) unless ($hostname); + + my $rec = $hdb->get($hostname); + return ($c->l('hos_NONEXISTENT_HOST_ERROR')) if (not $rec); + + + if ($rec->delete()) { + if (system("/sbin/e-smith/signal-event", "host-delete", "$hostname") == 0) { + return 'OK'; + } + } + return ($c->l('hos_ERROR_WHILE_DELETING_HOST')); +} + + +sub domains_list { + + my $d = esmith::DomainsDB->open_ro() or die "Couldn't open DomainsDB"; + my @domains; + for ($d->domains) + { + my $ns = $_->prop("Nameservers") || 'localhost'; + push @domains, $_->key if ($ns eq 'localhost'); + } + + return \@domains; +} + + +sub host_data { + + my $host_record = shift; + + my $ht = $host_record->prop('HostType'); + my $ip = + ($ht eq 'Self') ? $cdb->get_value('LocalIP') : + ($ht eq 'Remote') ? $host_record->prop('ExternalIP') : + $host_record->prop('InternalIP'); + + my %data = ('IP' => $ip, + 'HostName' => $host_record->key(), + 'HostType' => $host_record->prop('HostType'), + 'MACAddress' => ($host_record->prop('MACAddress') || ''), + 'Comment' => ($host_record->prop('Comment') || ''), + 'static' => ($host_record->prop('static') || 'no')); + return \%data + +} + + +sub hosttype_list { + + my $c = shift; + + return [[ $c->l('SELF') => 'Self'], + [ $c->l('LOCAL') => 'Local'], + [ $c->l('REMOTE') => 'Remote']]; +} + + +sub split_hostname { + my $hostname = shift; + return ($hostname =~ /^([^\.]+)\.(.+)$/); +} + + +sub mac_address_or_blank { + my ($c, $data) = @_; + return "OK" unless $data; + return mac_address($c, $data); +} + + +sub mac_address { + +# from CGI::FormMagick::Validator::Network + + my ($c, $data) = @_; + + $_ = lc $data; # easier to match on $_ + if (not defined $_) { + return $c->l('FM_MAC_ADDRESS1'); + } elsif (/^([0-9a-f][0-9a-f](:[0-9a-f][0-9a-f]){5})$/) { + return "OK"; + } else { + return $c->l('FM_MAC_ADDRESS2'); + } +} + + +sub ip_number_or_blank { + + # XXX - FIXME - we should push this down into CGI::FormMagick + + my $c = shift; + my $ip = shift; + + if (!defined($ip) || $ip eq "") + { + return 'OK'; + } + + return ip_number( $c, $ip ); +} + + +sub ip_number { + +# from CGI::FormMagick::Validator qw( ip_number ); + + my ($c, $data) = @_; + + return undef unless defined $data; + + return $c->l('FM_IP_NUMBER1') unless $data =~ /^[\d.]+$/; + + my @octets = split /\./, $data; + my $dots = ($data =~ tr/.//); + + return $c->l('FM_IP_NUMBER2') unless (scalar @octets == 4 and $dots == 3); + + foreach my $octet (@octets) { + return $c->l("FM_IP_NUMBER3", $octet) if $octet > 255; + } + + return 'OK'; +} + + +sub not_in_dhcp_range { + + my $c = shift; + my $address = shift; + + my $status = $cdb->get('dhcpd')->prop('status') || "disabled"; + return 'OK' unless $status eq "enabled"; + + my $start = $cdb->get('dhcpd')->prop('start'); + my $end = $cdb->get('dhcpd')->prop('end'); + + return (esmith::util::IPquadToAddr($start) + <= esmith::util::IPquadToAddr($address) + && + esmith::util::IPquadToAddr($address) + <= esmith::util::IPquadToAddr($end)) ? + $c->l('hos_ADDR_IN_DHCP_RANGE') : + 'OK'; +} + + +sub not_taken { + + my $c = shift; + my $localip = shift; + + my $server_localip = $cdb->get_value('LocalIP') || ''; + my $server_gateway = $cdb->get_value('GatewayIP') || ''; + my $server_extip = $cdb->get_value('ExternalIP') || ''; + + #$c->debug_msg("\$localip is $localip"); + #$c->debug_msg("\$server_localip is $server_localip"); + #$c->debug_msg("\$server_gateway is $server_gateway"); + #$c->debug_msg("\$server_extip is $server_extip"); + + if ($localip eq $server_localip) { + return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY'); + } + + if ($localip eq $server_gateway) { + return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY'); + } + + if (($cdb->get_value('SystemMode') ne 'serveronly') && + ($server_extip eq $localip)) { + return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY'); + } + + if ($localip eq '127.0.0.1') { + return $c->l('hos_ERR_IP_IS_LOCAL_OR_GATEWAY'); + } else { + return 'OK'; + } +} + + +sub must_be_local { + + my $c = shift; + my $localip = shift; + + # Make sure that the IP is indeed local. + #my $ndb = esmith::NetworksDB->open_ro; + my @local_list = $ndb->local_access_spec; + + foreach my $spec (@local_list) { + next if $spec eq '127.0.0.1'; + if (eval{Net::IPv4Addr::ipv4_in_network($spec, $localip)}) { + return 'OK'; + } + } + # Not OK. The IP is not on any of our local networks. + return $c->l('hos_ERR_IP_NOT_LOCAL'); +} + + +1; diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Initial_ori.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Initial_ori.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Initial_ori.pm 2020-01-23 11:13:34.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Initial_ori.pm 2020-02-02 21:03:50.000000000 +0400 @@ -17,10 +17,6 @@ init_session( $c ); } - my %nav = %{SrvMngr::navigation2->getNavigation( $c->languages() )}; -# $c->app->log->info("nav: " . $c->dumper(%{SrvMngr::navigation2->getNavigation( $c->languages() )})); -# $c->app->log->info("nav: " . $c->dumper(%{SrvMngr::navigation2->getNavigation( $c->session->{lang} )})); - my $title = $c->l('initial_FORM_TITLE'); my $modul = $c->render_to_string(inline => $c->l('initial_FRAMES_BODY')); diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modsearch.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modsearch.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modsearch.pm 2020-01-24 18:57:24.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modsearch.pm 2020-02-08 16:14:23.000000000 +0400 @@ -9,15 +9,10 @@ use SrvMngr qw(theme_list init_session_cgi); -#use esmith::config; -#use esmith::NavigationDB; -#use esmith::util; -#use esmith::I18N; - sub main { my $c = shift; - my $module = $c->param('module'); + my $module = $c->stash('module'); $c->app->log->info($c->log_req); diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modules.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modules.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modules.pm 2020-01-24 18:56:36.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Modules.pm 2020-02-02 21:03:13.000000000 +0400 @@ -9,11 +9,6 @@ use SrvMngr qw(theme_list init_session_cgi); -#use esmith::config; -#use esmith::NavigationDB; -#use esmith::util; -#use esmith::I18N; - sub bugreport { my $c = shift; @@ -23,8 +18,7 @@
# \$c->stash\(\'lang\', \'releaseVer\' # \'navigation\'

"); - - $c->stash( modul => $modul, PwdSet => '1', Unsafe => '0' ); + $c->stash( modul => $modul ); }; @@ -62,15 +56,6 @@ my $module = $c->param('module'); $c->app->log->info($c->log_req); -# my ($lang, $releaseVersion, $copyRight, $PwdSet, $Unsafe, $config) = -# $c->stash('lang', 'releaseVersion', 'copyRight', 'PwdSet', 'Unsafe', -# 'navigation', 'modul', 'config'); - - #my $page = $c->schema->resultset('Page')->single({ name => $module }); - #$c->app->log->info("module page: '$page'"); - #if ($page) { - #$c->render( page => $page ); - #} my $redirect_url = SrvMngr->get_mod_url($module); if($redirect_url ne "-1"){ diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Pseudonyms.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Pseudonyms.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Pseudonyms.pm 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Pseudonyms.pm 2020-02-08 17:24:35.000000000 +0400 @@ -0,0 +1,431 @@ +package SrvMngr::Controller::Pseudonyms; + +use strict; +use warnings; +use Mojo::Base 'Mojolicious::Controller'; + +use Locale::gettext; +use SrvMngr::I18N; + +use SrvMngr qw(theme_list init_session_cgi); + +#use Data::Dumper; + +#use esmith::FormMagick::Panel::pseudonyms; +use esmith::AccountsDB; +#use URI::Escape; + + +our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db"; +our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db"; + +sub main { + + my $c = shift; + $c->app->log->info($c->log_req); + + my %pse_datas = (); + my $title = $c->l('pse_FORM_TITLE'); + my $notif = ''; + + $pse_datas{trt} = 'LIST'; + + my @pseudonyms; + if ($adb) + { + @pseudonyms = $adb->pseudonyms(); + } + +# foreach my $i (0 .. $#pseudonyms) { +# if ( $pseudonyms[$i]->prop('type') eq 'pseudonym' ) { +# my $account = $pseudonyms[$i]->prop('Account'); +# my $accountO = $account; +# $account = "Administrator" if ($account eq "admin"); +# $account = $c->l("pse_EVERYONE") if ($account eq "shared"); +# my $visible = $pseudonyms[$i]->prop('Visible'); +# $account .= $c->l("pse_LOCAL_ONLY") +# if (defined $visible && $visible eq "internal"); +# if ( $account ne $accountO ) { +# $c->app->log->info( "pseudo $i: $accountO -> $account " ); +# $pseudonyms[$i] =~ s/$accountO/$account/; +# # . $c->dumper( $pseudonyms[$i] ) ) +# } +# } +# } +# $c->app->log->info("pseudos: " . $c->dumper(@pseudonyms)); + + $c->stash( title => $title, notif => $notif, pse_datas => \%pse_datas, pseudonyms => \@pseudonyms ); + $c->render(template => 'pseudonyms'); + +}; + + +sub do_display { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = ($c->param('trt') || 'LIST'); + my $pseudonym = $c->param('pseudonym') || ''; + + $trt = 'DEL' if ( $rt eq 'pseudodel1' ); + $trt = 'UPD' if ( $rt eq 'pseudoupd1' ); + $trt = 'ADD' if ( $rt eq 'pseudoadd1' ); + + my %pse_datas = (); + my $title = $c->l('pse_FORM_TITLE'); + my $notif = ''; + + $pse_datas{'trt'} = $trt; + + if ( $trt eq 'ADD' ) { + + } + + if ( $trt eq 'UPD' ) { + + my $rec = $adb->get($pseudonym); + if ($rec and $rec->prop('type') eq 'pseudonym') { + + $pse_datas{pseudonym} = $pseudonym; + $pse_datas{account} = $rec->prop('Account') || ''; + $pse_datas{internal} = is_pseudonym_internal($pseudonym); + } + } + + if ( $trt eq 'DEL' ) { + + my $rec = $adb->get($pseudonym); + if ($rec and $rec->prop('type') eq 'pseudonym') { + + $pse_datas{pseudonym} = $pseudonym; + $pse_datas{account} = $rec->prop('Account') || ''; + $pse_datas{internal} = is_pseudonym_internal($pseudonym); + + } + } + + if ( $trt eq 'LIST' ) { + my @pseudonyms; + if ($adb) { + @pseudonyms = $adb->pseudonyms(); + } + $c->stash( pseudonyms => \@pseudonyms ); + + } + + $c->stash( title => $title, notif => $notif, pse_datas => \%pse_datas ); + $c->render( template => 'pseudonyms' ); + +}; + + +sub do_update { + + my $c = shift; + $c->app->log->info($c->log_req); + + my $rt = $c->current_route; + my $trt = ($c->param('trt') || 'LIST'); + + my %pse_datas = (); + my $result = ''; + + #my $pseudonym = uri_unescape($c->param('Pseudonym')); + my $pseudonym = $c->param('Pseudonym'); + + if ( $trt eq 'ADD' ) { + + my $account = $c->param('Account'); + + # controls (validate ?????) + my $res = validate_new_pseudonym_name( $c, $pseudonym, $account ); + $result .= $res unless $res eq 'OK'; + + #$result .= ' blocked'; + + if ( ! $result ) { + + $adb->new_record( $pseudonym, { type => 'pseudonym', + Account => $account} ) + or $result .= "Error occurred while creating pseudonym in database."; + + # Untaint $pseudonym before use in system() + ($pseudonym) = ($pseudonym =~ /(.+)/); + system( "/sbin/e-smith/signal-event", "pseudonym-create", "$pseudonym",) + == 0 or $result .= 'pse_CREATE_ERROR.'; + + } + + if ( ! $result ) { + $result = $c->l('pse_CREATE_SUCCEEDED') . ' ' . $pseudonym; + $trt = 'SUC'; + } + } + + if ( $trt eq 'UPD' ) { + + my $account = $c->param('Account'); + my $internal = $c->param ('Internal') || 'NO'; + my $removable = $adb->get($pseudonym)->prop('Removable') || 'yes'; + + my %props = ('Account' => $account); + + if ($removable eq 'yes') { + if ($internal eq "YES") { $props{'Visible'} = 'internal'; } + else { $adb->get($pseudonym)->delete_prop('Visible'); } + } + + # controls + #my $res = ''; + #$res = validate_description( $c, $account ); + #$result .= $res unless $res eq 'OK'; + + #$result .= 'blocked'; + + if ( ! $result ) { + + $adb->get($pseudonym)->merge_props(%props) + or $result .= "Error occurred while modifying pseudonym in database."; + + # Untaint $pseudonym before use in system() + ($pseudonym) = ($pseudonym =~ /(.+)/); + system( "/sbin/e-smith/signal-event", "pseudonym-modify", "$pseudonym",) + == 0 or $result .= "Error occurred while modifying pseudonym."; + + } + + if ( ! $result ) { + $result = $c->l('pse_MODIFY_SUCCEEDED') . ' ' . $pseudonym; + $trt = 'SUC'; + } + } + + + if ( $trt eq 'DEL' ) { + + # controls + my $res = ''; + $res = validate_is_pseudonym($c, $pseudonym); + $result .= $res unless $res eq 'OK'; + + #$result .= 'blocked'; + + if ( ! $result ) { + my $res = delete_pseudonym( $c, $pseudonym ); + $result .= $res unless $res eq 'OK'; + if ( ! $result ) { + $result = $c->l('pse_REMOVE_SUCCEEDED') . ' ' . $pseudonym; + $trt = 'SUC'; + } + } + } + + my $title = $c->l('pse_FORM_TITLE'); + $pse_datas{'pseudonym'} = $pseudonym; + $pse_datas{'trt'} = $trt; + +# $c->stash( title => $title, notif => $result ); +# $c->render(template => 'module'); + $c->stash( title => $title, notif => $result, pse_datas => \%pse_datas ); + if ($pse_datas{trt} ne 'SUC') { + return $c->render(template => 'pseudonyms'); + } + $c->redirect_to('/pseudonyms'); + + +}; + + +sub delete_pseudonym { + + my ($c, $pseudonym) = @_; + + my $msg = ''; + #------------------------------------------------------------ + # Make the pseudonym inactive, signal pseudonym-delete event + # and then delete it + #------------------------------------------------------------ + + my @pseudonyms = $adb->pseudonyms(); + + foreach my $p_rec (@pseudonyms) { + if ($p_rec->prop("Account") eq $pseudonym) { + $adb->get($p_rec->key)->set_prop('type','pseudonym-deleted') + or $msg .= "Error occurred while changing pseudonym type."; + } + } + + $adb->get($pseudonym)->set_prop('type','pseudonym-deleted') + or $msg .= "Error occurred while changing pseudonym type."; + + # Untaint $pseudonym before use in system() + ($pseudonym) = ($pseudonym =~ /(.+)/); + system( "/sbin/e-smith/signal-event", "pseudonym-delete", "$pseudonym") == 0 + or $msg .= "Error occurred while removing pseudonym."; + + #TODO: is it ->delete or get()->delete + foreach my $p_rec (@pseudonyms) { + if ($p_rec->prop("Account") eq $pseudonym) { + $adb->get($p_rec->key)->delete() + or $msg .= "Error occurred while deleting pseudonym from database."; + } + } + + $adb->get($pseudonym)->delete() + or $msg .= "Error occurred while deleting pseudonym from database."; + + return $msg unless $msg; + + return 'OK'; +} + + + +sub existing_accounts_list { + my $c = shift; + + my @existingAccounts = ( ['Administrator' => 'admin']); + + foreach my $a ($adb->get_all) { + if ($a->prop('type') =~ /(user|group)/) { + push @existingAccounts, [ $a->key => $a->key ]; + } + if ($a->prop('type') eq "pseudonym") { + my $target = $adb->get($a->prop('Account')); + + unless ($target) + { + warn "WARNING: pseudonym (" . $a->key . ") => missing Account(" + . $a->prop('Account') . ")\n"; + next; + } + + push @existingAccounts, [ $a->key, $a->key ] + unless ($target->prop('type') eq "pseudonym"); + } + } + + return(\@existingAccounts); +} + + +=head2 get_pseudonym_account + +Returns the current Account property for this pseudonym + +=cut + +sub get_pseudonym_account { + my $c = shift; + my $pseudonym = shift; + + my $a = $adb->get($pseudonym)->prop('Account'); + if ($a eq "admin") { + $a = "Administrator"; + } elsif ($a eq "shared") { + $a = $c->l("EVERYONE"); + } + return($a); +} + +=head2 is_pseudonym_not_removable + +Returns 1 if the current Account is not removable, 0 otherwise + +=cut + +sub is_pseudonym_not_removable { + my $c = shift; + my $pseudonym = shift; + + my $removable = $adb->get($pseudonym)->prop('Removable') || 'yes'; + return 1 if ($removable eq 'yes'); + return 0; +} + +=head2 is_pseudonym_internal + +Returns YES if the current Account property Visible is 'internal' + +=cut + +sub is_pseudonym_internal { +# my $c = shift; + my $pseudonym = shift; + + my $visible = $adb->get($pseudonym)->prop('Visible') || ''; + return 'YES' if ($visible eq 'internal'); + return 'NO'; +} + +=head2 validate_new_pseudonym_name FM PSEUDONYM + +Returns "OK" if the pseudonym starts with a letter or number and +contains only letters, numbers, . - and _ and isn't taken + +Returns "VALID_PSEUDONYM_NAMES" if the name contains invalid chars + +Returns "NAME_IN_USE" if this pseudonym is taken. + +=cut + +sub validate_new_pseudonym_name { + + my ($c, $pseudonym, $account) = @_; + + my $acct = $adb->get($pseudonym); + if (defined $acct) { + return($c->l('pse_NAME_IN_USE')); + } + elsif ($pseudonym =~ /@/) + { + use esmith::DomainsDB; + + my $ddb = esmith::DomainsDB->open_ro + or die "Couldn't open DomainsDB\n"; + + my ($lhs, $rhs) = split /@/, $pseudonym; + + return ($c->l('pse_PSEUDONYM_INVALID_DOMAIN')) unless ($ddb->get($rhs)); + + return ($c->l('pse_PSEUDONYM_INVALID_SAMEACCT')) + if ($lhs eq $account); + + return ('OK p:' . $pseudonym . ' a:' . $account); + } + elsif ( $pseudonym !~ /^([a-z0-9][a-z0-9\.\-_!#\?~\$\^\+&`%\/\*]*)$/ ) + { + return($c->l('pse_VALID_PSEUDONYM_NAMES')); + } + else { + return('OK'); + } +} + + +=head2 validate_is_pseudonym FM NAME + +returns "OK" if it is. +returns "NOT_A_PSEUDONYM" if the name in question isn't an existing pseudonym + +=cut + +sub validate_is_pseudonym { + my $c = shift; + my $pseudonym = shift; + + $pseudonym = $adb->get($pseudonym); + return($c->l('pse_NOT_A_PSEUDONYM')) unless $pseudonym; + + my $type = $pseudonym->prop('type'); + unless (defined $type && ($type eq 'pseudonym') ) { + return($c->l('NOT_A_PSEUDONYM')); + } + + return ('OK'); +} + + +1; diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Request.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Request.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Request.pm 2020-01-24 18:57:31.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Request.pm 2020-02-19 22:26:13.000000000 +0400 @@ -2,55 +2,46 @@ use strict; use warnings; - use Mojo::Base 'Mojolicious::Controller'; -use SrvMngr qw(theme_list init_session_cgi); - -use esmith::AccountsDB qw(open_ro); -use esmith::ConfigDB qw(open_ro); +use Locale::gettext; +use SrvMngr::I18N; -#use Locale::gettext; -#use SrvMngr::I18N; +use SrvMngr qw(theme_list init_session_cgi); -# retrieve a configuration db record, both simple (DomainName) or complex (InternalIntefrace), given its name -sub getconfig { +# retrieve a configuration db record +sub config { my $c = shift; -# $c -> res -> headers -> header('Access-Control-Allow-Origin' => '*'); - my $dbc = esmith::ConfigDB -> open_ro; - my $key = $c -> param('key'); + my $key = $c->param('key'); if ($key) { - my $r = $dbc -> get($key); - $c -> render(json => { - $key => { - $r -> props - } - }) - } else { - $c -> render( text => 'error'); + use esmith::ConfigDB qw(open_ro); + my $cdb = esmith::ConfigDB->open_ro; + return getdb( $c, $cdb, $key); } -}; +} # retrieve an accounts db record, given its name -# we use a relaxed placeholder because keys can have a dot inside -sub getaccount { +sub account { my $c = shift; -# $c -> res -> headers -> header('Access-Control-Allow-Origin' => '*'); - my $dba = esmith::AccountsDB -> open_ro; - my $key = $c -> param('key'); + my $key = $c->param('key'); if ($key) { - my $r = $dba -> get($key); - $c -> render(json => { - $key => { - $r -> props - } - }) - } else { - $c -> render( text => 'error'); + use esmith::AccountsDB qw(open_ro); + my $adb = esmith::Accounts->open_ro; + return getdb( $c, $adb, $key); + } +} + + +sub getdb { + my ($c, $db, $key) = @_; + + if ( my $rec = $db->get($key) ) { + return $c->render(json => { $key => { $rec->props }} ); } + return undef; } diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Support.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Support.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Support.pm 2020-01-24 18:57:52.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Support.pm 2020-02-02 20:59:44.000000000 +0400 @@ -6,23 +6,18 @@ use SrvMngr qw(theme_list init_session_cgi); -#use esmith::config; -#use esmith::NavigationDB; use esmith::util; -#use esmith::I18N; -sub display_licenses -{ +sub display_licenses { + my $lang = shift; - #print "
\n";
 	my $lic = '';
-	foreach my $license (esmith::util::getLicenses($lang))
-	{
+	foreach my $license (esmith::util::getLicenses($lang)) {
+
 		$lic .= $license . '
'; } - #print "
\n"; return $lic; } @@ -30,15 +25,10 @@ my $c = shift; $c->app->log->info($c->log_req); - esmith::util::setRealToEffective(); - my $title = $c->l('support_FORM_TITLE'); my $modul = $c->render_to_string(inline => display_licenses($c->session->{lang})); - $c->stash( releaseVersion => $c->session->{releaseVersion}, copyRight => $c->session->{copyRight}, - PwdSet => $c->session->{PwdSet}, Unsafe => $c->session->{Unsafe}, navigation => $c->session->{navigation}, - title => $title, modul => $modul); - + $c->stash( title => $title, modul => $modul ); $c->render(template => 'module'); }; diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Welcome.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Welcome.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Welcome.pm 2020-01-24 18:56:46.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Welcome.pm 2020-02-02 21:00:20.000000000 +0400 @@ -10,24 +10,16 @@ use SrvMngr qw(theme_list init_session_cgi); -use SrvMngr::Navigation2; - -#page d'accueil sub main { my $c = shift; - $c->app->log->info("Appel de la page d'accueil."); $c->app->log->info($c->log_req); my $title = 'Welcome page'; + my $modul .= ' Welcome '; - my $modul .= ' Welcome result is 10 + 33.'; - - my %nav = (); - #%{SrvMngr::Navigation2->getNavigation( $c->languages() )}; - - $c->stash( title => $title, modul => $modul, navig => \%nav ); + $c->stash( title => $title, modul => $modul ); $c->render(template => 'welcome'); } diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/en.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/en.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/en.pm 2020-01-27 00:07:35.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/en.pm 2020-02-16 00:27:54.000000000 +0400 @@ -12,7 +12,6 @@ cancel => 'Cancel', hello => 'hello', 'All rights reserved' => 'All Rights Reserved', - 'Collaboration' => 'Collaboration', 'Administration' => 'Administration', 'Security' => 'Security', @@ -42,8 +41,7 @@ 'GROUP' => 'Group', 'DESC_SECTIONBAR' => '
', 'NO_PIPES_ALLOWED' => 'Pipe symbols (|) are not permitted in this field', -'ERROR_BELOW' => ' -ERROR: There was an error in the validation of this page. Please +'ERROR_BELOW' => 'ERROR: There was an error in the validation of this page. Please scroll down and find the specific problem.', 'ACCESS' => 'Access', 'ACCOUNT_LOCKED' => 'Account is locked', @@ -244,180 +242,19 @@

', 'sws_LABEL_COMPANYNAME' => 'Company name', -'sws_DESC_HEADER1' => ' -First header, typically used for short phrases such -as "Leader in the field of textile manufacturing" -', -'sws_DESC_TEXT1' => -' -Text following first header, typically used for a -paragraph of marketing information. -', -'sws_DESC_HEADER2' => -' -Second header, typically used for short phrases such -as "For more information" or "To order our products": -', -'sws_DESC_TEXT2' => -' -Text following second header, typically used for contact -or ordering information: -', -'sws_DESC_SUBMIT' => -' -

When you create this web page, the file +'sws_DESC_HEADER1' => 'First header, typically used for short phrases such +as "Leader in the field of textile manufacturing"', +'sws_DESC_TEXT1' => 'Text following first header, typically used for a +paragraph of marketing information.', +'sws_DESC_HEADER2' => 'Second header, typically used for short phrases such +as "For more information" or "To order our products":', +'sws_DESC_TEXT2' => 'Text following second header, typically used for contact +or ordering information:', +'sws_DESC_SUBMIT' => '

When you create this web page, the file "index.htm" will be overwritten in your web site directory.

-

Do you wish to proceed?

-', -'sws_Create starter web site' => -'Create starter web site', - -'bugr_FORM_TITLE' => 'Report a Bug', -'bugr_DO_NOT_PANIC' => 'Don\'t Panic!', -'bugr_SME_EXPERIENCE' => -'Unfortunately there is no software without bugs, and you probably came to this page because of an issue you are experiencing with your SME-server installation.', -'bugr_PLEASE_REPORT_HERE' => -'In order to help developers to diagnose and fix your issue, please download one of the following text templates, fill it out and paste it into your bug report at', -'bugr_USE_TEMPLATE' => -'Please refer to the following link on how to report efficiency a bug and use its template', -'bugr_FOLLOWING_REPORT_MIGHT_HELP' => -'It will also help if you provide some vital information on the configuration of your SME-server in your bug report. By clicking on the "Create configuration report" button below, you can create and download a text file containing this information. Please attach this file to your bug report as well.', -'bugr_REPORT_CONTENT' => -'The report will contain the following information', -'bugr_SME_VERSION' => -'Koozali SME Server version', -'bugr_SERVER_MODE' => 'Server mode', -'bugr_KERNEL_AND_ARCH' => 'Current running kernel version and architecture', -'bugr_INSTALLED_RPMS' => 'A list of additional RPMs installed on your server', -'bugr_ALTERED_TEMPLATES' => 'A list of SME templates that have been altered on your server from a base install', -'bugr_ALTERED_EVENTS' => 'A list of SME events that have been altered on your server from a base install', -'bugr_YUM_REPOS' => 'A list of additional software repositories configured on your server', -'bugr_PRIVACY' => 'No privacy related data (ie. users, passwords, IP addresses) will be included in the report.', -'bugr_CREATE_REPORT' => 'Create configuration report', -'bugr_DONATING' => 'Have you considered donating?', -'bugr_AWARE_SME' => 'You are probaly aware that SME server is developed and supported by a collaborative community of volunteers from all over the world. While SME server is free to download and use, maintaining the infrastructure behind the project (eg. hosting the forums and wiki, providing repositories and build servers etc.) costs real money in the real world.', -'bugr_YOUR_HELP' => 'In very much the same way you need us to address your current issue, we need YOUR help to keep this project alive!', -'bugr_CONSIDER_DONATING' => 'Please consider donating to the project by clicking on the image link below:', -'bugr_THANK_YOU' => 'Thank you for your support!', -'bugr_Download this report' => 'Download this report !', -'bugr_Report a bug' => 'Report a bug', - -'rvw_FORM_TITLE' => 'Review configuration', -'rvw_DESCRIPTION' => 'This report summarizes the networking, server, and domain -parameters on this server relevant to configuring -the client computers on your network.You may wish to print this -page and use it as a reference.', -'rvw_NETWORKING_PARAMS' => 'Networking Parameters', -'rvw_SERVER_MODE' => 'Server Mode', -'rvw_LOCAL_IP_ADDRESS_SUBNET_MASK' => 'Local IP address / subnet mask', -'rvw_EXTERNAL_IP_ADDRESS_SUBNET_MASK' => 'External IP address / subnet mask', -'rvw_GATEWAY' => 'Gateway', -'rvw_ADDITIONAL_LOCAL_NETWORKS' => 'Additional local networks', -'rvw_DHCP_SERVER' => 'DHCP server', -'rvw_BEGINNING_OF_DHCP_ADDRESS_RANGE' => 'Beginning of DHCP address range', -'rvw_END_OF_DHCP_ADDRESS_RANGE' => 'End of DHCP address range', -'rvw_SERVER_NAMES' => 'Server names', -'rvw_DNS_SERVER' => 'DNS server', -'rvw_WEB_SERVER' => 'Web server', -'rvw_PROXY_SERVER' => 'Proxy server', -'rvw_FTP_SERVER' => 'FTP server', -'rvw_SMTP_POP_AND_IMAP_MAIL_SERVERS' => 'SMTP, POP, and IMAP mail servers', -'rvw_HOSTS' => 'Hosts', -'rvw_DOMAIN_INFORMATION' => 'Domain information', -'rvw_PRIMARY_DOMAIN' => 'Primary domain', -'rvw_VIRTUAL_DOMAINS' => 'Virtual domains', -'rvw_PRIMARY_WEB_SITE' => 'Primary web site', -'rvw_SERVER_MANAGER' => 'Server manager', -'rvw_USER_PASSWORD_PANEL' => 'User password panel', -'rvw_EMAIL_ADDRESSES' => 'Email Addresses', -'rvw_EMAIL_USERACCOUNT' => 'useraccount', -'rvw_EMAIL_FIRSTNAME' => 'firstname', -'rvw_EMAIL_LASTNAME' => 'lastname', -'rvw_NO_VIRTUAL_DOMAINS' => 'No virtual domains defined', -'rvw_NO_NETWORKS' => 'No additional networks defined', -'rvw_INTERNET_VISIBLE_ADDRESS' => 'Internet Visible IP Address', - -'dir_FORM_TITLE' => 'Change LDAP directory settings', -'dir_LABEL_ROOT' => 'Server root', -'dir_DESCRIPTION' => 'The LDAP server provides a network-available listing of the user accounts -and groups on your server, and can be accessed using an LDAP client such as the Address Book feature in Netscape Communicator. Configure your LDAP client with the local IP address of your server, port number 389, and the server root parameter shown below. -', -'dir_DESC_DIRECTORY_ACCESS' => ' You can control access to your LDAP directory: the private setting allows access only from your local network, and the public setting allows access from anywhere on the Internet. ', -'dir_DIRECTORY_ACCESS' => 'LDAP directory access', -'dir_DESC_DEPARTMENT' => 'These fields are the LDAP defaults for your organization. -Whenever you create a new user account, you will be prompted -to enter all of these fields (they can be different for each -user) but the values you set here -will show up as defaults. This is a convenience to make it -faster to create user accounts.', -'dir_DEPARTMENT' => 'Default department', -'dir_COMPANY' => 'Default company', -'dir_STREET' => 'Default Street address', -'dir_CITY' => 'Default City', -'dir_PHONENUMBER' => 'Default Phone Number', -'dir_DESC_EXISTING' => 'You can either leave existing user accounts as they are, using the above defaults only for -new users, or you can apply the above defaults to all existing users as well.', -'dir_EXISTING' => 'Existing users', -'dir_SUCCESS' => 'The new LDAP default settings have been saved.', -'dir_LEAVE' => 'Leave as they are', -'dir_UPDATE' => 'Update with new defaults', -'dir_Directory' => 'Directory', - -'prx_TITLE' => 'Proxy settings', -'prx_FIRST_PAGE_DESCRIPTION' => 'This page allows configuration of the server\'s -proxy settings. -The server includes a transparent proxy and cache for -HTTP traffic. This is enabled by default, but not enforced -if the server is in "serveronly" mode. -If this server is acting as an e-mail server, connections -from local network clients to external SMTP servers -will default to being redirected to the local e-mail server.', -'prx_HTTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s HTTP proxy works to reduce overall uplink usage by -caching recently-visited pages. It is transparent to web browsers -using this server as their gateway. Enable or disable this proxy -with the following toggle.', -'prx_HTTP_PROXY_STATUS_LABEL' => 'HTTP proxy status', -'prx_SMTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s transparent SMTP proxy works to reduce virus traffic -from infected client hosts by forcing all outgoing SMTP traffic -through this server if set to "enabled". -If you wish to use an alternate SMTP server, and this server is -your gateway to it, set this proxy to "disabled". Setting the -proxy to "blocked" prevents all SMTP traffic to other servers, -this is the default. The proxy only intercepts/blocks normal smtp -(port 25) traffic.', -'prx_SMTP_PROXY_STATUS_LABEL' => 'SMTP proxy status', -'prx_ERR_PROXY_UPDATE_FAILED' => 'ERROR: The proxy-update event returned an error.', -'prx_ERR_NO_SQUID_REC' => 'ERROR: There is no squid record in the configuration database.', -'prx_SUCCESS' => 'The new proxy settings were applied successfully.', -'prx_BLOCKED' => 'Blocked', - -'qma_FORM_TITLE' => 'Mail Log File Analysis', -'qma_INITIAL_DESC' => '

Analysing the mail system log files can aid both in -understanding how your system is performing and in -diagnosing delivery problems. Several different -reports are available.

-

Please note that it may take several minutes to generate -these reports

', -'qma_REPORT_TYPE' => 'Choose a report type', -'qma_GENERATE_REPORT' => 'Generate report', -'qma_LIST_OUTGOING' => 'List outgoing messages and recipients', -'qma_SUMMARIZE_QUEUE' => 'Summarize status of mail queue', -'qma_SUCCESSFUL_DELIVERY_DELAY' => 'Successful delivery delay distribution', -'qma_REASONS_DEFERRAL' => 'Reasons for deferral', -'qma_REASONS_FAILURE' => 'Reasons for failure', -'qma_BASIC_STATS' => 'Basic statistics', -'qma_RECIP_STATS' => 'Recipients statistics', -'qma_RECIP_HOSTS' => 'Recipient hosts', -'qma_RECIP_ORDERED' => 'Recipients in best order for mailing lists', -'qma_SENDER_STATS' => 'Sender statistics', -'qma_SENDMAIL_STYLE' => 'Sendmail style log', -'qma_REASONS_SUCCESS' => 'Reasons for success', -'qma_SENDER_UIDS' => 'Sender uids', -'qma_INVALID_REPORT_TYPE' => 'Invalid report type: ', -'qma_REPORT_GENERATED' => 'Report generated: ', -'qma_END_OF_REPORT' => 'End of Report', -'qma_Mail log file analysis' => 'Mail log file analysis', +

Do you wish to proceed?

', +'sws_Create starter web site' => 'Create starter web site', 'clm_FORM_TITLE' => 'Antivirus settings', 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' => 'Scan filesystem', @@ -612,6 +449,152 @@ 'prt_MUST_BE_VALID_HOSTNAME_OR_IP' => 'Must be a valid hostname or IP number', 'prt_Printers' => 'Printers', +'bugr_FORM_TITLE' => 'Report a Bug', +'bugr_DO_NOT_PANIC' => 'Don\'t Panic!', +'bugr_SME_EXPERIENCE' => +'Unfortunately there is no software without bugs, and you probably came to this page because of an issue you are experiencing with your SME-server installation.', +'bugr_PLEASE_REPORT_HERE' => +'In order to help developers to diagnose and fix your issue, please download one of the following text templates, fill it out and paste it into your bug report at', +'bugr_USE_TEMPLATE' => +'Please refer to the following link on how to report efficiency a bug and use its template', +'bugr_FOLLOWING_REPORT_MIGHT_HELP' => +'It will also help if you provide some vital information on the configuration of your SME-server in your bug report. By clicking on the "Create configuration report" button below, you can create and download a text file containing this information. Please attach this file to your bug report as well.', +'bugr_REPORT_CONTENT' => +'The report will contain the following information', +'bugr_SME_VERSION' => +'Koozali SME Server version', +'bugr_SERVER_MODE' => 'Server mode', +'bugr_KERNEL_AND_ARCH' => 'Current running kernel version and architecture', +'bugr_INSTALLED_RPMS' => 'A list of additional RPMs installed on your server', +'bugr_ALTERED_TEMPLATES' => 'A list of SME templates that have been altered on your server from a base install', +'bugr_ALTERED_EVENTS' => 'A list of SME events that have been altered on your server from a base install', +'bugr_YUM_REPOS' => 'A list of additional software repositories configured on your server', +'bugr_PRIVACY' => 'No privacy related data (ie. users, passwords, IP addresses) will be included in the report.', +'bugr_CREATE_REPORT' => 'Create configuration report', +'bugr_DONATING' => 'Have you considered donating?', +'bugr_AWARE_SME' => 'You are probaly aware that SME server is developed and supported by a collaborative community of volunteers from all over the world. While SME server is free to download and use, maintaining the infrastructure behind the project (eg. hosting the forums and wiki, providing repositories and build servers etc.) costs real money in the real world.', +'bugr_YOUR_HELP' => 'In very much the same way you need us to address your current issue, we need YOUR help to keep this project alive!', +'bugr_CONSIDER_DONATING' => 'Please consider donating to the project by clicking on the image link below:', +'bugr_THANK_YOU' => 'Thank you for your support!', +'bugr_Download this report' => 'Download this report !', +'bugr_Report a bug' => 'Report a bug', + +'rvw_FORM_TITLE' => 'Review configuration', +'rvw_DESCRIPTION' => 'This report summarizes the networking, server, and domain +parameters on this server relevant to configuring +the client computers on your network.You may wish to print this +page and use it as a reference.', +'rvw_NETWORKING_PARAMS' => 'Networking Parameters', +'rvw_SERVER_MODE' => 'Server Mode', +'rvw_LOCAL_IP_ADDRESS_SUBNET_MASK' => 'Local IP address / subnet mask', +'rvw_EXTERNAL_IP_ADDRESS_SUBNET_MASK' => 'External IP address / subnet mask', +'rvw_GATEWAY' => 'Gateway', +'rvw_ADDITIONAL_LOCAL_NETWORKS' => 'Additional local networks', +'rvw_DHCP_SERVER' => 'DHCP server', +'rvw_BEGINNING_OF_DHCP_ADDRESS_RANGE' => 'Beginning of DHCP address range', +'rvw_END_OF_DHCP_ADDRESS_RANGE' => 'End of DHCP address range', +'rvw_SERVER_NAMES' => 'Server names', +'rvw_DNS_SERVER' => 'DNS server', +'rvw_WEB_SERVER' => 'Web server', +'rvw_PROXY_SERVER' => 'Proxy server', +'rvw_FTP_SERVER' => 'FTP server', +'rvw_SMTP_POP_AND_IMAP_MAIL_SERVERS' => 'SMTP, POP, and IMAP mail servers', +'rvw_HOSTS' => 'Hosts', +'rvw_DOMAIN_INFORMATION' => 'Domain information', +'rvw_PRIMARY_DOMAIN' => 'Primary domain', +'rvw_VIRTUAL_DOMAINS' => 'Virtual domains', +'rvw_PRIMARY_WEB_SITE' => 'Primary web site', +'rvw_SERVER_MANAGER' => 'Server manager', +'rvw_USER_PASSWORD_PANEL' => 'User password panel', +'rvw_EMAIL_ADDRESSES' => 'Email Addresses', +'rvw_EMAIL_USERACCOUNT' => 'useraccount', +'rvw_EMAIL_FIRSTNAME' => 'firstname', +'rvw_EMAIL_LASTNAME' => 'lastname', +'rvw_NO_VIRTUAL_DOMAINS' => 'No virtual domains defined', +'rvw_NO_NETWORKS' => 'No additional networks defined', +'rvw_INTERNET_VISIBLE_ADDRESS' => 'Internet Visible IP Address', + +'dir_FORM_TITLE' => 'Change LDAP directory settings', +'dir_LABEL_ROOT' => 'Server root', +'dir_DESCRIPTION' => 'The LDAP server provides a network-available listing of the user accounts +and groups on your server, and can be accessed using an LDAP client such as the Address Book feature in Netscape Communicator. Configure your LDAP client with the local IP address of your server, port number 389, and the server root parameter shown below. +', +'dir_DESC_DIRECTORY_ACCESS' => ' You can control access to your LDAP directory: the private setting allows access only from your local network, and the public setting allows access from anywhere on the Internet. ', +'dir_DIRECTORY_ACCESS' => 'LDAP directory access', +'dir_DESC_DEPARTMENT' => 'These fields are the LDAP defaults for your organization. +Whenever you create a new user account, you will be prompted +to enter all of these fields (they can be different for each +user) but the values you set here +will show up as defaults. This is a convenience to make it +faster to create user accounts.', +'dir_DEPARTMENT' => 'Default department', +'dir_COMPANY' => 'Default company', +'dir_STREET' => 'Default Street address', +'dir_CITY' => 'Default City', +'dir_PHONENUMBER' => 'Default Phone Number', +'dir_DESC_EXISTING' => 'You can either leave existing user accounts as they are, using the above defaults only for +new users, or you can apply the above defaults to all existing users as well.', +'dir_EXISTING' => 'Existing users', +'dir_SUCCESS' => 'The new LDAP default settings have been saved.', +'dir_LEAVE' => 'Leave as they are', +'dir_UPDATE' => 'Update with new defaults', +'dir_Directory' => 'Directory', + +'prx_TITLE' => 'Proxy settings', +'prx_FIRST_PAGE_DESCRIPTION' => 'This page allows configuration of the server\'s +proxy settings. +The server includes a transparent proxy and cache for +HTTP traffic. This is enabled by default, but not enforced +if the server is in "serveronly" mode. +If this server is acting as an e-mail server, connections +from local network clients to external SMTP servers +will default to being redirected to the local e-mail server.', +'prx_HTTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s HTTP proxy works to reduce overall uplink usage by +caching recently-visited pages. It is transparent to web browsers +using this server as their gateway. Enable or disable this proxy +with the following toggle.', +'prx_HTTP_PROXY_STATUS_LABEL' => 'HTTP proxy status', +'prx_SMTP_PROXY_STATUS_DESCRIPTION' => 'The server\'s transparent SMTP proxy works to reduce virus traffic +from infected client hosts by forcing all outgoing SMTP traffic +through this server if set to "enabled". +If you wish to use an alternate SMTP server, and this server is +your gateway to it, set this proxy to "disabled". Setting the +proxy to "blocked" prevents all SMTP traffic to other servers, +this is the default. The proxy only intercepts/blocks normal smtp +(port 25) traffic.', +'prx_SMTP_PROXY_STATUS_LABEL' => 'SMTP proxy status', +'prx_ERR_PROXY_UPDATE_FAILED' => 'ERROR: The proxy-update event returned an error.', +'prx_ERR_NO_SQUID_REC' => 'ERROR: There is no squid record in the configuration database.', +'prx_SUCCESS' => 'The new proxy settings were applied successfully.', +'prx_BLOCKED' => 'Blocked', + +'qma_FORM_TITLE' => 'Mail Log File Analysis', +'qma_INITIAL_DESC' => '

Analysing the mail system log files can aid both in +understanding how your system is performing and in +diagnosing delivery problems. Several different +reports are available.

+

Please note that it may take several minutes to generate +these reports

', +'qma_REPORT_TYPE' => 'Choose a report type', +'qma_GENERATE_REPORT' => 'Generate report', +'qma_LIST_OUTGOING' => 'List outgoing messages and recipients', +'qma_SUMMARIZE_QUEUE' => 'Summarize status of mail queue', +'qma_SUCCESSFUL_DELIVERY_DELAY' => 'Successful delivery delay distribution', +'qma_REASONS_DEFERRAL' => 'Reasons for deferral', +'qma_REASONS_FAILURE' => 'Reasons for failure', +'qma_BASIC_STATS' => 'Basic statistics', +'qma_RECIP_STATS' => 'Recipients statistics', +'qma_RECIP_HOSTS' => 'Recipient hosts', +'qma_RECIP_ORDERED' => 'Recipients in best order for mailing lists', +'qma_SENDER_STATS' => 'Sender statistics', +'qma_SENDMAIL_STYLE' => 'Sendmail style log', +'qma_REASONS_SUCCESS' => 'Reasons for success', +'qma_SENDER_UIDS' => 'Sender uids', +'qma_INVALID_REPORT_TYPE' => 'Invalid report type: ', +'qma_REPORT_GENERATED' => 'Report generated: ', +'qma_END_OF_REPORT' => 'End of Report', +'qma_Mail log file analysis' => 'Mail log file analysis', + 'quo_FORM_TITLE' => 'Create, modify, or remove user account quotas', 'quo_UNABLE_TO_OPEN_ACCOUNTS' => 'Unable to open accounts db', 'quo_QUOTA_DESC' => '

You can set filesystem quotas for users on your system by clicking @@ -776,6 +759,250 @@ 'swt_THEME' => 'Theme', +'pse_NO_PSEUDONYMS' => ' There are no pseudonyms in the system. ', +'pse_REMOVE_PSEUDONYM' => 'Remove pseudonym', +'pse_ABOUT_TO_REMOVE' => 'You are about to remove the pseudonym: [_1]
+Are you sure you wish to continue?', +'pse_FORM_TITLE' => 'Create, modify, or remove pseudonyms', +'pse_DESCRIPTION' => '

The server automatically creates +an e-mail alias for each group. If you want to define an e-mail +alias for a list of users, simply create a group and the +list will automatically be maintained by the server.

+

Pseudonyms allow you to +create other names for existing users or groups. +For example, you may wish to create a pseudonym +"webmaster" for your "webdevelopers" group or a +pseudonym "joe" for the user "joseph".

+

The server automatically creates pseudonyms of the form +firstname.lastname and firstname_lastname for every user +on the system and a pseudonym "everyone" which contains +all users on the system.

+

Pseudonyms also allow you to create e-mail aliases for valid +(virtual) domains & users. For example you can forward +"sales@virtualdomain1.com" to user "mary" and +"sales@virtualdomain2.com" to user "john". +You must create the domains and user accounts before creating +the email aliases.

+

Pseudonyms can also forward to other pseudonyms, although this +is limited to one further level. For example the pseudonym +"webmaster" can forward to the pseudonym "techsupport" which +then forwards to a specified user "ray". This is useful where +one user is responsiblefor multiple roles and saves having +to change the pseudonym\'s associated with that user many times +in the event that the user departs the organisation.

+

You can modify or remove a +pseudonym by clicking on the corresponding +command next to the pseudonym.

', +'pse_LOCAL_ONLY' => '(local network only)', +'pse_SELECT_ACCOUNT' => 'Select account or group', +'pse_SELECT_INTERNAL' => 'Local network only', +'pse_CLICK_TO_CREATE' => 'Add pseudonym', +'pse_PSEUDONYM' => 'Pseudonym', +'pse_USER_OR_GROUP' => 'User or group', +'pse_CURRENT_PSEUDONYMS' => 'Current List of Pseudonyms', +'pse_TITLE_CREATE' => 'Create a pseudonym', +'pse_DESC_PSEUDONYM_NAME' => ' Please select an existing account or group for the pseudonym from the pulldown menu below', +'pse_MODIFY_PSEUDONYM' => 'Modify Pseudonym', +'pse_PSEUDONYM_NAME' => 'Pseudonym name', +'pse_VALID_PSEUDONYM_NAMES' => ' The pseudonym + should contain only lower-case letters, numbers, period, + hyphen and underscore + and should start with a lower-case letter or + number. For example "sales", "john.holland", "123" + and "email-administrator" are all valid pseudonyms, + but "John Smith" and "Henry Miller" are not. +

You can also create email aliases for accounts and (virtual) +domains that are valid on this server. For example +"fred@virtualdomain.com" can be forwarded to "mary" +(or to another valid user account).

', +'pse_NAME_IN_USE' => 'Error: That name is in use You cannot create a pseudonym with that name.', +'pse_NOT_A_PSEUDONYM' => 'That account is not a pseudonym', +'pse_PSEUDONYM_INVALID_DOMAIN' => 'That domain is not hosted on this server', +'pse_PSEUDONYM_INVALID_NOACCT' => 'That account is not hosted on this server', +'pse_PSEUDONYM_INVALID_SAMEACCT' => 'A pseudonym cannot point to the same account', +'pse_CREATE_SUCCEEDED' => 'Successfully created pseudonym', +'pse_MODIFY_SUCCEEDED' => 'Successfully modified pseudonym', +'pse_REMOVE_SUCCEEDED' => 'Successfully removed pseudonym', +'pse_EVERYONE' => 'Everyone', +'pse_Pseudonyms' => 'Pseudonyms', + +'dom_ADD_DOMAIN' => 'Add domain', +'dom_FORM_TITLE' => 'Manage domains', +'dom_FORM_DESCRIPTION' => 'When you create a domain, your server will be able to +receive e-mail for that domain and will also be able to host a +web site for that domain.', +'dom_ADD_DOMAIN' => 'Add domain', +'dom_NO_VIRTUAL_DOMAINS' => 'There are no domains in the system', +'dom_CURRENT_DOMAINS' => 'Current list of domains', +'dom_PRIMARY_SITE' => 'primary site', +'dom_CONTENT' => '[_1] i-bay', +'dom_CREATE_TITLE' => 'Create a new domain', +'dom_CONTENT_FIELD_DESCRIPTION' => 'For the web site, you may choose your primary web site or any +i-bay as the content.', +'dom_DOMAIN_NAME_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name +[_1].The domain name should contain one or more +letters, numbers, periods and minus signs.Did not create new domain.', +'dom_DOMAIN_DESCRIPTION_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain description +[_1]. Did not create new domain.', +'dom_DOMAIN_IN_USE_ERROR' => 'Error: domain [_1] is already in use.Did not create +new domain.', +'dom_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is your system domain name.You +cannot have a domain with the same name.Did not create new domain.', +'dom_SUCCESSFULLY_CREATED' => 'Successfully created domain [_1].Your web +server is now being restarted.The links on this page will be +inactive until the web server restart is complete.', +'dom_MODIFY_TITLE' => 'Modify domain', +'dom_NONEXISTENT_DOMAIN_ERROR' => 'Error: [_1] is not an existing domain.', +'dom_SUCCESSFULLY_MODIFIED' => 'Successfully modified domain [_1].Your web +server is now being restarted.The links on this page will be +inactive until the web server restart is complete.', +'dom_REMOVE_TITLE' => 'Remove domain', +'dom_REMOVE_DESCRIPTION' => 'You are about to remove the domain "[_1]" ([_2]).', +'dom_ABOUT_TO_REMOVE' => 'Are you sure you wish to remove this domain ?', +'dom_ERROR_WHILE_REMOVING_DOMAIN' => 'Error: internal failure while removing domain [_1].', +'dom_SUCCESSFULLY_DELETED' => 'Successfully deleted domain [_1]. Your web server +is now being restarted.The links on this page will be inactive +until the web server restart is complete.', +'dom_DESC_CORPORATE_DNS_CURRENT' => 'Corporate DNS Settings', +'dom_BUTTON_CORPORATE_DNS' => 'If this server does not have access to the Internet, or you have special +requirements for DNS resolution, enter the DNS server IP address here. +You should not enter the address of your ISP\'s DNS servers here, as the server +is capable of resolving all Internet DNS names without this additional +configuration.', +'dom_DOMAINS_PAGE_CORPORATE_DNS' => 'Modify corporate DNS settings', +'dom_DESC_CORPORATE_DNS' => 'If this server does not have access to the Internet, or +you have special requirements for DNS resolution, +enter the DNS server IP addresses here. +These fields should be left blank unless +you have a specific reason to configure other DNS servers. +You should not enter the address of your ISP\'s DNS servers +here, as the server is capable of resolving all +Internet DNS names without this additional configuration.', +'dom_LABEL_CORPORATE_DNS_PRIMARY' => 'Primary corporate DNS server', +'dom_LABEL_CORPORATE_DNS_SECONDARY' => 'Secondary corporate DNS server', +'dom_DESC_NAMESERVERS' => 'You can select whether this domain is resolved locally, +passed to the corporate DNS servers, or resolved by +the Internet DNS servers. The default will be correct +for most networks.', +'dom_LABEL_NAMESERVERS' => 'Domain DNS servers', +'dom_localhost' => 'Resolve locally', +'dom_internet' => 'Internet DNS servers', +'dom_corporate' => 'Corporate DNS servers', +'dom_REMOVE_DESC' => 'You are about to remove the domain ', +'dom_REMOVE_DESC2' => ' Are you sure you wish to remove this Domain ? ', + +'hos_FORM_TITLE' => 'Hostnames and addresses', +'hos_UNABLE_TO_OPEN_CONFIGDB' => 'Unable to open configuration database', +'hos_DNS_FORWARDER_ENABLED' => 'A DNS forwarder has been configured. This means that all DNS +lookups will be handled by the DNS forwarder. Hostnames +and addresses cannot be modified on this server while +a DNS forwarder is configured.', +'hos_ADD_HOSTNAME' => 'Add hostname', +'hos_HOSTNAME' => 'Hostname', +'hos_HOSTTYPE' => 'Location', +'hos_LOCAL_IP' => 'Local IP', +'hos_ETHERNET_ADDRESS' => 'Ethernet address', +'hos_CURRENT_HOSTNAMES_FOR_DOMAIN' => 'Current list of hostnames for [_1].', +'hos_NO_HOSTNAMES_FOR_SERVICENAME' => 'There are no hostnames in the system for [_1].', +'hos_CURRENT_HOSTNAMES_FOR_LOCAL_DOMAIN' => 'Current list of hostnames for [_1]', +'hos_NO_HOSTNAMES_FOR_LOCAL_DOMAIN' => 'There are no hostnames in the system for [_1].', +'hos_STATIC_HOST_MESSAGE' => '- This host represents your system name and cannot be modifiedor removed.', +'hos_CREATE_LOCAL_HOST_TITLE' => 'Create a new hostname for this server', +'hos_HOSTNAME_VALIDATION_ERROR' => 'Error: unexpected characters in host name: "[_1]". +The host name should contain only +letters, numbers, and hyphens and must start +with a letter or a number.', +'hos_HOSTNAME_LENGTH_ERROR' => 'Error: account name [_1] is too long. The +maximum is 32 characters.', +'hos_DOMAIN_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name +[_1]. The domain name should contain one or more +letters, numbers, periods and minus signs. Did not create new +domain.', +'hos_HOSTNAME_EXISTS_ERROR' => 'Error: account [_1] hostname.', +'hos_SUCCESSFULLY_CREATED' => 'Successfully created hostname.', +'hos_HOSTNAME_DESCRIPTION' => 'The hostname must contain only letters, numbers, and hyphens, and must start with a letter or number. ', +'hos_LOCAL_IP_DESCRIPTION' => 'The Local IP address is the IP address of another machine on +the local network. Please enter a valid IP address in the +format "aaa.bbb.ccc.ddd".', +'hos_ETHERNET_ADDRESS_DESCRIPTION' => 'The ethernet address is optional and causes the DHCP server to +statically bind the local IP address to the computer with this +ethernet address.If specified, it must be of the form +"AA:BB:CC:DD:EE:FF" and must contain only the numbers 0-9 and +the letters A-F.', +'hos_CREATE_LOCAL_HOST_TITLE' => 'Create a new hostname referring to a local host.', +'hos_DIDNT_ENTER_LOCAL_IP' => 'Error: You did not specify a Local IP address.IP +addresses must contain only numbers and periods and +be in the form "aaa.bbb.ccc.ddd".Did not create hostname.', +'hos_IP_VALIDATION_ERROR' => 'Error: IP Address [_1] is +invalid. IP Addresses must contain only numbers and periodsand be in the form "aaa.bbb.ccc.ddd". Did not create hostname.', +'hos_MAC_ADDRESS_VALIDATION_ERROR' => 'Error: Ethernet address [_1] +is invalid.Ethernet addresses must be in the +form "AA:BB:CC:DD:EE:FF" and only contain the +numbers 0-9 and the letters A-F. Did not create +hostname.', +'hos_CREATE_REMOTE_HOST_TITLE' => 'Create a new hostname referring to a remote host', +'hos_CREATE_TITLE' => 'Create or modify hostname', +'hos_MODIFY_TITLE' => 'Modify hostname', +'hos_LOCAL_PAGE_DESCRIPTION' => 'Please enter the following additional details for a localhost:', +'hos_REMOTE_PAGE_DESCRIPTION' => 'Please enter the following additional details for a remotehost:', +'hos_SUCCESSFULLY_DELETED' => 'Successfully deleted host.', +'hos_SUCCESSFULLY_MODIFIED' => 'Successfully modified host.', +'hos_REMOVE_TITLE' => 'Remove hostname', +'hos_REMOVE_PAGE_DESCRIPTION' => 'You are about to remove the hostname "[_1]"', +'hos_ABOUT_TO_REMOVE' => 'Are you sure you wish to remove this hostname?', +'hos_CONFIRM_DESCRIPTION' => 'Please confirm the following details.', +'hos_NO_HOSTS_FOR_THIS_DOMAIN' => 'There are no hosts for this domain.', +'hos_ADDR_IN_DHCP_RANGE' => 'Address is inside the DHCP assigned dynamic range', +'hos_ERROR_WHILE_CREATING_HOST' => 'Error occurred while creating hostname.', +'hos_ERROR_WHILE_MODIFYING_HOST' => 'Error occurred while modifying hostname.', +'hos_ERROR_WHILE_DELETING_HOST' => 'Error occurred while deleting hostname.', +'hos_ERR_IP_IS_LOCAL_OR_GATEWAY' => 'Error: IP cannot be server IP or Gateway IP.', +'hos_ERR_IP_NOT_LOCAL' => 'Error: This IP address is not on any of our local networks.', +'hos_MUST_BE_VALID_HOSTNAME_OR_IP' => 'Must be a valid hostname or IP number', +'hos_HOSTNAME_COMMENT_ERROR' => 'Error: unexpected characters in the comment of "[_1]". +The comment must contain only letters, spaces, numbers, dots, commas, undescores, hyphens and must start with a letter or number.', +'hos_HOSTNAME_VALIDATOR_ERROR' => 'Error: unexpected characters in host name: "[_1]". The host name should contain only +letters, numbers, and hyphens and must start with a letter or a number. ', + +'log_View log files' => 'View log files', +'log_FIRSTPAGE_DESC' => 'This panel allows you to view or download the log files generated +by the services running on your server.', +'log_LOG_FILE_SELECT_DESC' => 'Choose a log file to view', +'log_FILTER_PATTERN_DESC' => 'You may optionally specify a filter pattern to display only the +lines from the log file which match this pattern.If you leave +this field blank, all available lines of the log file will be +displayed. Note that this option is not used if you download the +logfile.', +'log_FILTER_PATTERN_LABEL' => 'Filter Pattern (optional)', +'log_MATCH_PATTERN_DESC' => 'You may also optionally specify a highlight pattern to mark in bold +any lines from the log file which match the highlight pattern. The +highlight pattern is applied to any lines which have already +matched the filter pattern. Note that this option is not used if +you download the logfile.', +'log_MATCH_PATTERN_LABEL' => 'Highlight Pattern (optional)', +'log_END_DESC' => 'Please note that it may take quite some time to generate these +reports.', +'log_VIEW' => 'View log file', +'log_LOG_FILE_EMPTY' => 'Log file "[_1]" is empty!', +'log_VIEWING_TIME' => 'Viewed at [_1].', +'log_MATCH_HEADER' => 'Displaying lines matching: "[_1]".', +'log_HIGHLIGHT_HEADER' => 'Highlighting lines matching: "[_1]".', +'log_NO_MATCHING_LINES' => 'No matching lines displayed.', +'log_FILENAME_ERROR' => '

Error while specifying log file name.

+

Invalid report type "[_1]".

', +'log_REFRESH' => 'Refresh this logfile', +'log_OP_DESC' => 'You must choose between viewing the logfile in your browser, or +downloading the logfile to your computer. If the logfile is +particularly large, you may wish to download it instead of +attempting to open it in your browser, as this is a problem for +some web browsers.', +'log_OP_LABEL' => 'Operation', +'log_DOWNLOAD_PAGE_DESC' => 'Your logfile download is now prepared. It will proceed as soon +as you click on the "Next" button below, and instruct +your browser to accept the download via the pop-up window that +will appear.', +'log_DOWNLOAD_FILE' => 'Preparing to download the logfile [_1].', + ); diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Navigation.pm smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Navigation.pm --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Navigation.pm 2020-01-23 12:35:27.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Navigation.pm 1970-01-01 04:00:00.000000000 +0400 @@ -1,352 +0,0 @@ -#!/usr/bin/perl -wT - -package SrvMngr::Navigation; - -use strict; -use warnings; - -use esmith::cgi; -use esmith::config; -use esmith::NavigationDB; -use esmith::util; -use esmith::I18N; - -esmith::util::setRealToEffective (); - -# Use the one script for navigation and noframes -my $NO_FRAMES = ($0 =~ /noframes/); - - -#------------------------------------------------------ -# subroutine to determine which group a user belongs to -#------------------------------------------------------ - -sub determineGroup -{ - my ($user) = shift; - - # Group file for authentication - my $group_file = '/etc/group'; - open ( GF, $group_file ) - or die "Cannot open group file: $group_file: $!\n"; - - # list of groups this user belongs to - my @groupList; - while () - { - if (/[:,]$user\b/) - { - my ($groupName, undef) = split(/:/); - push @groupList, $groupName; - } - } - close GF; - return @groupList; -} - -#------------------------------------------------------------ -# subroutine to display navigation bar -#------------------------------------------------------------ - -sub showNavigation () -{ - my $q = shift; - #my $c = shift; - my $config = shift; - - my $navig_script = "themes/".$config->{theme}."/public/js/navigation.js"; - my $navig_div = "themes/".$config->{theme}."/templates/partials/_navig.html.ep"; - - my $navigation = ""; - - # Use this variable throughout to keep track of files - # list of just the files - my $c = "1"; - my @files = (); - my %files_hash = (); - my @panel_group = "admin"; -# my @panel_group = $ENV{'REMOTE_USER'} eq "admin" ? -# ("admin") : determineGroup($ENV{'REMOTE_USER'}); - - #----------------------------------------------------- - # Determine the directory where the functions are kept - #----------------------------------------------------- - - my $navigation_ignore = - "(\.\.?|navigation|noframes|online-manual|(internal|pleasewait)(-.*)?)"; - - my $cgidir = 'nowhere'; - if ($panel_group[0] eq 'admin') - { - $cgidir = '/etc/e-smith/web/panels/manager/cgi-bin/'; - - if (opendir (DIR, $cgidir)) - { - @files = grep (!/^${navigation_ignore}$/, - readdir (DIR)); - closedir (DIR); - } - else - { - warn "Can't open directory $cgidir\n"; - } - - foreach my $file (@files) - { - next if (-d "$cgidir/$file"); - $files_hash{$file} = $cgidir; - } - - } - else - { - foreach my $panel (@panel_group) - { - $cgidir = "/etc/e-smith/web/panels/manager/$panel/cgi-bin"; - - if (opendir (DIR, $cgidir)) - { - @files = grep (!/^${navigation_ignore}$/, - readdir (DIR)); - closedir (DIR); - foreach my $file (@files) - { - next if (-d "$cgidir/$file"); - $files_hash{$file} = $cgidir; - } - } - else - { - warn "Can't open directory $cgidir\n"; - } - } - } - - #-------------------------------------------------- - # For each script, extract the description and category - # information. Build up an associative array mapping headings - # to heading structures. Each heading structure contains the - # total weight for the heading, the number of times the heading - # has been encountered, and another associative array mapping - # descriptions to description structures. Each description - # structure contains the filename of the particular cgi script - # and a weight. - #-------------------------------------------------- - my %nav = (); - - use constant NAVIGATIONDIR => '/home/e-smith/db/navigation'; - use constant WEBFUNCTIONS => '/etc/e-smith/web/functions'; - - my $i18n = new esmith::I18N; - - my $language = $i18n->preferredLanguage( $ENV{HTTP_ACCEPT_LANGUAGE} ); - - my $navinfo = NAVIGATIONDIR . "/navigation.$language"; - - my $navdb = esmith::NavigationDB->open_ro( $navinfo ) or - die "Couldn't open $navinfo\n"; - - # Check the navdb for anything with a UrlPath, which means that it doesn't - # have a cgi file to be picked up by the above code. Ideally, only pages - # that exist should be in the db, but that's not the case. Anything - # without a cgi file will have to remove themselves on uninstall from the - # navigation dbs. - foreach my $rec ($navdb->get_all) - { - if ($rec->prop('UrlPath')) - { - $files_hash{$rec->{key}} = $cgidir; - } - } - - foreach my $file (keys %files_hash) - { - my $heading = 'Unknown'; - my $description = $file; - my $headingWeight = 99999; - my $descriptionWeight = 99999; - my $urlpath = ''; - - my $rec = $navdb->get($file); - - if (defined $rec) - { - $heading = $rec->prop('Heading'); - $description = $rec->prop('Description'); - $headingWeight = $rec->prop('HeadingWeight'); - $descriptionWeight = $rec->prop('DescriptionWeight'); - $urlpath = $rec->prop('UrlPath') || ''; - } - - #-------------------------------------------------- - # add heading, description and weight information to data structure - #-------------------------------------------------- - - unless (exists $nav {$heading}) - { - $nav {$heading} = { COUNT => 0, WEIGHT => 0, DESCRIPTIONS => [] }; - } - - $nav {$heading} {'COUNT'} ++; - $nav {$heading} {'WEIGHT'} += $headingWeight; - - # Check for manager panel, and assign the appropriate - # cgi-bin prefix for the links. - # Grab the last 2 directories by splitting for '/'s and - # then concatenating the last 2 - # probably a better way, but I don't know it. - my @filename = split /\//, $files_hash{$file}; - - #### mabmodif new version of module exists - my $path = (SrvMngr->get_mod_url($file) ne '-1') ? - "2" : - ###### mabmodif - ($cgidir eq '/etc/e-smith/web/panels/manager/cgi-bin/') ? - "/$filename[scalar @filename - 1]" : - "/$filename[scalar @filename - 2]/$filename[scalar @filename - 1]"; - push @{ $nav {$heading} {'DESCRIPTIONS'} }, - { DESCRIPTION => $description, - WEIGHT => $descriptionWeight, - FILENAME => $urlpath ? $urlpath : "$path/$file", - CGIPATH => $path - }; - } - - #-------------------------------------------------- - # generate list of headings sorted by average weight - #-------------------------------------------------- - - # - # generate script .js - # - open(SCR, "> $navig_script") - or die "access file error: \'$navig_script\'\n$!"; - - printf SCR ' - // - // Do N O T modify this file : it is automatically generated ! - // - //This swap the class of the selected item. - function swapClass() { - var i,x,tB,j=0,tA=new Array(),arg=swapClass.arguments; - if(document.getElementsByTagName){for(i=4;i - "; - - close SCR; - - # - # generate navigation div part - # - - open(DIV, "> $navig_div") - or die "access file error: \'$navig_div\'\n$!"; - - # enable utf8 binmode so new translations work - binmode DIV, ":utf8"; - - printf DIV ""; - - #printf DIV ""; - close DIV -} - -1; diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/script/srvmngr.pl smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/script/srvmngr.pl --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/script/srvmngr.pl 2020-01-27 12:03:33.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/script/srvmngr.pl 2020-02-19 22:43:47.778000000 +0400 @@ -25,7 +25,7 @@ use SrvMngr::I18N; my $locale = plugin I18N => {namespace => 'SrvMngr::I18N', default => 'en'}; - +#my $locale = plugin I18N => {namespace => 'SrvMngr::I18N'}; my $VERSION = '0.0.1'; #app->mode('production'); @@ -63,11 +63,23 @@ $r->get('/clamav')->to('clamav#main')->name('clamav'); $r->post('/clamav')->to('clamav#do_update')->name('clamav2'); + $r->get('/datetime')->to('datetime#main')->name('datetime'); $r->post('/datetime')->to('datetime#do_update')->name('datetime2'); + $r->get('/directory')->to('directory#main')->name('directory'); $r->post('/directory')->to('directory#do_update')->name('directory2'); +$r->get('/domains')->to('domains#main')->name('domains'); +$r->post('/domains')->to('domains#do_display')->name('domainadd1'); +$r->post('/domainadd')->to('domains#do_update')->name('domainadd2'); +$r->get('/domainupd')->to('domains#do_display')->name('domainupd1'); +$r->post('/domainupd')->to('domains#do_update')->name('domainupd2'); +$r->get('/domaindel')->to('domains#do_display')->name('domaindel1'); +$r->post('/domaindel')->to('domains#do_update')->name('domaindel2'); +$r->get('/domainup2')->to('domains#do_display')->name('domainup21'); +$r->post('/domainup2')->to('domains#do_update')->name('domainup22'); + $r->get('/groups')->to('groups#main')->name('groups'); $r->post('/groups')->to('groups#do_display')->name('groupadd1'); $r->post('/groupadd')->to('groups#do_update')->name('groupadd2'); @@ -76,6 +88,11 @@ $r->get('/groupdel')->to('groups#do_display')->name('groupdel1'); $r->post('/groupdel')->to('groups#do_update')->name('groupdel2'); +$r->get('/hostentries')->to('hostentries#main')->name('hostentries'); +$r->post('/hostentries')->to('hostentries#do_display')->name('hostentryadd'); +$r->get('/hostentryd')->to('hostentries#do_display')->name('hostentrydis'); +$r->post('/hostentryd')->to('hostentries#do_update')->name('hostentryupd'); + $r->get('/ibays')->to('ibays#main')->name('ibays'); $r->post('/ibays')->to('ibays#do_display')->name('ibayadd'); $r->get('/ibayd')->to('ibays#do_display')->name('ibaydis'); @@ -95,6 +112,15 @@ $r->get('/proxy')->to('proxy#main')->name('proxy'); $r->post('/proxy')->to('proxy#do_update')->name('proxy2'); + +$r->get('/pseudonyms')->to('pseudonyms#main')->name('pseudonyms'); +$r->post('/pseudonyms')->to('pseudonyms#do_display')->name('pseudoadd1'); +$r->post('/pseudoadd')->to('pseudonyms#do_update')->name('pseudoadd2'); +$r->get('/pseudoupd')->to('pseudonyms#do_display')->name('pseudoupd1'); +$r->post('/pseudoupd')->to('pseudonyms#do_update')->name('pseudoupd2'); +$r->get('/pseudodel')->to('pseudonyms#do_display')->name('pseudodel1'); +$r->post('/pseudodel')->to('pseudonyms#do_update')->name('pseudodel2'); + $r->get('/qmailanalog')->to('qmailanalog#main')->name('qmailanalog'); $r->post('/qmailanalog')->to('qmailanalog#do_update')->name('qmailanalog2'); @@ -111,14 +137,20 @@ $r->post('/starterwebsite')->to('starterwebsite#do_site')->name('starterwebsite2'); $r->get('/support')->to('support#main')->name('support'); $r->post('/swttheme')->to('swttheme#main')->name('swttheme'); + +$r->get('/viewlogfiles')->to('viewlogfiles#main')->name('viewlogfiles'); +$r->post('/viewlogfiles')->to('viewlogfiles#do_action')->name('viewlogfiles2'); + $r->get('/wbl')->to('wbl#main')->name('wbl'); $r->post('/wbl')->to('wbl#do_display')->name('wbldis'); $r->post('/wbl2')->to('wbl#do_update')->name('wblupd'); + $r->get('/welcome')->to('welcome#main')->name('welcome'); $r->get('/workgroup')->to('workgroup#main')->name('workgroup'); $r->post('/workgroup')->to('workgroup#do_update')->name('workgroup2'); -$r->get('/getconfig/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getconfig')->name('getrequest'); -$r->get('/getaccount/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getaccount')->name('getaccount'); + +$r->get('/config/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getconfig')->name('getconfig'); +$r->get('/account/:key' => {key => qr/[a-z0-9]{2,32}/})->to('request#getaccount')->name('getaccount'); $r->get('/:module' => {module => qr/[a-z0-9]{2,32}/})->to('modsearch#main')->name('module_search'); #my $mod = any('/modules')->to('modules#default'); #$mod->get('/:module' => {module => qr/[a-z0-9]{2,32}/})->to('#mod_search')->name('module_search2'); diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/css/styles.css smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/css/styles.css --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/css/styles.css 2020-01-20 21:09:46.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/css/styles.css 2020-02-19 22:44:47.000000000 +0400 @@ -24,13 +24,6 @@ padding: 10px; } -label.field-with-error { - color: #dd7e5e -} - -input.field-with-error { - background-color: #fd9e7e -} #central{ margin-left: 0px; @@ -74,6 +67,27 @@ position: fixed; margin-left: 40%; } +/* +label{ + display: inline-block; + float: left; + clear: left; + width: 200px; + text-align: right; +} +data2 { + display: inline-block; + float: left; +} +*/ + +label.field-with-error { + color: #dd7e5e +} + +input.field-with-error { + background-color: #fd9e7e +} span.label { font-weight: bold; @@ -161,10 +175,3 @@ width: 10%; text-align: center; } - - - -/*#h2e23 { - float: right; - width: 15%; -}*/ diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation2.js smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation2.js --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation2.js 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation2.js 2020-02-02 16:59:48.000000000 +0400 @@ -0,0 +1,5 @@ + + //This swap the class of the selected item. (navigation2 to be done) +// function swapClass() { +// function swapClasses() { + // End script hiding --> diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation.js smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation.js --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation.js 2020-01-22 15:34:30.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/public/js/navigation.js 1970-01-01 04:00:00.000000000 +0400 @@ -1,29 +0,0 @@ - - // - // Do N O T modify this file : it is automatically generated ! - // - //This swap the class of the selected item. - function swapClass() { - var i,x,tB,j=0,tA=new Array(),arg=swapClass.arguments; - if(document.getElementsByTagName){for(i=4;i - \ Pas de fin de ligne à la fin du fichier diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/domains.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/domains.html.ep --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/domains.html.ep 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/domains.html.ep 2020-02-06 22:27:13.000000000 +0400 @@ -0,0 +1,36 @@ +% layout 'default', title => "Sme server 2 - domains", share_dir => './'; + +% content_for 'module' => begin +
+ + % if ($config->{debug} == 1) { +

+ %= dumper $c->current_route + %= dumper $dom_datas +

+ % } + +

<%= $title%>

+ + % if ( $notif ) { +
+ + %= $notif + + %} + + + % if ($dom_datas->{trt} eq 'ADD') { + %= include 'partials/_dom_upd' + %} elsif ($dom_datas->{trt} eq 'DEL') { + %= include 'partials/_dom_del' + %} elsif ($dom_datas->{trt} eq 'UPD') { + %= include 'partials/_dom_upd' + %} elsif ($dom_datas->{trt} eq 'UP2') { + %= include 'partials/_dom_up2' + %} else { + %= include 'partials/_dom_list' + %} + +
+%end diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/hostentries.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/hostentries.html.ep --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/hostentries.html.ep 1970-01-01 04:00:00.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/hostentries.html.ep 2020-02-10 12:23:31.000000000 +0400 @@ -0,0 +1,35 @@ +% layout 'default', title => "Sme server 2 - hostentries", share_dir => './'; + +% content_for 'module' => begin +
+ + % if ($config->{debug} == 1) { +

+ %= dumper $c->current_route + %= dumper $hos_datas +

+ % } + +

<%= $title%>

+ + % if ( $notif ) { +
+ + <%= $c->render_to_string(inline => $notif) %> + + %} + + % if ($hos_datas->{trt} eq 'ADD' or $hos_datas->{trt} eq 'UPD') { + %= include 'partials/_hos_upd' + %} elsif ($hos_datas->{trt} eq 'DEL') { + %= include 'partials/_hos_del' + %} elsif ( $hos_datas->{trt} eq 'ALC' or $hos_datas->{trt} eq 'ULC') { + %= include 'partials/_hos_ulc' + %} elsif ( $hos_datas->{trt} eq 'ARM' or $hos_datas->{trt} eq 'URM') { + %= include 'partials/_hos_urm' + %} else { + %= include 'partials/_hos_list' + %} + +
+%end diff -urN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/layouts/default.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/layouts/default.html.ep --- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/layouts/default.html.ep 2020-01-27 13:21:56.000000000 +0400 +++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/layouts/default.html.ep 2020-02-05 20:31:06.000000000 +0400 @@ -7,16 +7,17 @@ <%= $title %> - - - - + %= stylesheet 'css/sme_core.css' + %= stylesheet 'css/sme_main.css' + + %= stylesheet 'css/styles.css' %= include 'partials/_head' % if ( not defined $c->session->{lang} ) { % SrvMngr::init_session_cgi ( $c ); +
INIT_SESSION_CGI
% }