summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-08-21 04:05:43 +0200
committerlpsolit%gmail.com <>2007-08-21 04:05:43 +0200
commit5a1fdacb12095b417382c15186e5aaaec7eed3a1 (patch)
tree829ee3551e21d2272364de2bb83752605578ccca
parentc96f82df77c6135e81a7fb87cc18166f507e24e3 (diff)
downloadbugzilla-5a1fdacb12095b417382c15186e5aaaec7eed3a1.tar.gz
bugzilla-5a1fdacb12095b417382c15186e5aaaec7eed3a1.tar.xz
Bug 335354: editparams.cgi crashes when editing the 'languages' and 'defaultlanguage' parameters - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wurblzap, mkanat a=LpSolit
-rw-r--r--Bugzilla/Config/Common.pm8
-rw-r--r--Bugzilla/Install/Util.pm2
-rw-r--r--Bugzilla/Template.pm2
3 files changed, 9 insertions, 3 deletions
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 14406019d..8435b20a1 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -305,17 +305,23 @@ sub check_image_converter {
}
sub check_languages {
- my @languages = split /[,\s]+/, trim($_[0]);
+ my ($lang) = @_;
+ my @languages = split(/[,\s]+/, trim($lang));
if(!scalar(@languages)) {
return "You need to specify a language tag."
}
my $templatedir = bz_locations()->{'templatedir'};
+ my %lang_seen;
+ my @validated_languages;
foreach my $language (@languages) {
if( ! -d "$templatedir/$language/custom"
&& ! -d "$templatedir/$language/default") {
return "The template directory for $language does not exist";
}
+ push(@validated_languages, $language) unless $lang_seen{$language}++;
}
+ # Rebuild the list of language tags, avoiding duplicates.
+ $_[0] = join(', ', @validated_languages);
return "";
}
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm
index 931d9f1b5..9bab77a8a 100644
--- a/Bugzilla/Install/Util.pm
+++ b/Bugzilla/Install/Util.pm
@@ -127,7 +127,7 @@ sub template_include_path {
my @supported;
if (defined $params->{use_languages}) {
- @supported = $params->{use_languages};
+ @supported = @{$params->{use_languages}};
}
else {
my @dirs = glob(bz_locations()->{'templatedir'} . "/*");
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index ece959778..20fe83112 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -87,7 +87,7 @@ sub getTemplateIncludePath {
my $cache = Bugzilla->request_cache;
my $lang = $cache->{'language'} || "";
$cache->{"template_include_path_$lang"} ||= template_include_path({
- use_languages => trim(Bugzilla->params->{'languages'}),
+ use_languages => [split(/[\s,]+/, Bugzilla->params->{'languages'})],
only_language => $lang });
return $cache->{"template_include_path_$lang"};
}