# Execute Dev-Editor's commands
#
# Author: Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-07-28
+# Last modified: 2004-10-04
#
use strict;
$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
}
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'}->{'noedit'}, upper_path($virtual)) if(-e $physical && !(-r $physical && -w $physical));
if(file_save($physical,\$content))
{
my $file_phys = $physical."/".$filename;
my $file_virt = $virtual."".$filename;
- return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) if(-e $file_phys);
+ return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) if(-e $file_phys && not $cgi->param('overwrite'));
my $ascii = $cgi->param('ascii');
my $handle = $cgi->upload('uploaded_file');
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)
{
if(-d $new_physical)
{
- return error($config->{'errors'}->{'dircopy'});
+ return error($config->{'errors'}->{'dir_replace'},$dir);
}
elsif(not $data->{'cgi'}->param('confirmed'))
{
if(-d $new_physical)
{
- return error($config->{'errors'}->{'dircopy'});
+ return error($config->{'errors'}->{'dir_replace'},$dir);
}
elsif(not $data->{'cgi'}->param('confirmed'))
{
}
else
{
- my @stat = lstat($physical);
+ my @stat = stat($physical);
my $mode = $stat[2];
my $mode_oct = substr(sprintf("%04o",$mode),-4);