Merge branch 'master' of git@github.com:webmin/webmin

This commit is contained in:
Jamie Cameron
2016-05-05 20:39:55 -07:00
3 changed files with 50 additions and 16 deletions

View File

@@ -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

View File

@@ -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");
}

View File

@@ -269,8 +269,12 @@ sub print_interface {
$actions = "<a class='action-link' href='javascript:void(0)' onclick='renameDialog(\"$vlink\")' title='$text{'rename'}' data-container='body'>$rename_icon</a>";
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<a class='action-link' href='edit_file.cgi?file=".&urlize($link)."&path=".&urlize($path)."' title='$text{'edit'}' data-container='body'>$edit_icon</a>";
}
if (index($type, "zip") != -1 or index($type, "compressed") != -1) {
$actions = "$actions <a class='action-link' href='extract.cgi?path=".&urlize($path)."&file=".&urlize($link)."' title='$text{'extract_archive'}' data-container='body'>$extract_icon</a> ";
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 <a class='action-link' href='extract.cgi?path="
. &urlize($path)
. "&file="
. &urlize($link)
. "' title='$text{'extract_archive'}' data-container='body'>$extract_icon</a> ";
}
}
@row_data = (