summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Config/Common.pm
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 /Bugzilla/Config/Common.pm
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
Diffstat (limited to 'Bugzilla/Config/Common.pm')
-rw-r--r--Bugzilla/Config/Common.pm8
1 files changed, 7 insertions, 1 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 "";
}