diff options
Diffstat (limited to 'userprefs.cgi')
-rwxr-xr-x | userprefs.cgi | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/userprefs.cgi b/userprefs.cgi index 342df065b..3331d5b91 100755 --- a/userprefs.cgi +++ b/userprefs.cgi @@ -20,6 +20,7 @@ # Christopher Aillon <christopher@aillon.com> # Gervase Markham <gerv@gerv.net> # Vlad Dascalu <jocuri@softhome.net> +# Shane H. W. Travis <travis@sedsystems.ca> use strict; @@ -139,6 +140,39 @@ sub SaveAccount { } +sub DoSettings { + $vars->{'settings'} = Bugzilla->user->settings; + + my @setting_list = keys %{Bugzilla->user->settings}; + $vars->{'setting_names'} = \@setting_list; +} + +sub SaveSettings { + my $cgi = Bugzilla->cgi; + + my $settings = Bugzilla->user->settings; + my @setting_list = keys %{Bugzilla->user->settings}; + + foreach my $name (@setting_list) { + next if ! ($settings->{$name}->{'is_enabled'}); + my $value = $cgi->param($name); + + # de-taint the value. + if ($value =~ /^([-\w]+)$/ ) { + $value = $1; + } + if ($value eq "${name}-isdefault" ) { + if (! $settings->{$name}->{'is_default'}) { + $settings->{$name}->reset_to_default; + } + } + else { + $settings->{$name}->set($value); + } + } + $vars->{'settings'} = Bugzilla->user->settings(1); +} + sub DoEmail { my $dbh = Bugzilla->dbh; @@ -367,6 +401,11 @@ SWITCH: for ($current_tab_name) { DoAccount(); last SWITCH; }; + /^settings$/ && do { + SaveSettings() if $cgi->param('dosave'); + DoSettings(); + last SWITCH; + }; /^email$/ && do { SaveEmail() if $cgi->param('dosave'); DoEmail(); |