changed path from dirname(__FILE__) to PS_ROOT_DIR

This commit is contained in:
emilien-puget
2013-10-24 11:44:52 +02:00
parent 9a7c3dd88f
commit 92c2f6953f
9 changed files with 26 additions and 26 deletions
+4 -4
View File
@@ -37,11 +37,11 @@ class AdminHomeControllerCore extends AdminController
if (Configuration::get('PS_REWRITING_SETTINGS'))
{
$rewrite = 2;
if (!file_exists(dirname(__FILE__).'/../../.htaccess'))
if (!file_exists(_PS_ROOT_DIR_.'/.htaccess'))
$rewrite = 1;
else
{
$stat = stat(dirname(__FILE__).'/../../.htaccess');
$stat = stat(_PS_ROOT_DIR_.'/.htaccess');
if (strtotime(Db::getInstance()->getValue('SELECT date_upd FROM '._DB_PREFIX_.'configuration WHERE name = "PS_REWRITING_SETTINGS"')) > $stat['mtime'])
$rewrite = 0;
}
@@ -49,14 +49,14 @@ class AdminHomeControllerCore extends AdminController
$htaccessAfterUpdate = 2;
$htaccessOptimized = (Configuration::get('PS_HTACCESS_CACHE_CONTROL') ? 2 : 0);
if (!file_exists(dirname(__FILE__).'/../../.htaccess'))
if (!file_exists(_PS_ROOT_DIR_.'/.htaccess'))
{
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL'))
$htaccessOptimized = 1;
}
else
{
$stat = stat(dirname(__FILE__).'/../../.htaccess');
$stat = stat(_PS_ROOT_DIR_.'/.htaccess');
$dateUpdHtaccess = Db::getInstance()->getValue('SELECT date_upd FROM '._DB_PREFIX_.'configuration WHERE name = "PS_HTACCESS_CACHE_CONTROL"');
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL') && strtotime($dateUpdHtaccess) > $stat['mtime'])
$htaccessOptimized = 1;
@@ -150,7 +150,7 @@ class AdminLocalizationControllerCore extends AdminController
$pack = @Tools::file_get_contents('http://api.prestashop.com/localization/'.$version.'/'.Tools::getValue('iso_localization_pack').'.xml');
if (!$pack && !($pack = @Tools::file_get_contents(dirname(__FILE__).'/../../localization/'.Tools::getValue('iso_localization_pack').'.xml')))
if (!$pack && !($pack = @Tools::file_get_contents(_PS_ROOT_DIR_.'/localization/'.Tools::getValue('iso_localization_pack').'.xml')))
$this->errors[] = Tools::displayError('Cannot load the localization pack.');
if (!$selection = Tools::getValue('selection'))
@@ -192,7 +192,7 @@ class AdminLocalizationControllerCore extends AdminController
$xml_localization = Tools::simplexml_load_file('http://api.prestashop.com/rss/localization.xml');
if (!$xml_localization)
{
$localization_file = dirname(__FILE__).'/../../localization/localization.xml';
$localization_file = _PS_ROOT_DIR_.'/localization/localization.xml';
if (file_exists($localization_file))
$xml_localization = simplexml_load_file($localization_file);
}
@@ -652,7 +652,7 @@ class AdminPerformanceControllerCore extends AdminController
if ($this->tabAccess['edit'] === '1')
{
$algo = (int)Tools::getValue('PS_CIPHER_ALGORITHM');
$prev_settings = file_get_contents(dirname(__FILE__).'/../../config/settings.inc.php');
$prev_settings = file_get_contents(_PS_ROOT_DIR_.'/config/settings.inc.php');
$new_settings = $prev_settings;
if ($algo)
{
@@ -686,8 +686,8 @@ class AdminPerformanceControllerCore extends AdminController
{
// If there is not settings file modification or if the backup and replacement of the settings file worked
if ($new_settings == $prev_settings || (
copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php')
&& (bool)file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings)
copy(_PS_ROOT_DIR_.'/config/settings.inc.php', _PS_ROOT_DIR_.'/config/settings.old.php')
&& (bool)file_put_contents(_PS_ROOT_DIR_.'/config/settings.inc.php', $new_settings)
))
{
Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo);
@@ -705,7 +705,7 @@ class AdminPerformanceControllerCore extends AdminController
{
if ($this->tabAccess['edit'] === '1')
{
$new_settings = $prev_settings = file_get_contents(dirname(__FILE__).'/../../config/settings.inc.php');
$new_settings = $prev_settings = file_get_contents(_PS_ROOT_DIR_.'/config/settings.inc.php');
$cache_active = (bool)Tools::getValue('cache_active');
if ($caching_system = Tools::getValue('caching_system'))
@@ -762,8 +762,8 @@ class AdminPerformanceControllerCore extends AdminController
$new_settings = preg_replace('/define\(\'_PS_CACHE_ENABLED_\', \'([01]?)\'\);/Ui', 'define(\'_PS_CACHE_ENABLED_\', \''.(int)$cache_active.'\');', $new_settings);
// If there is not settings file modification or if the backup and replacement of the settings file worked
if ($new_settings == $prev_settings || (
copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php')
&& (bool)file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings)
copy(_PS_ROOT_DIR_.'/config/settings.inc.php', _PS_ROOT_DIR_.'/config/settings.old.php')
&& (bool)file_put_contents(_PS_ROOT_DIR_.'/config/settings.inc.php', $new_settings)
))
$redirectAdmin = true;
else