mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Add option to create a world from a server-side file
This commit is contained in:
@@ -40,6 +40,8 @@ if ($in{'new'}) {
|
||||
}
|
||||
push(@opts, [ 2, $text{'world_src2'},
|
||||
&ui_upload("upload") ]);
|
||||
push(@opts, [ 3, $text{'world_src3'},
|
||||
&ui_filebox("file", undef, 40) ]);
|
||||
print &ui_table_row($text{'world_src'},
|
||||
&ui_radio_table("src", 0, \@opts));
|
||||
}
|
||||
|
||||
@@ -194,6 +194,7 @@ world_src=Source for new world
|
||||
world_src0=Create empty world
|
||||
world_src1=Clone existing world
|
||||
world_src2=Use uploaded ZIP file
|
||||
world_src3=Use ZIP file on server
|
||||
world_delete=Delete World Forever
|
||||
world_players=Players who have connected
|
||||
world_err1=Failed to create world
|
||||
@@ -206,6 +207,8 @@ world_rusure=Are you sure you want to delete the Minecraft world $1? All map, pl
|
||||
world_confirm=Yes, Delete This World
|
||||
world_einuse=The currently active world cannot be deleted.
|
||||
world_eupload=No world data to upload selected
|
||||
world_efile=No world data filename entered
|
||||
world_efile2=World data file does not exist
|
||||
world_ezip=Uploaded world data does not appear to be in ZIP format
|
||||
world_eunzip=Failed to unzip world data : $1
|
||||
world_edat=ZIP file does not contain a level.dat file
|
||||
|
||||
@@ -52,14 +52,21 @@ if ($in{'new'}) {
|
||||
&execute_minecraft_command("save-on");
|
||||
}
|
||||
}
|
||||
elsif ($in{'src'} == 2) {
|
||||
# From uploaded file
|
||||
$in{'upload'} || &error($text{'world_eupload'});
|
||||
elsif ($in{'src'} == 2 || $in{'src'} == 3) {
|
||||
# From uploaded or local file
|
||||
my $temp = &transname();
|
||||
my $fh = "ZIP";
|
||||
&open_tempfile($fh, ">$temp", 0, 1);
|
||||
&print_tempfile($fh, $in{'upload'});
|
||||
&close_tempfile($fh);
|
||||
if ($in{'src'} == 2) {
|
||||
$in{'upload'} || &error($text{'world_eupload'});
|
||||
my $fh = "ZIP";
|
||||
&open_tempfile($fh, ">$temp", 0, 1);
|
||||
&print_tempfile($fh, $in{'upload'});
|
||||
&close_tempfile($fh);
|
||||
}
|
||||
else {
|
||||
$in{'file'} || &error($text{'world_efile'});
|
||||
-r $in{'file'} || &error($text{'world_efile2'});
|
||||
©_source_dest($in{'file'}, $temp);
|
||||
}
|
||||
my $out = &backquote_command("file ".$temp);
|
||||
$out =~ /Zip\s+archive/i || &error($text{'world_ezip'});
|
||||
my $tempdir = &transname();
|
||||
|
||||
Reference in New Issue
Block a user