return $main::lxdebug->leave_sub() unless ($path && $number);
+ $number =~ s|[/\\]|_|g;
+
$path = "webdav/${path}/${number}";
if (!-d $path) {
} else {
my $base_path = substr($ENV{'SCRIPT_NAME'}, 1);
$base_path =~ s|[^/]+$||;
+ $base_path =~ s|/$||;
+
+ if (opendir $dir, $path) {
+ foreach my $file (readdir $dir) {
+ next if (($file eq '.') || ($file eq '..'));
+
+ my $fname = $file;
+ $fname =~ s|.*/||;
+
+ my $physical_file = "$path/$file";
+
+ $file = join('/', map { $form->escape($_) } grep { $_ } split m|/+|, "$path/$file");
+ $file .= '/' if (-d $physical_file);
+
+ $form->{WEBDAV}->{$fname} = ($ENV{"HTTPS"} ? "https://" : "http://") . $ENV{'SERVER_NAME'} . "/$base_path/$file";
+ }
- foreach my $file (<$path/*>) {
- my $fname = $file;
- $fname =~ s|.*/||;
- $form->{WEBDAV}{$fname} =
- ($ENV{"HTTPS"} ? "https://" : "http://") .
- $ENV{'SERVER_NAME'} . "/" . $base_path . $file;
+ closedir $dir;
}
}