Merge pull request #881 from emilien-puget/bootstrap
// changed path from dirname(__FILE__) to PS_ROOT_DIR
This commit is contained in:
@@ -51,7 +51,7 @@ class Autoload
|
||||
|
||||
protected function __construct()
|
||||
{
|
||||
$this->root_dir = dirname(dirname(__FILE__)).'/';
|
||||
$this->root_dir = _PS_ROOT_DIR_.'/';
|
||||
if (file_exists($this->root_dir.Autoload::INDEX_FILE))
|
||||
$this->index = include($this->root_dir.Autoload::INDEX_FILE);
|
||||
else
|
||||
|
||||
@@ -40,9 +40,9 @@ class ControllerFactoryCore
|
||||
|
||||
if (!class_exists($className, false))
|
||||
{
|
||||
require_once(dirname(__FILE__).'/../controllers/'.$className.'.php');
|
||||
if (file_exists(dirname(__FILE__).'/../override/controllers/'.$className.'.php'))
|
||||
require_once(dirname(__FILE__).'/../override/controllers/'.$className.'.php');
|
||||
require_once(_PS_ROOT_DIR_.'/controllers/'.$className.'.php');
|
||||
if (file_exists(_PS_ROOT_DIR_.'/override/controllers/'.$className.'.php'))
|
||||
require_once(_PS_ROOT_DIR_.'/override/controllers/'.$className.'.php');
|
||||
else
|
||||
{
|
||||
$coreClass = new ReflectionClass($className.'Core');
|
||||
|
||||
@@ -530,8 +530,8 @@ class LanguageCore extends ObjectModel
|
||||
{
|
||||
if (file_exists($image_directory.$this->iso_code.$image))
|
||||
unlink($image_directory.$this->iso_code.$image);
|
||||
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
|
||||
unlink(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg');
|
||||
if (file_exists(_PS_ROOT_DIR_.'/img/l/'.$this->id.'.jpg'))
|
||||
unlink(_PS_ROOT_DIR_.'/img/l/'.$this->id.'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +716,7 @@ class LanguageCore extends ObjectModel
|
||||
$flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/'.$iso_code.'.jpg');
|
||||
if ($flag != null && !preg_match('/<body>/', $flag))
|
||||
{
|
||||
$file = fopen(dirname(__FILE__).'/../img/l/'.(int)$lang->id.'.jpg', 'w');
|
||||
$file = fopen(_PS_ROOT_DIR_.'/img/l/'.(int)$lang->id.'.jpg', 'w');
|
||||
if ($file)
|
||||
{
|
||||
fwrite($file, $flag);
|
||||
@@ -740,14 +740,14 @@ class LanguageCore extends ObjectModel
|
||||
|
||||
foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
|
||||
foreach ($files_copy as $file)
|
||||
@copy(dirname(__FILE__).'/../img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
@copy(_PS_ROOT_DIR_.'/img/l'.$file, $to.str_replace('/en', '/'.$iso_code, $file));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function _copyNoneFlag($id)
|
||||
{
|
||||
return copy(dirname(__FILE__).'/../img/l/none.jpg', dirname(__FILE__).'/../img/l/'.$id.'.jpg');
|
||||
return copy(_PS_ROOT_DIR_.'/img/l/none.jpg', _PS_ROOT_DIR_.'/img/l/'.$id.'.jpg');
|
||||
}
|
||||
|
||||
protected static $_cache_language_installation = null;
|
||||
|
||||
+2
-2
@@ -2089,7 +2089,7 @@ exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(dirname(__FILE__).'/../tools/pclzip/pclzip.lib.php');
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
return ($zip->privCheckFormat() === true);
|
||||
}
|
||||
@@ -2119,7 +2119,7 @@ exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(dirname(__FILE__).'/../tools/pclzip/pclzip.lib.php');
|
||||
require_once(_PS_ROOT_DIR_.'/tools/pclzip/pclzip.lib.php');
|
||||
$zip = new PclZip($from_file);
|
||||
$list = $zip->extract(PCLZIP_OPT_PATH, $to_dir);
|
||||
foreach ($list as $file)
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (file_exists(dirname(__FILE__).'/../../config/settings.inc.php'))
|
||||
include_once(dirname(__FILE__).'/../../config/settings.inc.php');
|
||||
if (file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php'))
|
||||
include_once(_PS_ROOT_DIR_.'/config/settings.inc.php');
|
||||
|
||||
abstract class DbCore
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -314,7 +314,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
$this->_assignCarrier();
|
||||
$this->step = 2;
|
||||
$this->displayContent();
|
||||
include(dirname(__FILE__).'/../footer.php');
|
||||
include(_PS_ROOT_DIR_.'/footer.php');
|
||||
exit;
|
||||
}
|
||||
$orderTotal = $this->context->cart->getOrderTotal();
|
||||
|
||||
Reference in New Issue
Block a user