mirror of
https://github.com/webmin/webmin.git
synced 2026-06-24 21:10:29 +01:00
Merge branch 'master' of github.com:webmin/webmin
This commit is contained in:
@@ -39,6 +39,11 @@ else {
|
||||
$uconfig{'umask'} = $in{'umask'};
|
||||
}
|
||||
|
||||
# Sort config file's keys alphabetically
|
||||
if (defined($in{'sortconfigs'})) {
|
||||
$uconfig{'sortconfigs'} = $in{'sortconfigs'};
|
||||
}
|
||||
|
||||
&lock_file($usermin_config);
|
||||
&write_file($usermin_config, \%uconfig);
|
||||
&unlock_file($usermin_config);
|
||||
|
||||
@@ -57,6 +57,10 @@ elsif ($preloads[0]->[0] eq "main" && $preloads[0]->[1] eq "web-lib-funcs.pl") {
|
||||
print &ui_table_row($text{'advanced_umask'},
|
||||
&ui_opt_textbox("umask", $uconfig{'umask'}, 5, $text{'default'}));
|
||||
|
||||
# Sort config file's keys alphabetically
|
||||
print &ui_table_row($text{'advanced_sortconfigs'},
|
||||
&ui_yesno_radio("sortconfigs", $uconfig{'sortconfigs'}));
|
||||
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ $main::read_file_cache_time{$realfile} = $st[9];
|
||||
return $rv;
|
||||
}
|
||||
|
||||
=head2 write_file(file, &hash, [join-char])
|
||||
=head2 write_file(file, &hash, [join-char], [sort])
|
||||
|
||||
Write out the contents of a hash as name=value lines. The parameters are :
|
||||
|
||||
@@ -137,6 +137,8 @@ Write out the contents of a hash as name=value lines. The parameters are :
|
||||
|
||||
=item join-char - If given, names and values are separated by this instead of =
|
||||
|
||||
=item sort - If given, passed hash reference will be sorted by its keys
|
||||
|
||||
=cut
|
||||
sub write_file
|
||||
{
|
||||
@@ -145,18 +147,27 @@ my $join = defined($_[2]) ? $_[2] : "=";
|
||||
my $realfile = &translate_filename($_[0]);
|
||||
&read_file($_[0], \%old, \@order);
|
||||
&open_tempfile(ARFILE, ">$_[0]");
|
||||
foreach $k (sort @order) {
|
||||
if (exists($_[1]->{$k})) {
|
||||
if ($_[3] || $gconfig{'sortconfigs'}) {
|
||||
foreach $k (sort keys %{$_[1]}) {
|
||||
(print ARFILE $k,$join,$_[1]->{$k},"\n") ||
|
||||
&error(&text("efilewrite", $realfile, $!));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
foreach $k (sort keys %{$_[1]}) {
|
||||
if (!exists($old{$k})) {
|
||||
(print ARFILE $k,$join,$_[1]->{$k},"\n") ||
|
||||
&error(&text("efilewrite", $realfile, $!));
|
||||
else {
|
||||
foreach $k (@order) {
|
||||
if (exists($_[1]->{$k})) {
|
||||
(print ARFILE $k,$join,$_[1]->{$k},"\n") ||
|
||||
&error(&text("efilewrite", $realfile, $!));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach $k (keys %{$_[1]}) {
|
||||
if (!exists($old{$k})) {
|
||||
(print ARFILE $k,$join,$_[1]->{$k},"\n") ||
|
||||
&error(&text("efilewrite", $realfile, $!));
|
||||
}
|
||||
}
|
||||
}
|
||||
&close_tempfile(ARFILE);
|
||||
if (defined($main::read_file_cache{$realfile})) {
|
||||
%{$main::read_file_cache{$realfile}} = %{$_[1]};
|
||||
@@ -8680,10 +8691,14 @@ sub nice_size
|
||||
{
|
||||
my ($bytes, $minimal, $decimal) = @_;
|
||||
&load_theme_library();
|
||||
if ($gconfig{'nicesizenobinary'} eq '1' && !defined($decimal)) {
|
||||
$decimal = 1;
|
||||
$_[2] = 1;
|
||||
}
|
||||
if (defined(&theme_nice_size) &&
|
||||
$main::header_content_type eq "text/html" &&
|
||||
$main::webmin_script_type eq "web") {
|
||||
return &theme_nice_size(@_);
|
||||
return &theme_nice_size($_[0], $_[1], $_[2]);
|
||||
}
|
||||
my ($decimal_units, $binary_units) = (1000, 1024);
|
||||
my $bytes_initial = $bytes;
|
||||
|
||||
@@ -72,6 +72,11 @@ foreach my $l (split(/\r?\n/, $in{'headers'})) {
|
||||
}
|
||||
$gconfig{'extra_headers'} = join("\t", @hl);
|
||||
|
||||
# Sort config file's keys alphabetically
|
||||
if (defined($in{'sortconfigs'})) {
|
||||
$gconfig{'sortconfigs'} = $in{'sortconfigs'};
|
||||
}
|
||||
|
||||
&lock_file("$config_directory/config");
|
||||
&write_file("$config_directory/config", \%gconfig);
|
||||
&unlock_file("$config_directory/config");
|
||||
|
||||
@@ -25,6 +25,7 @@ $in{'hostnamemode'} != 3 || $in{'hostnamedisplay'} =~ /^[a-z0-9\.\_\-]+$/i ||
|
||||
$gconfig{'hostnamedisplay'} = $in{'hostnamedisplay'};
|
||||
$gconfig{'feedback_to'} = $in{'feedback_def'} ? undef : $in{'feedback'};
|
||||
$gconfig{'nofeedbackcc'} = $in{'nofeedbackcc'};
|
||||
$gconfig{'nicesizenobinary'} = $in{'nicesizenobinary'};
|
||||
$gconfig{'dateformat'} = $in{'dateformat'};
|
||||
|
||||
$in{'width_def'} || $in{'width'} =~ /^\d+$/ || &error($text{'ui_ewidth'});
|
||||
|
||||
@@ -103,6 +103,11 @@ print &ui_table_row($text{'advanced_headers'},
|
||||
&ui_textarea("headers",
|
||||
join("\n", split(/\t/, $gconfig{'extra_headers'})), 5, 80));
|
||||
|
||||
# Sort config file's keys alphabetically
|
||||
print &ui_table_row($text{'advanced_sortconfigs'},
|
||||
&ui_yesno_radio("sortconfigs", $gconfig{'sortconfigs'}));
|
||||
|
||||
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ print &ui_table_row($text{'ui_feedbackmode'},
|
||||
[ [ 0, $text{'yes'} ], [ 1, $text{'ui_feednocc'} ],
|
||||
[ 2, $text{'no'} ] ]), undef, [ "valign=middle","valign=middle" ]);
|
||||
|
||||
print &ui_table_row($text{'ui_nice_size_type'},
|
||||
&ui_radio("nicesizenobinary", int($gconfig{'nicesizenobinary'}),
|
||||
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]), undef, [ "valign=middle","valign=middle" ]);
|
||||
|
||||
print &ui_table_row($text{'ui_dateformat'},
|
||||
&ui_select("dateformat", $gconfig{'dateformat'} || "dd/mon/yyyy",
|
||||
[ map { [ $_, $text{'ui_dateformat_'.$_} ] }
|
||||
|
||||
@@ -160,6 +160,7 @@ ui_err=Failed to save user interface options
|
||||
ui_ergb=Invalid hexidecimal color value for '$1'
|
||||
ui_feedback=Send feedback to
|
||||
ui_feedbackmode=Allow sending of feedback?
|
||||
ui_nice_size_type=Use binary units of measurement (KiB, MiB, GiB rather than KB, MB, GB)
|
||||
ui_feednocc=Only to address above
|
||||
ui_hostnamemode=Hostname to display in Webmin
|
||||
ui_hnm0=Real hostname
|
||||
@@ -890,6 +891,7 @@ advanced_redir0=Protocol, host, port and path
|
||||
advanced_listdir=List directories without an index file?
|
||||
advanced_headers=Extra HTTP headers
|
||||
advanced_eheader=Headers must be formatted like <tt>Header: Value</tt>
|
||||
advanced_sortconfigs=Save config files sorted by its keys?
|
||||
|
||||
syslog_errorlog=Webmin error log
|
||||
|
||||
|
||||
Reference in New Issue
Block a user