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()
|
protected function __construct()
|
||||||
{
|
{
|
||||||
$this->root_dir = dirname(dirname(__FILE__)).'/';
|
$this->root_dir = _PS_ROOT_DIR_.'/';
|
||||||
if (file_exists($this->root_dir.Autoload::INDEX_FILE))
|
if (file_exists($this->root_dir.Autoload::INDEX_FILE))
|
||||||
$this->index = include($this->root_dir.Autoload::INDEX_FILE);
|
$this->index = include($this->root_dir.Autoload::INDEX_FILE);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ class ControllerFactoryCore
|
|||||||
|
|
||||||
if (!class_exists($className, false))
|
if (!class_exists($className, false))
|
||||||
{
|
{
|
||||||
require_once(dirname(__FILE__).'/../controllers/'.$className.'.php');
|
require_once(_PS_ROOT_DIR_.'/controllers/'.$className.'.php');
|
||||||
if (file_exists(dirname(__FILE__).'/../override/controllers/'.$className.'.php'))
|
if (file_exists(_PS_ROOT_DIR_.'/override/controllers/'.$className.'.php'))
|
||||||
require_once(dirname(__FILE__).'/../override/controllers/'.$className.'.php');
|
require_once(_PS_ROOT_DIR_.'/override/controllers/'.$className.'.php');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$coreClass = new ReflectionClass($className.'Core');
|
$coreClass = new ReflectionClass($className.'Core');
|
||||||
|
|||||||
@@ -530,8 +530,8 @@ class LanguageCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if (file_exists($image_directory.$this->iso_code.$image))
|
if (file_exists($image_directory.$this->iso_code.$image))
|
||||||
unlink($image_directory.$this->iso_code.$image);
|
unlink($image_directory.$this->iso_code.$image);
|
||||||
if (file_exists(dirname(__FILE__).'/../img/l/'.$this->id.'.jpg'))
|
if (file_exists(_PS_ROOT_DIR_.'/img/l/'.$this->id.'.jpg'))
|
||||||
unlink(dirname(__FILE__).'/../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');
|
$flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/'.$iso_code.'.jpg');
|
||||||
if ($flag != null && !preg_match('/<body>/', $flag))
|
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)
|
if ($file)
|
||||||
{
|
{
|
||||||
fwrite($file, $flag);
|
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 (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to)
|
||||||
foreach ($files_copy as $file)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function _copyNoneFlag($id)
|
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;
|
protected static $_cache_language_installation = null;
|
||||||
|
|||||||
+2
-2
@@ -2089,7 +2089,7 @@ exit;
|
|||||||
}
|
}
|
||||||
else
|
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);
|
$zip = new PclZip($from_file);
|
||||||
return ($zip->privCheckFormat() === true);
|
return ($zip->privCheckFormat() === true);
|
||||||
}
|
}
|
||||||
@@ -2119,7 +2119,7 @@ exit;
|
|||||||
}
|
}
|
||||||
else
|
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);
|
$zip = new PclZip($from_file);
|
||||||
$list = $zip->extract(PCLZIP_OPT_PATH, $to_dir);
|
$list = $zip->extract(PCLZIP_OPT_PATH, $to_dir);
|
||||||
foreach ($list as $file)
|
foreach ($list as $file)
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (file_exists(dirname(__FILE__).'/../../config/settings.inc.php'))
|
if (file_exists(_PS_ROOT_DIR_.'/config/settings.inc.php'))
|
||||||
include_once(dirname(__FILE__).'/../../config/settings.inc.php');
|
include_once(_PS_ROOT_DIR_.'/config/settings.inc.php');
|
||||||
|
|
||||||
abstract class DbCore
|
abstract class DbCore
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ class AdminHomeControllerCore extends AdminController
|
|||||||
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
if (Configuration::get('PS_REWRITING_SETTINGS'))
|
||||||
{
|
{
|
||||||
$rewrite = 2;
|
$rewrite = 2;
|
||||||
if (!file_exists(dirname(__FILE__).'/../../.htaccess'))
|
if (!file_exists(_PS_ROOT_DIR_.'/.htaccess'))
|
||||||
$rewrite = 1;
|
$rewrite = 1;
|
||||||
else
|
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'])
|
if (strtotime(Db::getInstance()->getValue('SELECT date_upd FROM '._DB_PREFIX_.'configuration WHERE name = "PS_REWRITING_SETTINGS"')) > $stat['mtime'])
|
||||||
$rewrite = 0;
|
$rewrite = 0;
|
||||||
}
|
}
|
||||||
@@ -49,14 +49,14 @@ class AdminHomeControllerCore extends AdminController
|
|||||||
|
|
||||||
$htaccessAfterUpdate = 2;
|
$htaccessAfterUpdate = 2;
|
||||||
$htaccessOptimized = (Configuration::get('PS_HTACCESS_CACHE_CONTROL') ? 2 : 0);
|
$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'))
|
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL'))
|
||||||
$htaccessOptimized = 1;
|
$htaccessOptimized = 1;
|
||||||
}
|
}
|
||||||
else
|
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"');
|
$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'])
|
if (Configuration::get('PS_HTACCESS_CACHE_CONTROL') && strtotime($dateUpdHtaccess) > $stat['mtime'])
|
||||||
$htaccessOptimized = 1;
|
$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');
|
$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.');
|
$this->errors[] = Tools::displayError('Cannot load the localization pack.');
|
||||||
|
|
||||||
if (!$selection = Tools::getValue('selection'))
|
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');
|
$xml_localization = Tools::simplexml_load_file('http://api.prestashop.com/rss/localization.xml');
|
||||||
if (!$xml_localization)
|
if (!$xml_localization)
|
||||||
{
|
{
|
||||||
$localization_file = dirname(__FILE__).'/../../localization/localization.xml';
|
$localization_file = _PS_ROOT_DIR_.'/localization/localization.xml';
|
||||||
if (file_exists($localization_file))
|
if (file_exists($localization_file))
|
||||||
$xml_localization = simplexml_load_file($localization_file);
|
$xml_localization = simplexml_load_file($localization_file);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ class AdminPerformanceControllerCore extends AdminController
|
|||||||
if ($this->tabAccess['edit'] === '1')
|
if ($this->tabAccess['edit'] === '1')
|
||||||
{
|
{
|
||||||
$algo = (int)Tools::getValue('PS_CIPHER_ALGORITHM');
|
$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;
|
$new_settings = $prev_settings;
|
||||||
if ($algo)
|
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 there is not settings file modification or if the backup and replacement of the settings file worked
|
||||||
if ($new_settings == $prev_settings || (
|
if ($new_settings == $prev_settings || (
|
||||||
copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php')
|
copy(_PS_ROOT_DIR_.'/config/settings.inc.php', _PS_ROOT_DIR_.'/config/settings.old.php')
|
||||||
&& (bool)file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings)
|
&& (bool)file_put_contents(_PS_ROOT_DIR_.'/config/settings.inc.php', $new_settings)
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo);
|
Configuration::updateValue('PS_CIPHER_ALGORITHM', $algo);
|
||||||
@@ -705,7 +705,7 @@ class AdminPerformanceControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
if ($this->tabAccess['edit'] === '1')
|
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');
|
$cache_active = (bool)Tools::getValue('cache_active');
|
||||||
|
|
||||||
if ($caching_system = Tools::getValue('caching_system'))
|
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);
|
$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 there is not settings file modification or if the backup and replacement of the settings file worked
|
||||||
if ($new_settings == $prev_settings || (
|
if ($new_settings == $prev_settings || (
|
||||||
copy(dirname(__FILE__).'/../../config/settings.inc.php', dirname(__FILE__).'/../../config/settings.old.php')
|
copy(_PS_ROOT_DIR_.'/config/settings.inc.php', _PS_ROOT_DIR_.'/config/settings.old.php')
|
||||||
&& (bool)file_put_contents(dirname(__FILE__).'/../../config/settings.inc.php', $new_settings)
|
&& (bool)file_put_contents(_PS_ROOT_DIR_.'/config/settings.inc.php', $new_settings)
|
||||||
))
|
))
|
||||||
$redirectAdmin = true;
|
$redirectAdmin = true;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ class OrderControllerCore extends ParentOrderController
|
|||||||
$this->_assignCarrier();
|
$this->_assignCarrier();
|
||||||
$this->step = 2;
|
$this->step = 2;
|
||||||
$this->displayContent();
|
$this->displayContent();
|
||||||
include(dirname(__FILE__).'/../footer.php');
|
include(_PS_ROOT_DIR_.'/footer.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$orderTotal = $this->context->cart->getOrderTotal();
|
$orderTotal = $this->context->cart->getOrderTotal();
|
||||||
|
|||||||
Reference in New Issue
Block a user