edit_failed = Saving of file '{FILE}' failed. The file could be damaged, please check its integrity.
editdir = You cannot edit directories.
exist_edited = The target file '{FILE}' already exists and is edited by someone else.
+exist_no_write = The target file '{FILE}' already exists and you have not enough permissions to replace it.
file_exists = A file or directory called '{FILE}' already exists.
file_in_use = The file '{FILE}' is currently edited by someone else.
file_too_large = The file you want to view or edit is too large (max. {SIZE} Bytes).
# Execute Dev-Editor's commands
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 2004-12-20
+# Last modified: 2004-12-21
#
use strict;
my $file_phys = $physical."/".$filename;
my $file_virt = $virtual.$filename;
- return error($config->{'errors'}->{'in_use'},$virtual,{FILE => $file_virt}) if($data->{'uselist'}->in_use($file_virt));
- return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) if(-e $file_phys && not $cgi->param('overwrite'));
+ return error($config->{'errors'}->{'in_use'},$virtual,{FILE => $file_virt}) if($data->{'uselist'}->in_use($file_virt));
+
+ if(-e $file_phys)
+ {
+ return error($config->{'errors'}->{'dir_replace'},$virtual) if(-d $file_phys);
+ return error($config->{'errors'}->{'exist_no_write'},$virtual,{FILE => $file_virt}) unless(-w $file_phys);
+ return error($config->{'errors'}->{'file_exists'},$virtual,{FILE => $file_virt}) unless($cgi->param('overwrite'));
+ }
my $ascii = $cgi->param('ascii');
my $handle = $cgi->upload('uploaded_file');
if(-e $new_physical)
{
- return error($config->{'errors'}->{'exist_edited'},$new_dir,{FILE => $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
+ return error($config->{'errors'}->{'exist_edited'},$new_dir,{FILE => $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
+ return error($config->{'errors'}->{'dir_replace'},$new_dir) if(-d $new_physical);
+ return error($config->{'errors'}->{'exist_no_write'},$new_dir,{FILE => $new_virtual}) unless(-w $new_physical);
- if(-d $new_physical)
- {
- return error($config->{'errors'}->{'dir_replace'},$new_dir);
- }
- elsif(not $data->{'cgi'}->param('confirmed'))
+ if(not $data->{'cgi'}->param('confirmed'))
{
my $tpl = new Template;
$tpl->read_file($config->{'templates'}->{'confirm_replace'});
if(-e $new_physical)
{
- return error($config->{'errors'}->{'exist_edited'},$new_dir,{FILE => $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
+ return error($config->{'errors'}->{'exist_edited'},$new_dir,{FILE => $new_virtual}) if($data->{'uselist'}->in_use($data->{'new_virtual'}));
+ return error($config->{'errors'}->{'dir_replace'},$new_dir) if(-d $new_physical);
+ return error($config->{'errors'}->{'exist_no_write'},$new_dir,{FILE => $new_virtual}) unless(-w $new_physical);
- if(-d $new_physical)
- {
- return error($config->{'errors'}->{'dir_replace'},$new_dir);
- }
- elsif(not $data->{'cgi'}->param('confirmed'))
+ if(not $data->{'cgi'}->param('confirmed'))
{
my $tpl = new Template;
$tpl->read_file($config->{'templates'}->{'confirm_replace'});