200 lines
6.9 KiB
PHP
200 lines
6.9 KiB
PHP
|
|
<?php
|
||
|
|
/**
|
||
|
|
* For the full copyright and license information, please view the
|
||
|
|
* docs/licenses/LICENSE.txt file that was distributed with this source code.
|
||
|
|
*/
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Debug mode
|
||
|
|
*
|
||
|
|
* Change this to true to enable the display of notices and deprecations during development.
|
||
|
|
* It's strongly recommended to use this mode when developing modules and themes, to avoid any hidden issues.
|
||
|
|
* Don't forget to disable debug mode in production - produces a significant performance hit.
|
||
|
|
* The code below can be also managed by settings in backoffice. The interface hardcodes the value into this file.
|
||
|
|
*/
|
||
|
|
if (!defined('_PS_MODE_DEV_')) {
|
||
|
|
define('_PS_MODE_DEV_', true);
|
||
|
|
}
|
||
|
|
if (!defined('_PS_DISPLAY_COMPATIBILITY_WARNING_')) {
|
||
|
|
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
|
||
|
|
}
|
||
|
|
if (!defined('_PS_DISPLAY_ONLY_ERRORS_')) {
|
||
|
|
define('_PS_DISPLAY_ONLY_ERRORS_', false);
|
||
|
|
}
|
||
|
|
if (_PS_MODE_DEV_ === true) {
|
||
|
|
$errorReportingLevel = E_ALL;
|
||
|
|
if (_PS_DISPLAY_COMPATIBILITY_WARNING_ === false) {
|
||
|
|
$errorReportingLevel = $errorReportingLevel & ~E_DEPRECATED & ~E_USER_DEPRECATED;
|
||
|
|
}
|
||
|
|
if (_PS_DISPLAY_ONLY_ERRORS_ !== false) {
|
||
|
|
$errorReportingLevel = $errorReportingLevel & ~E_WARNING & ~E_NOTICE;
|
||
|
|
}
|
||
|
|
@ini_set('display_errors', 'on');
|
||
|
|
@error_reporting($errorReportingLevel);
|
||
|
|
define('_PS_DEBUG_SQL_', true);
|
||
|
|
} else {
|
||
|
|
@ini_set('display_errors', 'off');
|
||
|
|
define('_PS_DEBUG_SQL_', false);
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
* Debug profiler
|
||
|
|
*
|
||
|
|
* Enabling this will display performance related information under each page and help you find
|
||
|
|
* performance bottlenecks.
|
||
|
|
* The code below can be also managed by settings in backoffice. The interface hardcodes the value into this file.
|
||
|
|
*/
|
||
|
|
if (!defined('_PS_DEBUG_PROFILING_')) {
|
||
|
|
define('_PS_DEBUG_PROFILING_', false);
|
||
|
|
}
|
||
|
|
if (!defined('_PS_MODE_DEMO_')) {
|
||
|
|
define('_PS_MODE_DEMO_', false);
|
||
|
|
}
|
||
|
|
if (!defined('_PS_ALLOW_MULTI_STATEMENTS_QUERIES_')) {
|
||
|
|
define('_PS_ALLOW_MULTI_STATEMENTS_QUERIES_', false);
|
||
|
|
}
|
||
|
|
|
||
|
|
$currentDir = dirname(__FILE__);
|
||
|
|
|
||
|
|
if (!defined('_PS_ROOT_DIR_') && (getenv('_PS_ROOT_DIR_') || getenv('REDIRECT__PS_ROOT_DIR_'))) {
|
||
|
|
define('_PS_ROOT_DIR_', getenv('_PS_ROOT_DIR_') ? getenv('_PS_ROOT_DIR_') : getenv('REDIRECT__PS_ROOT_DIR_'));
|
||
|
|
}
|
||
|
|
|
||
|
|
/* Directories */
|
||
|
|
if (!defined('_PS_ROOT_DIR_')) {
|
||
|
|
define('_PS_ROOT_DIR_', realpath($currentDir.'/..'));
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!defined('_PS_CORE_DIR_')) {
|
||
|
|
define('_PS_CORE_DIR_', realpath($currentDir.'/..'));
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!defined('_PS_ALL_THEMES_DIR_')) {
|
||
|
|
define('_PS_ALL_THEMES_DIR_', _PS_ROOT_DIR_.'/themes/');
|
||
|
|
}
|
||
|
|
/* BO THEMES */
|
||
|
|
if (defined('_PS_ADMIN_DIR_')) {
|
||
|
|
define('_PS_BO_ALL_THEMES_DIR_', _PS_ADMIN_DIR_.'/themes/');
|
||
|
|
}
|
||
|
|
|
||
|
|
// Find if we are running under a Symfony command
|
||
|
|
$cliEnvValue = null;
|
||
|
|
if (isset($argv) && is_array($argv)) {
|
||
|
|
if (in_array('--env', $argv)) {
|
||
|
|
$cliEnvValue = $argv[array_search('--env', $argv) + 1];
|
||
|
|
} elseif (in_array('-e', $argv)) {
|
||
|
|
$cliEnvValue = $argv[array_search('-e', $argv) + 1];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ((defined('_PS_IN_TEST_') && _PS_IN_TEST_)
|
||
|
|
|| $cliEnvValue === 'test'
|
||
|
|
) {
|
||
|
|
define('_PS_ENV_', 'test');
|
||
|
|
} else {
|
||
|
|
define('_PS_ENV_', _PS_MODE_DEV_ ? 'dev': 'prod');
|
||
|
|
}
|
||
|
|
|
||
|
|
// This legacy const is used in many legacy components (smarty, parameters caching, ...) We don't change this one
|
||
|
|
// to follow the multiple kernel's that each have their own cache folder, so the root folder of each environment
|
||
|
|
// (dev, prod, test) will contain some cache folder common to all the kernels, it simplifies the cache clearing
|
||
|
|
// for legacy codes since they only need to clear one cache and not three
|
||
|
|
if (!defined('_PS_CACHE_DIR_')) {
|
||
|
|
define('_PS_CACHE_DIR_', _PS_ROOT_DIR_.'/var/cache/' . _PS_ENV_ . DIRECTORY_SEPARATOR);
|
||
|
|
}
|
||
|
|
|
||
|
|
define('_PS_CONFIG_DIR_', _PS_CORE_DIR_.'/config/');
|
||
|
|
define('_PS_CUSTOM_CONFIG_FILE_', _PS_CONFIG_DIR_.'settings_custom.inc.php');
|
||
|
|
define('_PS_CLASS_DIR_', _PS_CORE_DIR_.'/classes/');
|
||
|
|
if (!defined('_PS_DOWNLOAD_DIR_')) {
|
||
|
|
$dir = (defined('_PS_IN_TEST_') && _PS_IN_TEST_) ? '/tests/Resources/download/' : '/download/';
|
||
|
|
define('_PS_DOWNLOAD_DIR_', _PS_ROOT_DIR_.$dir);
|
||
|
|
}
|
||
|
|
define('_PS_MAIL_DIR_', _PS_CORE_DIR_.'/mails/');
|
||
|
|
if (!defined('_PS_MODULE_DIR_')) {
|
||
|
|
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_.'/modules/');
|
||
|
|
}
|
||
|
|
if (!defined('_PS_OVERRIDE_DIR_')) {
|
||
|
|
define('_PS_OVERRIDE_DIR_', _PS_ROOT_DIR_.'/override/');
|
||
|
|
}
|
||
|
|
define('_PS_PDF_DIR_', _PS_CORE_DIR_.'/pdf/');
|
||
|
|
define('_PS_TRANSLATIONS_DIR_', _PS_ROOT_DIR_.'/translations/');
|
||
|
|
if (!defined('_PS_UPLOAD_DIR_')) {
|
||
|
|
define('_PS_UPLOAD_DIR_', _PS_ROOT_DIR_.'/upload/');
|
||
|
|
}
|
||
|
|
define('_PS_CONTROLLER_DIR_', _PS_CORE_DIR_.'/controllers/');
|
||
|
|
define('_PS_ADMIN_CONTROLLER_DIR_', _PS_CORE_DIR_.'/controllers/admin/');
|
||
|
|
define('_PS_FRONT_CONTROLLER_DIR_', _PS_CORE_DIR_.'/controllers/front/');
|
||
|
|
|
||
|
|
define('_PS_TOOL_DIR_', _PS_CORE_DIR_.'/tools/');
|
||
|
|
if (!defined('_PS_GEOIP_DIR_')) {
|
||
|
|
define('_PS_GEOIP_DIR_', _PS_CORE_DIR_.'/app/Resources/geoip/');
|
||
|
|
}
|
||
|
|
if (!defined('_PS_GEOIP_CITY_FILE_')) {
|
||
|
|
define('_PS_GEOIP_CITY_FILE_', 'GeoLite2-City.mmdb');
|
||
|
|
}
|
||
|
|
|
||
|
|
define('_PS_VENDOR_DIR_', _PS_CORE_DIR_.'/vendor/');
|
||
|
|
|
||
|
|
define('_PS_IMG_SOURCE_DIR_', _PS_ROOT_DIR_.'/img/');
|
||
|
|
if (!defined('_PS_IMG_DIR_')) {
|
||
|
|
$dir = (defined('_PS_IN_TEST_') && _PS_IN_TEST_) ? '/tests/Resources/img/' : '/img/';
|
||
|
|
define('_PS_IMG_DIR_', _PS_ROOT_DIR_.$dir);
|
||
|
|
}
|
||
|
|
|
||
|
|
define('_PS_CORE_IMG_DIR_', _PS_CORE_DIR_.'/img/');
|
||
|
|
define('_PS_CAT_IMG_DIR_', _PS_IMG_DIR_.'c/');
|
||
|
|
define('_PS_COL_IMG_DIR_', _PS_IMG_DIR_.'co/');
|
||
|
|
define('_PS_EMPLOYEE_IMG_DIR_', _PS_IMG_DIR_.'e/');
|
||
|
|
define('_PS_GENDERS_DIR_', _PS_IMG_DIR_.'genders/');
|
||
|
|
define('_PS_LANG_IMG_DIR_', _PS_IMG_DIR_.'l/');
|
||
|
|
define('_PS_MANU_IMG_DIR_', _PS_IMG_DIR_.'m/');
|
||
|
|
define('_PS_ORDER_STATE_IMG_DIR_', _PS_IMG_DIR_.'os/');
|
||
|
|
define('_PS_PRODUCT_IMG_DIR_', _PS_IMG_DIR_ . 'p/');
|
||
|
|
define('_PS_PROFILE_IMG_DIR_', _PS_IMG_DIR_.'pr/');
|
||
|
|
define('_PS_SHIP_IMG_DIR_', _PS_IMG_DIR_.'s/');
|
||
|
|
define('_PS_STORE_IMG_DIR_', _PS_IMG_DIR_.'st/');
|
||
|
|
define('_PS_SUPP_IMG_DIR_', _PS_IMG_DIR_.'su/');
|
||
|
|
define('_PS_TMP_IMG_DIR_', _PS_IMG_DIR_.'tmp/');
|
||
|
|
|
||
|
|
/* Settings php */
|
||
|
|
define('_PS_TRANS_PATTERN_', '(.*[^\\\\])');
|
||
|
|
|
||
|
|
/* Tax behavior */
|
||
|
|
define('PS_TAX_EXC', 1);
|
||
|
|
define('PS_TAX_INC', 0);
|
||
|
|
|
||
|
|
// Rounding
|
||
|
|
// Note - since PHP 8.4, there is also a new rounding modes in round()
|
||
|
|
// PHP_ROUND_CEILING, PHP_ROUND_FLOOR, PHP_ROUND_TOWARD_ZERO, PHP_ROUND_AWAY_FROM_ZERO
|
||
|
|
define('PS_ROUND_UP', 0);
|
||
|
|
define('PS_ROUND_DOWN', 1);
|
||
|
|
// PHP value PHP_ROUND_HALF_UP is 1
|
||
|
|
define('PS_ROUND_HALF_UP', 2);
|
||
|
|
// PHP value PHP_ROUND_HALF_DOWN is 2
|
||
|
|
define('PS_ROUND_HALF_DOWN', 3);
|
||
|
|
// PHP value PHP_ROUND_HALF_EVEN is 3
|
||
|
|
define('PS_ROUND_HALF_EVEN', 4);
|
||
|
|
// PHP value PHP_ROUND_HALF_ODD is 4
|
||
|
|
define('PS_ROUND_HALF_ODD', 5);
|
||
|
|
|
||
|
|
/* SQL Replication management */
|
||
|
|
define('_PS_USE_SQL_SLAVE_', false);
|
||
|
|
|
||
|
|
/* PS Technical configuration */
|
||
|
|
define('_PS_ADMIN_PROFILE_', 1);
|
||
|
|
|
||
|
|
/* Cache */
|
||
|
|
define('_PS_CACHEFS_DIRECTORY_', _PS_ROOT_DIR_.'/cache/cachefs/');
|
||
|
|
|
||
|
|
/* Geolocation */
|
||
|
|
define('_PS_GEOLOCATION_NO_CATALOG_', 0);
|
||
|
|
define('_PS_GEOLOCATION_NO_ORDER_', 1);
|
||
|
|
|
||
|
|
/* Smarty */
|
||
|
|
define('_PS_SMARTY_NO_COMPILE_', 0);
|
||
|
|
define('_PS_SMARTY_CHECK_COMPILE_', 1);
|
||
|
|
define('_PS_SMARTY_FORCE_COMPILE_', 2);
|
||
|
|
|
||
|
|
define('_PS_CACHE_CA_CERT_FILE_', _PS_CACHE_DIR_.'cacert.pem');
|