//added methode to write default content in index.php file && added check in translation pack import
This commit is contained in:
@@ -1683,6 +1683,47 @@ FileETag INode MTime Size
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getDefaultIndexContent()
|
||||
{
|
||||
return '<?php
|
||||
/*
|
||||
* 2007-'.date('Y').' PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-'.date('Y').' PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* jsonDecode convert json string to php array / object
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user