mirror of
https://github.com/webmin/webmin.git
synced 2026-02-08 08:19:57 +00:00
Compare commits
9 Commits
2.105
...
dev/config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3885773f6e | ||
|
|
dc3ed53c43 | ||
|
|
24ca182b18 | ||
|
|
54c7856672 | ||
|
|
9b3fb73aea | ||
|
|
692c9cc5e1 | ||
|
|
62bcd25eb9 | ||
|
|
a6d23844ce | ||
|
|
a9cd02aa6d |
@@ -1,11 +1,5 @@
|
||||
## Changelog
|
||||
|
||||
#### 2.105 (November 09, 2023)
|
||||
* Fix param to read only headers [sourceforge.net/usermin-bugs#501](https://sourceforge.net/p/webadmin/usermin-bugs/501/)
|
||||
* Fix not to set `reuse` flag on initial Let's Encrypt request
|
||||
* Fix to correctly escape mail file names upon deletion
|
||||
* Fix index field in cache file in BIND DNS module
|
||||
|
||||
#### 2.104 (October 16, 2023)
|
||||
* Add support for numbered and bulleted lists in email HTML editor
|
||||
* Add ability to display active file locks in `Webmin Configuration ⇾ File Locking` page
|
||||
|
||||
@@ -407,5 +407,89 @@ if (-r $module_prefs_conf) {
|
||||
}
|
||||
}
|
||||
|
||||
# read_config_params(url, insert-prefix)
|
||||
# Parses the URL parameters from a URL, and returns a hash ref
|
||||
sub read_config_params
|
||||
{
|
||||
my ($url, $pref) = @_;
|
||||
# Extract the part of the URL after the question mark
|
||||
my ($query_string) = $url =~ /\?(.*)$/;
|
||||
my %params;
|
||||
|
||||
# Split the query string on '&' to get the individual key-value pairs
|
||||
for my $pair (split(/&/, $query_string)) {
|
||||
my ($key, $value) = split /=/, $pair;
|
||||
$value = &un_urlize($value);
|
||||
my $param_prefix = $pref ? "_cparam-" : "";
|
||||
$params{"$param_prefix$key"} = $value;
|
||||
}
|
||||
return \%params;
|
||||
}
|
||||
|
||||
# print_config_posted_params()
|
||||
# Prints hidden fields for all the parameters in the referrer URL
|
||||
sub print_config_posted_params
|
||||
{
|
||||
my $env_referer = $ENV{'HTTP_REFERER'};
|
||||
my $params_referer = &read_config_params($env_referer);
|
||||
my $params_url = &read_config_params($ENV{'REQUEST_URI'});
|
||||
my $params = { %$params_referer, %$params_url };
|
||||
my @params;
|
||||
if (%$params) {
|
||||
foreach my $param (keys %{$params}) {
|
||||
my $param_prefix = "_cparam-";
|
||||
if ($param =~ /section|module|mode|section_next|nnext|nprev|xnavigation/ ||
|
||||
!$params->{$param} || $env_referer =~ /$param_prefix$param=/ ||
|
||||
$params_url =~ /$param_prefix$param=/ || &indexof($param, @params) > -1) {
|
||||
next;
|
||||
}
|
||||
$param_prefix = "" if ($param =~ /^$param_prefix/);
|
||||
push(@params, $param);
|
||||
print &ui_hidden("$param_prefix$param", $params->{$param}), "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# get_query_config_posted_params(url)
|
||||
# Returns the currently posted parameters from the URL
|
||||
sub get_query_config_posted_params
|
||||
{
|
||||
my ($url) = @_;
|
||||
foreach my $key (keys %in) {
|
||||
if ($key =~ /^_cparam-/) {
|
||||
my $value = $in{$key};
|
||||
if ($value) {
|
||||
my $delimiter = ($url =~ /\?/) ? "&" : '?';
|
||||
$url .= "$delimiter$key=$value"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
# get_config_posted_params(target)
|
||||
# Returns the referrer URL with all the parameters from the POST request
|
||||
sub get_config_posted_params
|
||||
{
|
||||
my ($target) = @_;
|
||||
my $param_prefix = "_cparam-";
|
||||
my $env_referer = $ENV{'HTTP_REFERER'};
|
||||
my $env_referer_prefixed = ($env_referer =~ /$param_prefix/ ? 1 : 0);
|
||||
my $params_referer = &read_config_params($env_referer, !$env_referer_prefixed);
|
||||
my %keys = (%in, %$params_referer);
|
||||
foreach my $key (keys %keys) {
|
||||
if ($key =~ /^$param_prefix(.*)/) {
|
||||
my $k = $1;
|
||||
my $v = $keys{$key};
|
||||
if ($v && $target !~ /$k=/) {
|
||||
my $delimiter = ($target =~ /\?/) ? "&" : '?';
|
||||
$v = &urlize($v) if ($v =~ /^\//);
|
||||
$target .= "$delimiter$k=$v"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $target;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ else {
|
||||
|
||||
print &ui_form_start("config_save.cgi", "post");
|
||||
print &ui_hidden("module", $m),"\n";
|
||||
&print_config_posted_params();
|
||||
print &ui_table_start(&text('config_header', $module_info{'desc'}),
|
||||
"width=100%", 2);
|
||||
&read_file("$config_directory/$m/config", \%newconfig);
|
||||
@@ -51,5 +52,5 @@ if (!$func) {
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("/$m", $text{'index'});
|
||||
&ui_print_footer(&get_config_posted_params("/$m/"), $text{'index'});
|
||||
|
||||
|
||||
@@ -56,5 +56,5 @@ if (&foreign_check("webmin")) {
|
||||
}
|
||||
|
||||
&webmin_log("_config_", undef, undef, \%in, $m);
|
||||
&redirect("/$m/");
|
||||
&redirect(&get_config_posted_params("/$m/"));
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ if (@sections > 1) {
|
||||
print &ui_form_start("config.cgi");
|
||||
print &ui_hidden("module", $m),"\n";
|
||||
print $text{'config_section'},"\n";
|
||||
&print_config_posted_params();
|
||||
print &ui_select("section", $in{'section'}, \@sections,
|
||||
1, 0, 0, 0, "onChange='form.submit()'");
|
||||
print &ui_submit($text{'config_change'});
|
||||
@@ -76,6 +77,7 @@ if (@sections > 1) {
|
||||
print &ui_form_start("config_save.cgi", "post");
|
||||
print &ui_hidden("module", $m),"\n";
|
||||
print &ui_hidden("section", $in{'section'}),"\n";
|
||||
&print_config_posted_params();
|
||||
if ($s) {
|
||||
# Find next section
|
||||
$idx = &indexof($s, @sections);
|
||||
@@ -122,6 +124,6 @@ if ($m eq "virtual-server") {
|
||||
&ui_print_footer("/right.cgi", $text{'config_return'});
|
||||
}
|
||||
else {
|
||||
&ui_print_footer("/$m", $text{'index'});
|
||||
&ui_print_footer(&get_config_posted_params("/$m/"), $text{'index'});
|
||||
}
|
||||
|
||||
|
||||
@@ -41,13 +41,14 @@ if (&foreign_require($m) &&
|
||||
}
|
||||
|
||||
&webmin_log("_config_", undef, undef, \%in, $m);
|
||||
my $redirect_url;
|
||||
if ($in{'save_next'}) {
|
||||
&redirect("config.cgi?module=$in{'module'}§ion=$in{'section_next'}");
|
||||
$redirect_url = &get_query_config_posted_params("config.cgi?module=$in{'module'}§ion=$in{'section_next'}");
|
||||
}
|
||||
elsif ($m eq "virtual-server") {
|
||||
&redirect("/right.cgi");
|
||||
$redirect_url = "/right.cgi";
|
||||
}
|
||||
else {
|
||||
&redirect("/$m/");
|
||||
$redirect_url = &get_config_posted_params("/$m/");
|
||||
}
|
||||
|
||||
&redirect($redirect_url);
|
||||
|
||||
@@ -1553,7 +1553,7 @@ if ($folder->{'type'} == 1 || $folder->{'type'} == 3) {
|
||||
&get_maildir_files($folder->{'file'}) :
|
||||
&get_mhdir_files($folder->{'file'});
|
||||
if ($folder->{'type'} == 1) {
|
||||
foreach my $sf (glob("\Q$folder->{'file'}\E/.??*")) {
|
||||
foreach my $sf (glob("\"$folder->{'file'}\"/.??*")) {
|
||||
push(@files, &get_maildir_files($sf));
|
||||
}
|
||||
}
|
||||
@@ -3643,7 +3643,7 @@ if (!%hasattach) {
|
||||
}
|
||||
else {
|
||||
$hasattach_file = "$module_config_directory/attach";
|
||||
if (!glob("\Q$hasattach_file\E.*")) {
|
||||
if (!glob("\"$hasattach_file\".*")) {
|
||||
$hasattach_file = "$module_var_directory/attach";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ foreach my $folder (&list_user_folders($user)) {
|
||||
&unlink_file($ifile);
|
||||
}
|
||||
else {
|
||||
&unlink_file(glob("\Q$ifile\E.{dir,pag,db}"));
|
||||
&unlink_file(glob("\"$ifile\".{dir,pag,db}"));
|
||||
}
|
||||
&unlink_file("$ifile.ids");
|
||||
}
|
||||
@@ -1136,7 +1136,7 @@ foreach my $folder (&list_user_folders($user)) {
|
||||
&unlink_file($ifile);
|
||||
}
|
||||
else {
|
||||
&unlink_file(glob("\Q$ifile\E.{dir,pag,db}"));
|
||||
&unlink_file(glob("\"$ifile\".{dir,pag,db}"));
|
||||
}
|
||||
}
|
||||
# Remove read file
|
||||
@@ -1145,7 +1145,7 @@ if (-r $read) {
|
||||
&unlink_file($read);
|
||||
}
|
||||
else {
|
||||
&unlink_file(glob("\Q$read\E.{dir,pag,db}"));
|
||||
&unlink_file(glob("\"$read\".{dir,pag,db}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1280,7 +1280,7 @@ sub user_read_dbm_file
|
||||
{
|
||||
my ($user) = @_;
|
||||
my $rv = "$module_config_directory/$user.read";
|
||||
if (!glob("\Q$rv\E.*")) {
|
||||
if (!glob("\"$rv\".*")) {
|
||||
$rv = "$module_var_directory/$user.read";
|
||||
}
|
||||
return $rv;
|
||||
|
||||
@@ -606,12 +606,12 @@ foreach my $dat (glob("$config{'minecraft_dir'}/*/level.dat")) {
|
||||
if (-d "$path/players") {
|
||||
# Old format
|
||||
@players = map { s/^.*\///; s/\.dat$//; $_ }
|
||||
glob("\Q$path\E/players/*");
|
||||
glob("$path/players/*");
|
||||
}
|
||||
if (-d "$path/playerdata" && !@players) {
|
||||
# New format (UUID based)
|
||||
@players = map { s/^.*\///; s/\.dat$//; $_ }
|
||||
glob("\Q$path\E/playerdata/*");
|
||||
glob("$path/playerdata/*");
|
||||
@players = map { my $u = $_;
|
||||
&uuid_to_username($u) || $u } @players;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ if (&has_command("ip")) {
|
||||
$vifc{'edit'} = ($vifc{'name'} !~ /^ppp/);
|
||||
$vifc{'index'} = scalar(@rv);
|
||||
push(@rv, \%vifc);
|
||||
$i = $vn + 1;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user