X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/4b1116ca47b6e19d147ca45b7ed359eea22b95ec..54dad5a0c7a0e11b30267db10353c162e680fcb5:/modules/Command.pm diff --git a/modules/Command.pm b/modules/Command.pm index 46798ee..591c8b1 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-08-29 +# Last modified: 2004-10-05 # use strict; @@ -342,7 +342,7 @@ sub exec_endedit($$) $content = encode_entities($content,"\200-\377"); } - if($data->{'cgi'}->param('saveas')) + if($data->{'cgi'}->param('saveas') && $data->{'new_physical'} ne '' && $data->{'new_virtual'} ne '') { # Create the new filename @@ -354,8 +354,9 @@ sub exec_endedit($$) return error($config->{'errors'}->{'in_use'},upper_path($virtual),{FILE => $virtual}) if($uselist->in_use($virtual)); } - return error($config->{'errors'}->{'editdir'},upper_path($virtual)) if(-d $physical); - return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) unless(-r $physical && -w $physical); + return error($config->{'errors'}->{'text_to_binary'},upper_path($virtual)) unless(-T $physical); + return error($config->{'errors'}->{'editdir'},upper_path($virtual)) if(-d $physical); + return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) if(-e $physical && !(-r $physical && -w $physical)); if(file_save($physical,\$content)) { @@ -528,7 +529,8 @@ sub exec_copy($$) my $virtual = encode_entities($data->{'virtual'}); my $new_physical = $data->{'new_physical'}; - return error($config->{'errors'}->{'nocopy'}) unless(-r $physical); + return error($config->{'errors'}->{'dircopy'}) if(-d $physical); + return error($config->{'errors'}->{'nocopy'}) unless(-r $physical); if($new_physical) { @@ -542,7 +544,7 @@ sub exec_copy($$) if(-d $new_physical) { - return error($config->{'errors'}->{'dircopy'}); + return error($config->{'errors'}->{'dir_replace'},$dir); } elsif(not $data->{'cgi'}->param('confirmed')) { @@ -617,7 +619,7 @@ sub exec_rename($$) if(-d $new_physical) { - return error($config->{'errors'}->{'dircopy'}); + return error($config->{'errors'}->{'dir_replace'},$dir); } elsif(not $data->{'cgi'}->param('confirmed')) { @@ -823,10 +825,13 @@ sub exec_unlock($$) { my ($data,$config) = @_; my $virtual = $data->{'virtual'}; + my $uselist = $data->{'uselist'}; + + return devedit_reload({command => 'show', file => upper_path($virtual)}) if($uselist->unused($virtual)); if($data->{'cgi'}->param('confirmed')) { - file_unlock($data->{'uselist'},$virtual); + file_unlock($uselist,$virtual); return devedit_reload({command => 'show', file => upper_path($virtual)}); } else