X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/a180f0b982f525ea2d17516f9aa43d3313399de1..f3bc7fa5e105cab71c404298ed14ed48caea1bfe:/modules/Command.pm diff --git a/modules/Command.pm b/modules/Command.pm index 6db5d07..0ae3416 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2004-07-11 +# Last modified: 2004-07-20 # use strict; @@ -81,6 +81,7 @@ sub exec_show($$) my ($data,$config) = @_; my $physical = $data->{'physical'}; my $virtual = $data->{'virtual'}; + my $uselist = $data->{'uselist'}; my $tpl = new Template; @@ -138,7 +139,7 @@ sub exec_show($$) my $virt_path = encode_entities($virtual.$file); my @stat = stat($phys_path); - my $in_use = $data->{'uselist'}->in_use($virtual.$file); + my $in_use = $uselist->in_use($virtual.$file); my $ftpl = new Template; $ftpl->read_file($config->{'templates'}->{'dirlist_file'}); @@ -192,7 +193,9 @@ sub exec_show($$) { # Text file - if($config->{'max_file_size'} && (stat($physical))[7] > $config->{'max_file_size'}) + my $size = (stat($physical))[7]; + + if($config->{'max_file_size'} && $size > $config->{'max_file_size'}) { return error($config->{'errors'}->{'file_too_large'},upper_path($virtual),{SIZE => $config->{'max_file_size'}}) } @@ -208,6 +211,8 @@ sub exec_show($$) $tpl->fillin("URL",equal_url($config->{'httproot'},$virtual)); $tpl->fillin("SCRIPT",$script); $tpl->fillin("CONTENT",encode_entities($$content)); + + $tpl->parse_if_block("editable",-r $physical && -w $physical && -T $physical && not ($config->{'max_file_size'} && $size > $config->{'max_file_size'}) && $uselist->unused($virtual)); } } }