- If Environment variable EZMLM_WEB_RC ist set (e.g. at webservers vhost
configuration), the applicatiom loads ezmlmwebrc from that setting. That allows multiple Webinterfaces on the same host with different settings. - Subscribition of different adresses at once via textarea input (Closes #70) TODO: change concerning labels for language other than german or english - Fix setting of chaerset variable (Close #69 ?) - Fix en-/decoding (if system charset differs from charset of list) - Handling of all text files will be done from the list directory, even if the defaults are used.That makes the list robust against changing server default settings or moving list from one to another server. - conf-lang file will always be written, even if language is the default one. So users can see their language setting from the Options screen. - Print available listdomains in alphabetical order. - trailer is no longer editable from the Overview screen. Changing trailer can be done - like other textfiles - from the text screen. - Add configuration variable DEBUG. If enabled, application prints Error/Warning messages instead of "Internal Server Error" page.
This commit is contained in:
parent
ca7ade45b8
commit
6989ec1205
1 changed files with 97 additions and 33 deletions
|
@ -58,7 +58,7 @@ $VERSION = '0.08.2';
|
||||||
require 5.005;
|
require 5.005;
|
||||||
|
|
||||||
# == Begin site dependant variables ==
|
# == Begin site dependant variables ==
|
||||||
$EZMLM_BASE = '/usr/local/bin'; #Autoinserted by Makefile.PL
|
$EZMLM_BASE = '/usr/local/bin/ezmlm'; #Autoinserted by Makefile.PL
|
||||||
$QMAIL_BASE = '/var/qmail'; #Autoinserted by Makefile.PL
|
$QMAIL_BASE = '/var/qmail'; #Autoinserted by Makefile.PL
|
||||||
$MYSQL_BASE = ''; #Autoinserted by Makefile.PL
|
$MYSQL_BASE = ''; #Autoinserted by Makefile.PL
|
||||||
# == End site dependant variables ==
|
# == End site dependant variables ==
|
||||||
|
@ -537,13 +537,49 @@ sub get_lang {
|
||||||
# return without error for idx < 5.0
|
# return without error for idx < 5.0
|
||||||
sub set_lang {
|
sub set_lang {
|
||||||
my ($self, $lang) = @_;
|
my ($self, $lang) = @_;
|
||||||
|
|
||||||
return (0==0) if (get_version() < 5);
|
return (0==0) if (get_version() < 5);
|
||||||
|
|
||||||
|
my ($old_lang);
|
||||||
|
$old_lang = $self->get_lang();
|
||||||
|
|
||||||
|
# users doesn't know about default (server) settings. Setting language explizit,
|
||||||
|
# they can see the language settings at the web-interface
|
||||||
if (($lang eq 'default') || ($lang eq '')) {
|
if (($lang eq 'default') || ($lang eq '')) {
|
||||||
return 1 if (unlink "$self->{'LIST_NAME'}/conf-lang");
|
$lang = File::Basename::basename(Cwd::realpath($self->get_config_dir .'/default'));
|
||||||
} else {
|
|
||||||
return 1 if ($self->setpart('conf-lang', "$lang"));
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0 if (!$self->setpart('conf-lang', "$lang"));
|
||||||
|
|
||||||
|
# Nothing to do if language settings was not changed
|
||||||
|
if ($lang ne $old_lang) {
|
||||||
|
|
||||||
|
my $dir = "$self->{'LIST_NAME'}/text";
|
||||||
|
my $name;
|
||||||
|
opendir(DIR, $dir);
|
||||||
|
while (defined($name = readdir(DIR))) {
|
||||||
|
# untaint 'name'
|
||||||
|
$name =~ m/^(.*)$/;
|
||||||
|
$name = $1;
|
||||||
|
unlink("$dir/$name");
|
||||||
|
}
|
||||||
|
closedir (DIR);
|
||||||
|
|
||||||
|
# this copies all textfiles into DIR/text. So all textfiles will be
|
||||||
|
# handled from the list directory. That makes the list also
|
||||||
|
# robust against changing server default settings.
|
||||||
|
my (@files, $item);
|
||||||
|
@files = $self->get_available_text_files();
|
||||||
|
mkdir "$self->{'LIST_NAME'}/text" unless (-e "$self->{'LIST_NAME'}/text");
|
||||||
|
foreach $item (@files) {
|
||||||
|
# untaint 'item'
|
||||||
|
$item =~ m/^(.*)$/s;
|
||||||
|
$item = $1;
|
||||||
|
$self->setpart("text/$item", $self->get_text_default_content($item));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -632,10 +668,21 @@ sub get_text_content {
|
||||||
if (-e "$self->{'LIST_NAME'}/text/$textfile") {
|
if (-e "$self->{'LIST_NAME'}/text/$textfile") {
|
||||||
return $self->getpart("text/$textfile");
|
return $self->getpart("text/$textfile");
|
||||||
} elsif (get_version() >= 5) {
|
} elsif (get_version() >= 5) {
|
||||||
|
return $self->get_text_default_content("$textfile");
|
||||||
|
} else {
|
||||||
|
$self->_seterror(-1, "could not get the text file ($textfile)");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# == get text file default content
|
||||||
|
sub get_text_default_content {
|
||||||
|
my ($self, $textfile) = @_;
|
||||||
|
|
||||||
my $filename = $self->get_config_dir() . '/' . $self->get_lang() . "/text/$textfile";
|
my $filename = $self->get_config_dir() . '/' . $self->get_lang() . "/text/$textfile";
|
||||||
$filename = "/etc/ezmlm/default/$textfile" unless (-e "$filename");
|
$filename = "/etc/ezmlm/default/$textfile" unless (-e "$filename");
|
||||||
my @contents;
|
my ( @contents, $content );
|
||||||
my $content;
|
|
||||||
if (open(PART, "<$filename")) {
|
if (open(PART, "<$filename")) {
|
||||||
while(<PART>) {
|
while(<PART>) {
|
||||||
chomp($contents[$#contents++] = $_);
|
chomp($contents[$#contents++] = $_);
|
||||||
|
@ -651,10 +698,6 @@ sub get_text_content {
|
||||||
$self->_seterror($?, "could not open $filename");
|
$self->_seterror($?, "could not open $filename");
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$self->_seterror(-1, "could not get the text file ($textfile)");
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -668,20 +711,41 @@ sub set_text_content {
|
||||||
|
|
||||||
|
|
||||||
# == check if specified text file is customized or default (for idx >= 5.0) ==
|
# == check if specified text file is customized or default (for idx >= 5.0) ==
|
||||||
# return whether the text file exists in the list's directory (false) or not (true)
|
|
||||||
# empty filename returns false
|
|
||||||
sub is_text_default {
|
sub is_text_default {
|
||||||
my ($self, $textfile) = @_;
|
my ($self, $textfile) = @_;
|
||||||
return (0==1) if ($textfile eq '');
|
return (0==1) if ($textfile eq '');
|
||||||
if (-e "$self->{'LIST_NAME'}/text/$textfile") {
|
if (-e "$self->{'LIST_NAME'}/text/$textfile") {
|
||||||
|
my ($_path, $_content, @_contents);
|
||||||
|
$_path = $self->get_config_dir() . '/' . $self->get_lang() . "/text/$textfile";
|
||||||
|
$_path = "/etc/ezmlm/default/$textfile" unless (-e "$_path");
|
||||||
|
|
||||||
|
if (open(PART, "<$_path")) {
|
||||||
|
while(<PART>) {
|
||||||
|
unless ( /^#/ ) {
|
||||||
|
chomp($_contents[$#_contents++] = $_);
|
||||||
|
$_content .= $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_content .= "\n";
|
||||||
|
close PART;
|
||||||
|
} else {
|
||||||
|
$self->_seterror($?, "could not open $_path");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $self->getpart("text/$textfile") eq $_content ) {
|
||||||
|
return (0==0);
|
||||||
|
} else {
|
||||||
return (1==0);
|
return (1==0);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return (0==0);
|
return (0==0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# == remove non-default text file (for idx >= 5.0) ==
|
# == reset customized text file (for idx >= 5.0) ==
|
||||||
# return without error for idx < 5
|
# return without error for idx < 5
|
||||||
# otherwise: remove customized text file from the list's directory
|
# otherwise: remove customized text file from the list's directory
|
||||||
sub reset_text {
|
sub reset_text {
|
||||||
|
@ -690,9 +754,9 @@ sub reset_text {
|
||||||
return if ($textfile eq '');
|
return if ($textfile eq '');
|
||||||
return if ($textfile =~ /[^\w_\.-]/);
|
return if ($textfile =~ /[^\w_\.-]/);
|
||||||
return if ($self->is_text_default($textfile));
|
return if ($self->is_text_default($textfile));
|
||||||
($self->_seterror(-1, "could not remove customized text file ($textfile)") && return 0)
|
return 1 if ($self->setpart("text/$textfile", $self->get_text_default_content($textfile)));
|
||||||
unless unlink("$self->{'LIST_NAME'}/text/$textfile");
|
$self->_seterror(-1, "could not reset customized text file ($textfile)");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue