create_ar      = You aren't allowed to create files and directories above the virtual root directory.
 delete_failed  = Could not delete file '{FILE}'.
 dircopy        = This editor is not able to copy directories.
+dir_no_create  = You have not enough permissions to create a file in the directory '{DIRECTORY}'.
 dir_not_exist  = The directory where you want to create this file or directory doesn't exist.
 dir_read_fail  = Reading of directory '{DIR}' failed.
 dir_replace    = You are not allowed to replace a directory.
 lock_failed    = Locking of '{USELIST}' failed. Try it again in a moment. If the problem persists, ask someone to recreate the lock file ('{LOCK_FILE}').
 mkdir_failed   = Could not create directory '{DIR}'.
 mkfile_failed  = Could not create file '{FILE}'.
-noedit         = You have not enough permissions to edit this file.
-nocopy         = You have not enough permissions to copy this file.
-noview         = You have not enough permissions to view this file.
+no_copy        = You have not enough permissions to copy this file.
+no_delete      = You have not enough permissions to delete this file.
 no_dir_access  = You have not enough permissions to access this directory.
 no_directory   = '{FILE}' is not a directory.
+no_edit        = You have not enough permissions to edit this file.
+no_rename      = You have not enough permissions to move/rename this file.
 no_root_access = You have not enough permissions to access the root directory.
 no_root_dir    = The root directory does not exist or is not a directory.
 no_users       = It seems that your system doesn't support users and groups.
+no_view        = You have not enough permissions to view this file.
 not_exist      = File/directory does not exist.
 not_owner      = You are not the owner of '{FILE}', so you are not allowed to change the mode and the group.
 remove_root    = You are not allowed to remove the root directory.
 
 # Execute Dev-Editor's commands
 #
 # Author:        Patrick Canterino <patshaping@gmx.net>
-# Last modified: 2004-11-25
+# Last modified: 2004-11-26
 #
 
 use strict;
   my $files = $direntries->{'files'};
   my $dirs  = $direntries->{'dirs'};
 
+  my $dir_writeable = -w $physical;
+
   my $dirlist = "";
 
   # Create the link to the upper directory
 
    my @stat      = stat($phys_path);
    my $in_use    = $uselist->in_use($virtual.$file);
+   my $too_large = $config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'};
 
    my $ftpl = new Template;
    $ftpl->read_file($config->{'templates'}->{'dirlist_file'});
    $ftpl->parse_if_block("binary",-B $phys_path);
    $ftpl->parse_if_block("readonly",not -w $phys_path);
 
-   $ftpl->parse_if_block("viewable",-r $phys_path && -T $phys_path && not ($config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'}));
-   $ftpl->parse_if_block("editable",-r $phys_path && -w $phys_path && -T $phys_path && not ($config->{'max_file_size'} && $stat[7] > $config->{'max_file_size'}) && not $in_use);
+   $ftpl->parse_if_block("viewable",-r $phys_path && -T $phys_path && not $too_large);
+   $ftpl->parse_if_block("editable",-r $phys_path && -w $phys_path && -T $phys_path && not $too_large && not $in_use);
 
    $ftpl->parse_if_block("in_use",$in_use);
    $ftpl->parse_if_block("unused",not $in_use);
   $tpl->fillin("DIR",$virtual);
   $tpl->fillin("SCRIPT",$script);
   $tpl->fillin("URL",equal_url($config->{'httproot'},$virtual));
+
+  $tpl->parse_if_block("dir_writeable",$dir_writeable);
  }
  else
  {
   # View a file
 
-  return error($config->{'errors'}->{'noview'},$upper_path) unless(-r $physical);
+  return error($config->{'errors'}->{'no_view'},$upper_path) unless(-r $physical);
 
   # Check on binary files
   # We have to do it in this way, or empty files
 
  return error($config->{'errors'}->{'editdir'},$dir)                    if(-d $physical);
  return error($config->{'errors'}->{'in_use'}, $dir,{FILE => $virtual}) if($uselist->in_use($virtual));
- return error($config->{'errors'}->{'noedit'}, $dir)                    unless(-r $physical && -w $physical);
+ return error($config->{'errors'}->{'no_edit'},$dir)                    unless(-r $physical && -w $physical);
 
  # Check on binary files
 
 
  return error($config->{'errors'}->{'text_to_binary'},$dir) unless(-T $physical);
  return error($config->{'errors'}->{'editdir'},$dir)        if(-d $physical);
- return error($config->{'errors'}->{'noedit'}, $dir)        if(-e $physical && !(-r $physical && -w $physical));
+ return error($config->{'errors'}->{'no_edit'},$dir)        if(-e $physical && !(-r $physical && -w $physical));
 
  if(file_save($physical,\$content))
  {
  my $cgi            = $data->{'cgi'};
 
  return error($config->{'errors'}->{'no_directory'},upper_path($virtual),{FILE => $virtual}) unless(-d $physical);
+ return error($config->{'errors'}->{'dir_no_create'},$virtual,{DIR => $virtual});
 
  if(my $uploaded_file = $cgi->param('uploaded_file'))
  {
  my $new_physical   = $data->{'new_physical'};
 
  return error($config->{'errors'}->{'dircopy'},upper_path($virtual)) if(-d $physical);
- return error($config->{'errors'}->{'nocopy'},upper_path($virtual))  unless(-r $physical);
+ return error($config->{'errors'}->{'no_copy'},upper_path($virtual)) unless(-r $physical);
 
  if($new_physical)
  {
  my $new_physical   = $data->{'new_physical'};
 
  return error($config->{'errors'}->{'rename_root'},"/") if($virtual eq "/");
+ return error($config->{'errors'}->{'no_rename'},upper_path($virtual)) unless(-w upper_path($physical));
  return error($config->{'errors'}->{'in_use'},upper_path($virtual),{FILE => $virtual}) if($data->{'uselist'}->in_use($virtual));
 
  if($new_physical)
  my $physical       = $data->{'physical'};
  my $virtual        = $data->{'virtual'};
 
- return error($config->{'errors'}->{'remove_root'},"/") if($virtual eq "/");
+ return error($config->{'errors'}->{'remove_root'},"/")                if($virtual eq "/");
+ return error($config->{'errors'}->{'no_delete'},upper_path($virtual)) unless(-w upper_path($physical));
 
  if(-d $physical)
  {
     {
      # Change the mode
 
-     my $oct_mode = $mode;
-     $oct_mode    = "0".$oct_mode if(length($oct_mode) == 3);
-     $oct_mode    = oct($oct_mode);
-
-     chmod($oct_mode,$physical);
+     chmod(oct($mode),$physical);
     }
 
     if($group)