//added methode to write default content in index.php file && added check in translation pack import

This commit is contained in:
vAugagneur
2012-12-28 10:18:14 +01:00
parent a35469768f
commit aae9aa82c4
2 changed files with 49 additions and 1 deletions
@@ -647,6 +647,10 @@ class AdminTranslationsControllerCore extends AdminController
{
foreach ($files_list as $file2check)
{
//don't validate index.php, will be overwrite when extract in translation directory
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php')
continue;
if (preg_match('@^[0-9a-z-_/\\\\]+\.php$@i', $file2check['filename']))
{
if (!AdminTranslationsController::checkTranslationFile(file_get_contents($sandbox.$file2check['filename'])))
@@ -655,7 +659,6 @@ class AdminTranslationsControllerCore extends AdminController
elseif (!preg_match('@^[0-9a-z-_/\\\\]+\.(html|tpl|txt)$@i', $file2check['filename']))
$this->errors[] = sprintf(Tools::displayError('Unidentified file found: %s'), $file2check['filename']);
}
}
Tools::deleteDirectory($sandbox, true);
@@ -664,6 +667,10 @@ class AdminTranslationsControllerCore extends AdminController
if ($gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
{
foreach ($files_list as $file2check)
if (pathinfo($file2check['filename'], PATHINFO_BASENAME) == 'index.php' && file_put_contents(_PS_TRANSLATIONS_DIR_.'../'.$file2check['filename'], Tools::getDefaultIndexContent()))
continue;
AdminTranslationsController::checkAndAddMailsFiles($iso_code, $files_list);
$this->checkAndAddThemesFiles($files_list, $themes_selected);
$tab_errors = AdminTranslationsController::addNewTabs($iso_code, $files_list);