Compare commits

..

4 Commits

5 changed files with 146 additions and 108 deletions

View File

@@ -27,7 +27,14 @@ use SrvMngr::Model::Main;
use SrvMngr::Plugin::WithoutCache;
our $VERSION = '1.420';
#this is overwrittrn with the "release" by the spec file - release can be "99.el8.sme"
our $VERSION = '';
#Extract the release value
if ($VERSION =~ /^(\d+)/) {
$VERSION = $1; # $1 contains the matched numeric digits
} else {
$VERSION = '999' #No leading numeric digits found
}
$VERSION = eval $VERSION;
use Exporter 'import';

View File

@@ -57,12 +57,14 @@ sub do_display {
$mai_datas{'trt'} = $trt;
if ( $trt eq 'ACC' ) {
$dest = 'emailaccess';
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
}
if ( $trt eq 'ACC' )
{
$dest = 'emailaccess';
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
}
if ( $trt eq 'FIL' ) {
if ( $trt eq 'FIL' )
{
$dest = 'emailfilter';
$mai_datas{'virusstatus'} = $c->get_virus_status();
$mai_datas{'spamstatus'} = $cdb->get_prop('spamassassin', 'status');
@@ -72,9 +74,10 @@ sub do_display {
$mai_datas{spamsortspam} = $cdb->get_prop('spamassassin', 'SortSpam');
$mai_datas{spamsubjecttag} = $cdb->get_prop('spamassassin', 'SubjectTag');
$mai_datas{spamsubject} = $cdb->get_prop('spamassassin', 'Subject');
}
}
if ( $trt eq 'REC' ) {
if ( $trt eq 'REC' )
{
$dest = 'emailreceive';
$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method');
$mai_datas{freqoffice} = $cdb->get_prop('fetchmail', 'FreqOffice');
@@ -86,9 +89,10 @@ sub do_display {
$mai_datas{specifyheader} = get_secondary_mail_use_envelope();
$mai_datas{secondarymailenvelope} = $cdb->get_prop('fetchmail', 'SecondaryMailEnvelope');
}
}
if ( $trt eq 'DEL' ) {
if ( $trt eq 'DEL' )
{
$dest = 'emaildeliver';
$mai_datas{emailunknownuser} = $cdb->get_value('EmailUnknownUser') || '"returntosender';
$mai_datas{delegatemailserver} = $cdb->get_value('DelegateMailServer');
@@ -96,7 +100,7 @@ sub do_display {
$mai_datas{smtpauthproxystatus} = $cdb->get_prop('smtp-auth-proxy', 'status') || 'disabled';
$mai_datas{smtpauthproxyuserid} = $cdb->get_prop('smtp-auth-proxy', 'Userid') || '';
$mai_datas{smtpauthproxypassword} = $cdb->get_prop('smtp-auth-proxy', 'Passwd') || '';
}
}
$c->stash( title => $title, notif => $notif, mai_datas => \%mai_datas );
@@ -120,98 +124,107 @@ sub do_update {
my ($dest, $res, $result) = '';
if ( $trt eq 'ACC' ) {
if ( $trt eq 'ACC' )
{
$dest = 'emailaccess';
# $mai_datas{xxx} = $c->param('XXX');
# controls
# $res = xxxxxxx( $c );
# $result .= $res unless $res eq 'OK';
$dest = 'emailaccess';
# $mai_datas{xxx} = $c->param('XXX');
if ( ! $result )
{
$res = $c->change_settings_access();
$result .= $res unless $res eq 'OK';
if ( ! $result )
{
$result = $c->l('mai_SUCCESS');
}
}
}
# controls
# $res = xxxxxxx( $c );
# $result .= $res unless $res eq 'OK';
if ( $trt eq 'FIL' )
{
$dest = 'emailfilter';
# $mai_datas{xxx} = $c->param('XXX');
# controls
# $res = zzzzzz( $c );
# $result .= $res unless $res eq 'OK';
if ( ! $result ) {
$res = $c->change_settings_access();
$result .= $res unless $res eq 'OK';
if ( ! $result ) {
$result = $c->l('mai_SUCCESS');
}
}
}
if ( ! $result )
{
$res = $c->change_settings_filtering();
$result .= $res unless $res eq 'OK';
if ( ! $result )
{
$result = $c->l('mai_SUCCESS');
}
}
}
if ( $trt eq 'FIL' ) {
if ( $trt eq 'REC' )
{
$dest = 'emailreceive';
# $mai_datas{xxx} = $c->param('XXX');
# controls
# $res = yyyyyyyyy( $c );
# $result .= $res unless $res eq 'OK';
$dest = 'emailfilter';
# $mai_datas{xxx} = $c->param('XXX');
if ( ! $result )
{
$res = $c->change_settings_reception();
$result .= $res unless $res eq 'OK';
if ( ! $result )
{
$result = $c->l('mai_SUCCESS');
}
}
}
# controls
# $res = zzzzzz( $c );
# $result .= $res unless $res eq 'OK';
if ( $trt eq 'DEL' )
{
$dest = 'emaildeliver';
# $mai_datas{xxx} = $c->param('XXX');
# controls
$res = $c->ip_number_or_blank( $c->param('DelegateMailServer') );
$result .= $res . ' DMS <br>' unless $res eq 'OK';
if ( ! $result ) {
$res = $c->change_settings_filtering();
$result .= $res unless $res eq 'OK';
if ( ! $result ) {
$result = $c->l('mai_SUCCESS');
}
}
}
$res = $c->validate_smarthost( $c->param('SMTPSmartHost') );
$result .= $res . ' SH <br>' unless $res eq 'OK';
if ( $trt eq 'REC' ) {
$res = $c->nonblank_if_smtpauth( $c->param('SMTPSmartHost') );
$result .= $res . ' SH <br>' unless $res eq 'OK';
$dest = 'emailreceive';
# $mai_datas{xxx} = $c->param('XXX');
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Userid') );
$result .= $res . ' USR <br>' unless $res eq 'OK';
# controls
# $res = yyyyyyyyy( $c );
# $result .= $res unless $res eq 'OK';
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Passwd') );
$result .= $res . ' PWD <br>' unless $res eq 'OK';
if ( ! $result ) {
$res = $c->change_settings_reception();
$result .= $res unless $res eq 'OK';
if ( ! $result ) {
$result = $c->l('mai_SUCCESS');
}
}
}
if ( $trt eq 'DEL' ) {
$dest = 'emaildeliver';
# $mai_datas{xxx} = $c->param('XXX');
# controls
$res = $c->ip_number_or_blank( $c->param('DelegateMailServer') );
$result .= $res . ' DMS <br>' unless $res eq 'OK';
$res = $c->validate_smarthost( $c->param('SMTPSmartHost') );
$result .= $res . ' SH <br>' unless $res eq 'OK';
$res = $c->nonblank_if_smtpauth( $c->param('SMTPSmartHost') );
$result .= $res . ' SH <br>' unless $res eq 'OK';
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Userid') );
$result .= $res . ' USR <br>' unless $res eq 'OK';
$res = $c->nonblank_if_smtpauth( $c->param('SMTPAUTHPROXY_Passwd') );
$result .= $res . ' PWD <br>' unless $res eq 'OK';
if ( ! $result ) {
$res = $c->change_settings_delivery();
$result .= $res unless $res eq 'OK';
if ( ! $result ) {
$result = $c->l('mai_SUCCESS');
}
}
}
if ( ! $result )
{
$res = $c->change_settings_delivery();
$result .= $res unless $res eq 'OK';
if ( ! $result )
{
$result = $c->l('mai_SUCCESS');
}
}
}
# common part
if ($res ne 'OK') {
$c->stash( error => $result );
$c->stash( title => $title, mai_datas => \%mai_datas );
return $c->render( $dest );
}
if ($res ne 'OK')
{
$c->stash( error => $result );
$c->stash( title => $title, mai_datas => \%mai_datas );
return $c->render( $dest );
}
my $message = "emailsettings updates $trt DONE";
$c->app->log->info($message);
@@ -399,7 +412,7 @@ sub get_current_webmail_status {
my $MysqlStatus = $cdb->get_prop('mariadb', 'status') || 'disabled';
my $PHPStatus = $cdb->get_prop('php81', 'status') || 'disabled';
my $PHPStatus = $cdb->get_prop('php81-php-fpm', 'status') || 'disabled';
my $Networkaccess = $cdb->get_prop('roundcube','access') || 'disabled';
@@ -503,8 +516,7 @@ sub get_webmail_opt {
return [[ $c->l('DISABLED') => 'disabled' ],
[ $c->l('mai_ENABLED_SECURE_ONLY') => 'enabledSSL' ],
[ $c->l('mai_ONLY_LOCAL_NETWORK_SSL') => 'localnetworkSSL' ],
[ $c->l('mai_ENABLED_BOTH') => 'public' ]];
[ $c->l('mai_ONLY_LOCAL_NETWORK_SSL') => 'localnetworkSSL' ]];
}
@@ -515,10 +527,10 @@ sub get_webmail_options {
my %options = (
disabled => 'DISABLED',
enabledSSL => 'mai_ENABLED_SECURE_ONLY',
localnetworkSSL => 'mai_ONLY_LOCAL_NETWORK_SSL' );
enabledSSL => 'mai_ENABLED_SECURE_ONLY',
localnetworkSSL => 'mai_ONLY_LOCAL_NETWORK_SSL');
\%options;
return \%options;
}
@@ -654,6 +666,7 @@ sub display_multidrop {
sub change_settings_reception {
my $c = shift;
$cdb = esmith::ConfigDB->open || die "Couldn't open config db";
my $FetchmailMethod = ( $c->param('FetchmailMethod') || 'standard' );
@@ -720,6 +733,7 @@ sub change_settings_reception {
sub change_settings_delivery {
my ($c) = shift;
$cdb = esmith::ConfigDB->open || die "Couldn't open config db";
my $EmailUnknownUser = ($c->param('EmailUnknownUser') || 'returntosender');
@@ -748,7 +762,8 @@ sub change_settings_delivery {
sub change_settings_access {
my $c = shift;
$cdb = esmith::ConfigDB->open || die "Couldn't open config db";
my $pop3Access = ($c->param('POPAccess') || 'private');
if ($pop3Access eq 'disabled') {
$cdb->set_prop('pop3', "status", "disabled" );
@@ -798,21 +813,15 @@ sub change_settings_access {
#------------------------------------------------------------
my $webmail = ($c->param('WebMail') || 'disabled');
if ( $webmail eq "enabled" ) {
$cdb->set_prop('php81', "status", $webmail );
$cdb->set_prop('mariadb',"status", $webmail );
$cdb->set_prop('roundcube',"status", $webmail );
$cdb->set_prop('roundcube',"access", "public" );
}
elsif ( $webmail eq "enabledSSL" ) {
$cdb->set_prop('php81',"status", "enabled" );
if ( $webmail eq "enabledSSL" ) {
$cdb->set_prop('php81-php-fpm',"status", "enabled" );
$cdb->set_prop('mariadb',"status", "enabled" );
$cdb->set_prop('roundcube',"status", 'enabled' );
$cdb->set_prop('roundcube',"access", "public" );
}
elsif ( $webmail eq "localnetworkSSL" ) {
$cdb->set_prop('php81',"status", "enabled" );
$cdb->set_prop('php81-php-fpm',"status", "enabled" );
$cdb->set_prop('mariadb',"status", "enabled" );
$cdb->set_prop('roundcube',"status", 'enabled' );
$cdb->set_prop('roundcube',"access", "private" );
@@ -833,6 +842,8 @@ sub change_settings_access {
sub change_settings_filtering {
my $c = shift;
$cdb = esmith::ConfigDB->open || die "Couldn't open config db";
my $virus_status = ( $c->param('VirusStatus') || 'disabled' );
$cdb->set_prop("qpsmtpd", 'VirusScan', $virus_status);
@@ -846,7 +857,7 @@ sub change_settings_filtering {
Subject
SubjectTag) )
{
$cdb->set_prop('spamassassin', $param, $c->param("Spam$param"));
$cdb->set_prop('spamassassin', $param, $c->param("Spam$param"));
}
my $patterns_status = $c->adjust_patterns() ? 'enabled' : 'disabled';
@@ -854,7 +865,7 @@ sub change_settings_filtering {
unless ( system( "/sbin/e-smith/signal-event", "email-update" ) == 0 )
{
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
return $c->l('mai_ERROR_UPDATING_CONFIGURATION');
}
return 'OK';

View File

@@ -171,9 +171,11 @@ sub add_portforward {
#work out which protocol
my $fdb;
if ($proto eq 'TCP') {
$tcp_db = esmith::ConfigDB->open('portforward_tcp') || die "Can't open portforward_tcp database: $!\n";
$fdb = $tcp_db;
}
else {
$udp_db = esmith::ConfigDB->open('portforward_udp') || die "Can't open portforward_udp database: $!\n";
$fdb = $udp_db;
}
#Get the other values

View File

@@ -3,7 +3,7 @@
<a href="https://mojolicious.org" target="_blank"><img src="images/sme-mojo-logo-white.png" style="position:relative;"></a>
<font class="sme-copyright">
% if ( $c->is_logged_in ) {
SME Server <%= session 'releaseVersion' %> - Manager <%= $c->app->VERSION %>
SME Server <%= session 'releaseVersion' %>-<%= $c->app->VERSION %> Manager II
% }
<br>Copyright 1999-2006 Mitel Corporation<br>
%= session 'copyRight'

View File

@@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2
%define name smeserver-manager
Name: %{name}
%define version 11.0.0
%define release 20
%define release 24
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -49,6 +49,11 @@ This RPM contributes the navigation bars for the smeserver-manager. New Mojolici
%setup
%build
#extract the release number and drop it in to the version for SM2 footer.
sed -i "s/our \$VERSION = '[^']*'/our \$VERSION = '%{release}'/g" root/usr/share/smanager/lib/SrvMngr.pm
perl createlinks
# Force creation of potentially empty directories
@@ -108,6 +113,19 @@ true
%defattr(-,root,root)
%changelog
* Wed Oct 02 2024 Brian Read <brianr@koozali.org> 11.0.0-24.sme
- Messed up build - finger trouble [SME: 12753]
* Wed Oct 02 2024 Brian Read <brianr@koozali.org> 11.0.0-23.sme
- Add release number to footer [SME: 12753]
* Tue Sep 24 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-22.sme
- fix typos, and tidy tabs [SME: 12744]
* Mon Sep 23 2024 Brian Read <brianr@koozali.org> 11.0.0-21.sme
- Remove both option for webmail [SME: 12744]
- Add in re-open DB for portforwarding and email settings.
* Mon Sep 23 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-20.sme
- webmail switch panel to use roundcube [SME: 12742]
- prevent browser from caching [SME: 12695]