Added a button to link to the Apache module (if accessible) for editing all settings in the .htaccess file.
---- Changes since 1.450 ----
Added a Module Config option to set permissions on created .htaccess and .htpasswd files, which defaults to 644.
+---- Changes since 1.480 ----
+Added a button to remove protection from multiple directories, without removing the .htaccess file.
if ($dir) {
$htaccess = "$dir->[0]/$config{'htaccess'}";
&can_access_dir($htaccess) || &error($text{'dir_ecannot'});
- &unlink_logged($htaccess);
- &unlink_logged($dir->[1]) if (!-d $dir->[1]);
- &unlink_logged($dir->[4]) if ($dir->[4] && !-d $dir->[4]);
+ if ($in{'remove'}) {
+ # Block away the whole file
+ &unlink_logged($htaccess);
+ &unlink_logged($dir->[1])
+ if (!-d $dir->[1]);
+ &unlink_logged($dir->[4])
+ if ($dir->[4] && !-d $dir->[4]);
+ }
+ else {
+ # Take the authentication directives out of .htaccess
+ $conf = &foreign_call($apachemod,
+ "get_htaccess_config", $htaccess);
+ &foreign_call($apachemod, "save_directive",
+ "require", [ ], $conf, $conf);
+ }
@dirs = grep { $_ ne $dir } @dirs;
}
}
+&flush_file_lines();
# Save directory list
&save_directories(\@dirs);
print &ui_columns_end();
if ($can_create) {
print &ui_links_row(\@links);
- print &ui_form_end([ [ "delete", $text{'index_delete'} ] ]);
+ print &ui_form_end([ [ "delete", $text{'index_delete'} ],
+ [ "remove", $text{'index_remove'} ] ]);
}
}
else {
index_digest2=Digest encryption is enabled in the module configuration, but the $1 command or $2 Perl module needed for it is not installed.
index_cpan=<a href='$1'>Click here</a> to download and install it now.
index_delete=Un-Protect Selected Directories
+index_remove=Un-Protect and Remove Files
dir_title1=Add Protected Directory
dir_title2=Edit Protected Directory
&unlink_logged($htaccess);
&unlink_logged($currfile) if ($currfile && !-d $currfile);
&unlink_logged($currgfile) if ($currgfile && !-d $currgfile);
- @dirs = grep { $_ ne $dir } @dirs;
}
else {
- # Take the authentication directives out of the .htaccess
- @dirs = grep { $_ ne $dir } @dirs;
+ # Take the authentication directives out of .htaccess
&foreign_call($apachemod, "save_directive",
"require", [ ], $conf, $conf);
}
+ @dirs = grep { $_ ne $dir } @dirs;
}
else {
# Validate inputs
$conf = &foreign_call($apachemod, "get_htaccess_config", $f);
$currfile = &foreign_call($apachemod, "find_directive",
"AuthUserFile", $conf, 1);
- if ($currfile) {
+ $require = &foreign_call($apachemod, "find_directive",
+ "require", $conf, 1);
+ if ($currfile && $require) {
print &text('search_found', "<tt>$f</tt>",
"<tt>$currfile</tt>"),"<br>\n";
local $d = $f;