- 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);
|
||||||
if (($lang eq 'default') || ($lang eq '')) {
|
|
||||||
return 1 if (unlink "$self->{'LIST_NAME'}/conf-lang");
|
my ($old_lang);
|
||||||
} else {
|
$old_lang = $self->get_lang();
|
||||||
return 1 if ($self->setpart('conf-lang', "$lang"));
|
|
||||||
}
|
# users doesn't know about default (server) settings. Setting language explizit,
|
||||||
return 0;
|
# they can see the language settings at the web-interface
|
||||||
|
if (($lang eq 'default') || ($lang eq '')) {
|
||||||
|
$lang = File::Basename::basename(Cwd::realpath($self->get_config_dir .'/default'));
|
||||||
|
}
|
||||||
|
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,25 +668,7 @@ 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) {
|
||||||
my $filename = $self->get_config_dir() . '/' . $self->get_lang() . "/text/$textfile";
|
return $self->get_text_default_content("$textfile");
|
||||||
$filename = "/etc/ezmlm/default/$textfile" unless (-e "$filename");
|
|
||||||
my @contents;
|
|
||||||
my $content;
|
|
||||||
if (open(PART, "<$filename")) {
|
|
||||||
while(<PART>) {
|
|
||||||
chomp($contents[$#contents++] = $_);
|
|
||||||
$content .= $_;
|
|
||||||
}
|
|
||||||
close PART;
|
|
||||||
if(wantarray) {
|
|
||||||
return @contents;
|
|
||||||
} else {
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$self->_seterror($?, "could not open $filename");
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$self->_seterror(-1, "could not get the text file ($textfile)");
|
$self->_seterror(-1, "could not get the text file ($textfile)");
|
||||||
return undef;
|
return undef;
|
||||||
|
@ -658,6 +676,31 @@ sub get_text_content {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# == get text file default content
|
||||||
|
sub get_text_default_content {
|
||||||
|
my ($self, $textfile) = @_;
|
||||||
|
|
||||||
|
my $filename = $self->get_config_dir() . '/' . $self->get_lang() . "/text/$textfile";
|
||||||
|
$filename = "/etc/ezmlm/default/$textfile" unless (-e "$filename");
|
||||||
|
my ( @contents, $content );
|
||||||
|
if (open(PART, "<$filename")) {
|
||||||
|
while(<PART>) {
|
||||||
|
chomp($contents[$#contents++] = $_);
|
||||||
|
$content .= $_;
|
||||||
|
}
|
||||||
|
close PART;
|
||||||
|
if(wantarray) {
|
||||||
|
return @contents;
|
||||||
|
} else {
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$self->_seterror($?, "could not open $filename");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# == set text file content ==
|
# == set text file content ==
|
||||||
sub set_text_content {
|
sub set_text_content {
|
||||||
my ($self, $textfile, @content) = @_;
|
my ($self, $textfile, @content) = @_;
|
||||||
|
@ -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") {
|
||||||
return (1==0);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
} 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