X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/026334ca3bfc6d4cc1ddeed98f97d1b58eda5512..6a0845bb6cf36d03e039e3fd44180a21e8042f83:/modules/Command.pm?ds=inline
diff --git a/modules/Command.pm b/modules/Command.pm
index 6aa3fc1..44419ba 100644
--- a/modules/Command.pm
+++ b/modules/Command.pm
@@ -6,7 +6,7 @@ package Command;
# Execute Dev-Editor's commands
#
# Author: Patrick Canterino
+
@@ -165,6 +170,8 @@ END
{
# View a file
+ return error("You have not enough permissions to view this file.",upper_path($virtual)) unless(-r $physical);
+
# Check on binary files
# We have to do it in this way, or empty files
# will be recognized as binary files
@@ -173,7 +180,7 @@ END
{
# Binary file
- return error("This editor is not able to view/edit binary files.");
+ return error("This editor is not able to view/edit binary files.",upper_path($virtual));
}
else
{
@@ -192,7 +199,7 @@ END
}
}
- return \$output
+ return \$output;
}
# exec_beginedit
@@ -211,8 +218,9 @@ sub exec_beginedit($$)
my $virtual = $data->{'virtual'};
my $uselist = $data->{'uselist'};
- return error("You cannot edit directories.") if(-d $physical);
+ return error("You cannot edit directories.",upper_path($virtual)) if(-d $physical);
return error_in_use($virtual) if($uselist->in_use($virtual));
+ return error("You have not enough permissions to edit this file.",upper_path($virtual)) unless(-r $physical && -w $physical);
# Check on binary files
@@ -220,7 +228,7 @@ sub exec_beginedit($$)
{
# Binary file
- return error("This editor is not able to view/edit binary files.");
+ return error("This editor is not able to view/edit binary files.",upper_path($virtual));
}
else
{
@@ -229,30 +237,33 @@ sub exec_beginedit($$)
$uselist->add_file($virtual);
$uselist->save;
- my $dir = upper_path($virtual);
- my $content = encode_entities(${file_read($physical)});
+ my $dir = upper_path($virtual);
+ my $content = encode_entities(${file_read($physical)});
- my $output = htmlhead("Edit file ".encode_entities($virtual));
- $output .= equal_url($config->{'httproot'},$virtual);
+ my $equal_url = equal_url($config->{'httproot'},$virtual);
- $virtual = encode_entities($virtual);
+ $virtual = encode_entities($virtual);
+ my $output = htmlhead("Edit file $virtual");
+ $output .= $equal_url;
$output .= <Create new file:
-$virtual
+