Skip to content

Commit 2cb656c

Browse files
author
mcramer
committed
Fixed: "old" style folder protection without comment lines in htaccess (3.0.4.6) get removed, too.
1 parent fd68897 commit 2cb656c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,8 @@ function web_folder_delete($event_name,$data) {
18121812

18131813
if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
18141814
$ht_file = str_replace($matches[0], '', $ht_file);
1815+
} else {
1816+
$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
18151817
}
18161818

18171819
if(trim($ht_file) == '') {
@@ -1890,6 +1892,8 @@ function web_folder_update($event_name,$data) {
18901892

18911893
if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
18921894
$ht_file = str_replace($matches[0], '', $ht_file);
1895+
} else {
1896+
$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
18931897
}
18941898

18951899
if(trim($ht_file) == '') {
@@ -1930,6 +1934,8 @@ function web_folder_update($event_name,$data) {
19301934

19311935
if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
19321936
$ht_file = str_replace($matches[0], '', $ht_file);
1937+
} else {
1938+
$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
19331939
}
19341940

19351941
if(trim($ht_file) == '') {

0 commit comments

Comments
 (0)