# Execute Dev-Editor's commands
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 2010-10-30
+# Last modified: 2010-12-31
#
# Copyright (C) 1999-2000 Roland Bluethgen, Frank Schoenmann
# Copyright (C) 2003-2009 Patrick Canterino
$data =~ s/\015\012|\012|\015/\n/g if($ascii); # Replace line separators if transferring in ASCII mode
file_save($file_phys,\$data,not $ascii) or return error($config->{'errors'}->{'mkfile_failed'},$virtual,{FILE => $file_virt});
+ if($cgi->param('unpack') && $File::Access::has_archive_extract)
+ {
+ return error($config->{'errors'}->{'no_archive'},$virtual,{FILE => encode_html($file_virt)}) unless(is_archive($file_phys));
+
+ my $return_unpack = archive_unpack($file_phys,$physical);
+
+ return error($config->{'errors'}->{'unpack_failed'},$virtual,{FILE => encode_html($file_virt), AE_ERROR => ''}) unless($return_unpack);
+ }
+
return devedit_reload({command => 'show', file => $virtual});
}
else
$tpl->fillin('URL',encode_html(equal_url($config->{'httproot'},$virtual)));
$tpl->fillin('SCRIPT',$script);
+ $tpl->parse_if_block('PERL_ARCHIVE_EXTRACT',$File::Access::has_archive_extract);
+
my $output = header(-type => 'text/html');
$output .= $tpl->get_template;
return error($config->{'errors'}->{'no_ae'},$dir) unless($File::Access::has_archive_extract);
return error($config->{'errors'}->{'no_archive'},$dir,{FILE => encode_html($virtual)}) unless(is_archive($physical));
-
+
if($new_physical)
{
return error($config->{'errors'}->{'unpack_no_dir'},$dir,{FILE => encode_html($virtual), NEW_FILE => encode_html($new_virtual)}) if(-l $new_physical || not -d $new_physical);
-
+
my $return_unpack = archive_unpack($physical,$new_physical);
-
+
return error($config->{'errors'}->{'unpack_failed'},$dir,{FILE => encode_html($virtual), AE_ERROR => ''}) unless($return_unpack);
-
+
return devedit_reload({command => 'show', file => $new_virtual});
}
else
$tpl->fillin('PERL_PROG',encode_html($^X));
$tpl->fillin('PERL_VER', sprintf('%vd',$^V));
-
+
$tpl->parse_if_block('PERL_ARCHIVE_EXTRACT',$File::Access::has_archive_extract);
# Information about the server
<p>Transfer mode (see below):<br>
<input type="radio" name="ascii" id="ascii" value="1"><label for="ascii">ASCII</label> <input type="radio" name="ascii" id="binary" value="0" checked><label for="binary">Binary (default)</label></p>
-<p><input type="checkbox" name="overwrite" id="overwrite"><label for="overwrite">Overwrite existing file</label></p>
+<p><input type="checkbox" name="overwrite" id="overwrite"><label for="overwrite">Overwrite existing file</label></p>{IF PERL_ARCHIVE_EXTRACT}
+
+<p><input type="checkbox" name="unpack" id="unpack"><label for="unpack">Unpack file after upload to the current directory</label></p>{ENDIF}
<p><input type="submit" value="Upload file!"></p>
</form>
<ul>
<li>If you specify an other remote name for the uploaded file, all slashes and backslashes will be removed from the entered value.</li>
+<li>If unpacking of a file fails after uploading the file is still there.</li>
</ul>
<hr>