- $tpl->set_var('DIR',encode_html($virtual));
- $tpl->set_var('DIR_URL',escape($virtual));
- $tpl->set_var('URL',encode_html(equal_url($config->{'httproot'},$virtual)));
- $tpl->set_var('SCRIPT',$script);
+ $tpl->fillin('DIR',encode_html($virtual));
+ $tpl->fillin('DIR_URL',escape($virtual));
+ $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 \$output;
+ }
+}
+
+# exec_unpack()
+#
+# Unpack an archive
+#
+# Params: 1. Reference to user input hash
+# 2. Reference to config hash
+#
+# Return: Output of the command (Scalar Reference)
+
+sub exec_unpack($$)
+{
+ my ($data,$config) = @_;
+ my $physical = $data->{'physical'};
+ my $virtual = $data->{'virtual'};
+ my $dir = upper_path($virtual);
+ my $new_physical = $data->{'new_physical'};
+ my $new_virtual = $data->{'new_virtual'};
+ my $cgi = $data->{'cgi'};
+
+ 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 => encode_html($File::Access::archive_extract_error)}) unless($return_unpack);
+
+ return devedit_reload({command => 'show', file => $new_virtual});
+ }
+ else
+ {
+ my $tpl = new Template;
+ $tpl->read_file($config->{'templates'}->{'unpack'});