28
29
use Bugzilla::Constants;
29
use Bugzilla::Config qw(:DEFAULT :admin :params $datadir);
30
use Bugzilla::Config qw(:admin);
30
31
use Bugzilla::Config::Common;
31
34
use Bugzilla::Token;
34
use vars qw(@parampanels);
36
use Bugzilla::User::Setting;
36
38
my $user = Bugzilla->login(LOGIN_REQUIRED);
37
39
my $cgi = Bugzilla->cgi;
51
53
$current_panel =~ /^([A-Za-z0-9_-]+)$/;
52
54
$current_panel = $1;
56
56
my $current_module;
58
foreach my $panel (@parampanels) {
59
next if ($panel eq 'Common');
60
require "Bugzilla/Config/$panel.pm";
61
my @module_param_list = "Bugzilla::Config::${panel}"->get_param_list();
58
foreach my $panel (Bugzilla::Config::param_panels()) {
59
eval("require Bugzilla::Config::$panel") || die $@;
60
my @module_param_list = "Bugzilla::Config::${panel}"->get_param_list(1);
62
61
my $item = { name => lc($panel),
63
62
current => ($current_panel eq lc($panel)) ? 1 : 0,
64
63
param_list => \@module_param_list,
73
72
if ($action eq 'save' && $current_module) {
74
73
check_token_data($token, 'edit_parameters');
76
my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list();
75
my @module_param_list = "Bugzilla::Config::${current_module}"->get_param_list(1);
77
my $update_lang_user_pref = 0;
78
78
foreach my $i (@module_param_list) {
79
79
my $name = $i->{'name'};
80
80
my $value = $cgi->param($name);
120
120
ThrowUserError('invalid_parameter', { name => $name, err => $ok });
122
} elsif ($name eq 'globalwatchers') {
123
# can't check this as others, as Bugzilla::Config::Common
124
# can not use Bugzilla::User
125
foreach my $watcher (split(/[,\s]+/, $value)) {
128
{ name => $name, err => "no such user $watcher" }
129
) unless login_to_id($watcher);
123
132
push(@changes, $name);
124
133
SetParam($name, $value);
125
134
if (($name eq "shutdownhtml") && ($value ne "")) {
126
135
$vars->{'shutdown_is_active'} = 1;
137
if ($name eq 'languages') {
138
$update_lang_user_pref = 1;
142
if ($update_lang_user_pref) {
143
# We have to update the list of languages users can choose.
144
# If some users have selected a language which is no longer available,
145
# then we delete it (the user pref is reset to the default one).
146
my @languages = split(/[\s,]+/, Bugzilla->params->{'languages'});
147
map {trick_taint($_)} @languages;
148
my $lang = Bugzilla->params->{'defaultlanguage'};
150
add_setting('lang', \@languages, $lang, undef, 1);
130
153
$vars->{'message'} = 'parameters_updated';
131
154
$vars->{'param_changed'} = \@changes;
134
unlink "$datadir/versioncache";
135
157
delete_token($token);