PageRenderTime 56ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/config/config.inc.php

https://bitbucket.org/yhjohn/ayanapure.com
PHP | 187 lines | 112 code | 26 blank | 49 comment | 30 complexity | 9c3a90b62faa4b8a9cdf676935e79a57 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0
  1. <?php
  2. /*
  3. * 2007-2012 PrestaShop
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@prestashop.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  18. * versions in the future. If you wish to customize PrestaShop for your
  19. * needs please refer to http://www.prestashop.com for more information.
  20. *
  21. * @author PrestaShop SA <contact@prestashop.com>
  22. * @copyright 2007-2012 PrestaShop SA
  23. * @version Release: $Revision: 7331 $
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. * International Registered Trademark & Property of PrestaShop SA
  26. */
  27. /* Debug only */
  28. @ini_set('display_errors', 'off');
  29. define('_PS_DEBUG_SQL_', false);
  30. $start_time = microtime(true);
  31. /* Compatibility warning */
  32. define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
  33. /* SSL configuration */
  34. define('_PS_SSL_PORT_', 443);
  35. /* Improve PHP configuration to prevent issues */
  36. ini_set('upload_max_filesize', '100M');
  37. ini_set('default_charset', 'utf-8');
  38. ini_set('magic_quotes_runtime', 0);
  39. /* correct Apache charset (except if it's too late */
  40. if (!headers_sent())
  41. header('Content-Type: text/html; charset=utf-8');
  42. /* No settings file? goto installer... */
  43. if (!file_exists(dirname(__FILE__).'/settings.inc.php'))
  44. {
  45. $dir = ((substr($_SERVER['REQUEST_URI'], -1) == '/' || is_dir($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : dirname($_SERVER['REQUEST_URI']).'/');
  46. if (!file_exists(dirname(__FILE__).'/../install'))
  47. die('Error: "install" directory is missing');
  48. header('Location: install/');
  49. exit;
  50. }
  51. require_once(dirname(__FILE__).'/settings.inc.php');
  52. require_once(dirname(__FILE__).'/defines.inc.php');
  53. require_once(dirname(__FILE__).'/autoload.php');
  54. if (_PS_DEBUG_PROFILING_)
  55. {
  56. include_once(_PS_TOOL_DIR_.'profiling/Controller.php');
  57. include_once(_PS_TOOL_DIR_.'profiling/ObjectModel.php');
  58. include_once(_PS_TOOL_DIR_.'profiling/Hook.php');
  59. include_once(_PS_TOOL_DIR_.'profiling/Db.php');
  60. }
  61. /* Redefine REQUEST_URI if empty (on some webservers...) */
  62. if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
  63. {
  64. if (!isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['SCRIPT_FILENAME']))
  65. $_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME'];
  66. if (isset($_SERVER['SCRIPT_NAME']))
  67. {
  68. if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && empty($_SERVER['QUERY_STRING']))
  69. $_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']).'/';
  70. else
  71. {
  72. $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
  73. if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))
  74. $_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
  75. }
  76. }
  77. }
  78. /* Trying to redefine HTTP_HOST if empty (on some webservers...) */
  79. if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
  80. $_SERVER['HTTP_HOST'] = @getenv('HTTP_HOST');
  81. /* Initialize the current Shop */
  82. Context::getContext()->shop = Shop::initialize();
  83. define('_THEME_NAME_', Context::getContext()->shop->getTheme());
  84. define('__PS_BASE_URI__', Context::getContext()->shop->getBaseURI());
  85. /* Include all defines related to base uri and theme name */
  86. require_once(dirname(__FILE__).'/defines_uri.inc.php');
  87. global $_MODULES;
  88. $_MODULES = array();
  89. /* Load configuration */
  90. Configuration::loadConfiguration();
  91. /* Load all languages */
  92. Language::loadLanguages();
  93. /* Loading default country */
  94. $defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
  95. Context::getContext()->country = $defaultCountry;
  96. /* It is not safe to rely on the system's timezone settings, and this would generate a PHP Strict Standards notice. */
  97. @date_default_timezone_set(Configuration::get('PS_TIMEZONE'));
  98. /* Instantiate cookie */
  99. $cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
  100. if (defined('_PS_ADMIN_DIR_'))
  101. $cookie = new Cookie('psAdmin', '', $cookieLifetime);
  102. else
  103. {
  104. if (Context::getContext()->shop->getGroup()->share_order)
  105. $cookie = new Cookie('ps-sg'.Context::getContext()->shop->getGroup()->id, '', $cookieLifetime, Context::getContext()->shop->getUrlsSharedCart());
  106. else
  107. $cookie = new Cookie('ps-s'.Context::getContext()->shop->id, '', $cookieLifetime);
  108. }
  109. Context::getContext()->cookie = $cookie;
  110. /* Create employee if in BO, customer else */
  111. if (defined('_PS_ADMIN_DIR_'))
  112. {
  113. $employee = new Employee($cookie->id_employee);
  114. Context::getContext()->employee = $employee;
  115. /* Auth on shops are recached after employee assignation */
  116. if ($employee->id_profile != _PS_ADMIN_PROFILE_)
  117. Shop::cacheShops(true);
  118. $cookie->id_lang = (int)$employee->id_lang;
  119. }
  120. else
  121. {
  122. if (isset($cookie->id_customer) && (int)$cookie->id_customer)
  123. {
  124. $customer = new Customer($cookie->id_customer);
  125. $customer->logged = $cookie->logged;
  126. }
  127. else
  128. {
  129. $customer = new Customer();
  130. // Change the default group
  131. if (Group::isFeatureActive())
  132. $customer->id_default_group = Configuration::get('PS_UNIDENTIFIED_GROUP');
  133. }
  134. $customer->id_guest = $cookie->id_guest;
  135. Context::getContext()->customer = $customer;
  136. }
  137. /* if the language stored in the cookie is not available language, use default language */
  138. if (isset($cookie->id_lang) && $cookie->id_lang)
  139. $language = new Language($cookie->id_lang);
  140. if (!isset($language) || !Validate::isLoadedObject($language))
  141. $language = new Language(Configuration::get('PS_LANG_DEFAULT'));
  142. Context::getContext()->language = $language;
  143. /**
  144. * @deprecated : these defines are going to be deleted on 1.6 version of Prestashop
  145. * USE : Configuration::get() method in order to getting the id of order state
  146. */
  147. define('_PS_OS_CHEQUE_', Configuration::get('PS_OS_CHEQUE'));
  148. define('_PS_OS_PAYMENT_', Configuration::get('PS_OS_PAYMENT'));
  149. define('_PS_OS_PREPARATION_', Configuration::get('PS_OS_PREPARATION'));
  150. define('_PS_OS_SHIPPING_', Configuration::get('PS_OS_SHIPPING'));
  151. define('_PS_OS_DELIVERED_', Configuration::get('PS_OS_DELIVERED'));
  152. define('_PS_OS_CANCELED_', Configuration::get('PS_OS_CANCELED'));
  153. define('_PS_OS_REFUND_', Configuration::get('PS_OS_REFUND'));
  154. define('_PS_OS_ERROR_', Configuration::get('PS_OS_ERROR'));
  155. define('_PS_OS_OUTOFSTOCK_', Configuration::get('PS_OS_OUTOFSTOCK'));
  156. define('_PS_OS_BANKWIRE_', Configuration::get('PS_OS_BANKWIRE'));
  157. define('_PS_OS_PAYPAL_', Configuration::get('PS_OS_PAYPAL'));
  158. define('_PS_OS_WS_PAYMENT_', Configuration::get('PS_OS_WS_PAYMENT'));
  159. /* Get smarty */
  160. require_once(dirname(__FILE__).'/smarty.config.inc.php');
  161. Context::getContext()->smarty = $smarty;