Merge pull request #213 from lelutin/protect_dir_error_messages

Protected dir creation error messages are not helpful.

Provide more informations about error creation
This commit is contained in:
camlafit 2018-01-09 15:47:48 +01:00 committed by GitHub
commit 309cb1991b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -73,13 +73,9 @@ class m_hta {
return false;
}
if (!file_exists("$absolute/.htaccess")) {
if (!@touch("$absolute/.htaccess")) {
$msg->raise("ERROR", "hta", _("File already exist"));
return false;
}
$file = @fopen("$absolute/.htaccess", "r+");
$file = @fopen("$absolute/.htaccess", "w+");
if (!$file) {
$msg->raise("ERROR", "hta", _("File already exist"));
$msg->raise("ERROR", "hta", _("Error creating .htaccess file: ") . error_get_last()['message']);
return false;
}
fseek($file, 0);
@ -88,8 +84,8 @@ class m_hta {
fclose($file);
}
if (!file_exists("$absolute/.htpasswd")) {
if (!touch("$absolute/.htpasswd")) {
$msg->raise("ERROR", "hta", _("File already exist"));
if (!@touch("$absolute/.htpasswd")) {
$msg->raise("ERROR", "hta", _("Error creating .htpasswd file: ") . error_get_last()['message']);
return false;
}
return true;