[-] BO : check the folder permissions before writing PDF translations in the theme
This commit is contained in:
@@ -277,7 +277,12 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
$file_path = $translation_informations['dir'].$translation_informations['file'];
|
$file_path = $translation_informations['dir'].$translation_informations['file'];
|
||||||
|
|
||||||
if (!file_exists($file_path))
|
if (!file_exists($file_path))
|
||||||
throw new PrestaShopException(sprintf(Tools::displayError('This file doesn\'t exists: "%s". Please create this file.'), $file_path));
|
{
|
||||||
|
if (!file_exists(dirname($file_path)) && !mkdir(dirname($file_path), 0777, true))
|
||||||
|
throw new PrestaShopException(sprintf(Tools::displayError('Directory "%s" cannot be created'), dirname($file_path)));
|
||||||
|
elseif (!touch($file_path))
|
||||||
|
throw new PrestaShopException(sprintf(Tools::displayError('File "%s" cannot be created'), $file_path));
|
||||||
|
}
|
||||||
|
|
||||||
if ($fd = fopen($file_path, 'w'))
|
if ($fd = fopen($file_path, 'w'))
|
||||||
{
|
{
|
||||||
@@ -1121,6 +1126,8 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
/* PrestaShop demo mode */
|
/* PrestaShop demo mode */
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if (Tools::isSubmit('submitCopyLang'))
|
if (Tools::isSubmit('submitCopyLang'))
|
||||||
{
|
{
|
||||||
if ($this->tabAccess['add'] === '1')
|
if ($this->tabAccess['add'] === '1')
|
||||||
@@ -1226,6 +1233,9 @@ class AdminTranslationsControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
$this->errors[] = Tools::displayError('You do not have permission to edit here.');
|
||||||
}
|
}
|
||||||
|
} catch (PrestaShopException $e) {
|
||||||
|
$this->errors[] = $e->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user