diff --git a/filemin/defaultacl b/filemin/defaultacl index 2f17e731c..24dd79ec7 100644 --- a/filemin/defaultacl +++ b/filemin/defaultacl @@ -1,3 +1,3 @@ allowed_paths=$HOME work_as_root=1 -allowed_for_edit=application-x-php application-x-ruby application-xml application-javascript application-x-shellscript application-x-perl application-x-yaml application-json +allowed_for_edit=application-x-php application-x-ruby application-xml application-javascript application-x-shellscript application-x-perl application-x-yaml application-json application-x-x509-ca-cert application-pkix-cert diff --git a/filemin/extract.cgi b/filemin/extract.cgi index a16c9b86c..172cea072 100755 --- a/filemin/extract.cgi +++ b/filemin/extract.cgi @@ -9,16 +9,29 @@ get_paths(); $archive_type = mimetype($cwd.'/'.$in{'file'}); -if ($archive_type eq 'application/zip') { - &backquote_logged("unzip ".quotemeta("$cwd/$in{'file'}"). - " -d ".quotemeta($cwd)); + +if ( index( $archive_type, "x-bzip" ) != -1 ) { + &backquote_logged( "tar xvjfp " . quotemeta("$cwd/$in{'file'}") . " -C " . quotemeta($cwd) ); &redirect("index.cgi?path=$path"); -} elsif (index($archive_type, "tar") != -1) { - &backquote_logged("tar xf ".quotemeta("$cwd/$in{'file'}"). - " -C ".quotemeta($cwd)); - &redirect("index.cgi?path=$path"); -} else { - &ui_print_header(undef, "Filemin", ""); - print "$archive_type $text{'error_archive_type_not_supported'}"; - &ui_print_footer("index.cgi?path=$path", $text{'previous_page'}); } +elsif (index( $archive_type, "x-tar" ) != -1 + || index( $archive_type, "/gzip" ) != -1 + || index( $archive_type, "x-xz" ) != -1 + || index( $archive_type, "x-compressed-tar" ) != -1 ) +{ + &backquote_logged( "tar xfp " . quotemeta("$cwd/$in{'file'}") . " -C " . quotemeta($cwd) ); + &redirect("index.cgi?path=$path"); +} +elsif ( index( $archive_type, "x-7z" ) != -1 ) { + &backquote_logged( "7z x " . quotemeta("$cwd/$in{'file'}") . " -o" . quotemeta($cwd) ); + &redirect("index.cgi?path=$path"); +} +elsif ( index( $archive_type, "/zip" ) != -1 ) { + &backquote_logged( "unzip " . quotemeta("$cwd/$in{'file'}") . " -d " . quotemeta($cwd) ); + &redirect("index.cgi?path=$path"); +} +elsif ( index( $archive_type, "/x-rar" ) != -1 ) { + &backquote_logged( "unrar x -r -y " . quotemeta("$cwd/$in{'file'}") . " " . quotemeta($cwd) ); + &redirect("index.cgi?path=$path"); +} + diff --git a/filemin/filemin-lib.pl b/filemin/filemin-lib.pl index 633b0db14..0414c8ea9 100644 --- a/filemin/filemin-lib.pl +++ b/filemin/filemin-lib.pl @@ -269,8 +269,12 @@ sub print_interface { $actions = "$rename_icon"; - if ($list[$count - 1][15] == 1) { - $href = "index.cgi?path=".&urlize("$path/$link"); + if ( $list[ $count - 1 ][15] == 1 ) { + if ($path eq '/'. $link) { + $href = "index.cgi?path=" . &urlize("$path"); + } else { + $href = "index.cgi?path=" . &urlize("$path/$link"); + } } else { $href = "download.cgi?file=".&urlize($link)."&path=".&urlize($path); if($0 =~ /search.cgi/) { @@ -288,8 +292,25 @@ sub print_interface { ) { $actions = "$actions$edit_icon"; } - if (index($type, "zip") != -1 or index($type, "compressed") != -1) { - $actions = "$actions $extract_icon "; + if ( ( index( $type, "application-zip" ) != -1 && has_command('unzip') ) + || ( index( $type, "application-x-7z-compressed" ) != -1 && has_command('7z') ) + || ( index( $type, "application-x-rar" ) != -1 && has_command('unrar') ) + || (( index( $type, "x-compressed-tar" ) != -1 + || index( $type, "-x-tar" ) != -1 + || ( index( $type, "-x-bzip" ) != -1 && has_command('bzip2') ) + || ( index( $type, "-gzip" ) != -1 && has_command('gzip') ) + || ( index( $type, "-x-xz" ) != -1 && has_command('xz') ) + ) + && has_command('tar') + ) + ) + { + $actions + = "$actions $extract_icon "; } } @row_data = (