PageRenderTime 4ms CodeModel.GetById 47ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/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
  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
 28/* Debug only */
 29@ini_set('display_errors', 'off');
 30define('_PS_DEBUG_SQL_', false);
 31
 32$start_time = microtime(true);
 33
 34/* Compatibility warning */
 35define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
 36
 37/* SSL configuration */
 38define('_PS_SSL_PORT_', 443);
 39
 40/* Improve PHP configuration to prevent issues */
 41ini_set('upload_max_filesize', '100M');
 42ini_set('default_charset', 'utf-8');
 43ini_set('magic_quotes_runtime', 0);
 44
 45/* correct Apache charset (except if it's too late */
 46if (!headers_sent())
 47	header('Content-Type: text/html; charset=utf-8');
 48
 49/* No settings file? goto installer... */
 50if (!file_exists(dirname(__FILE__).'/settings.inc.php'))
 51{
 52	$dir = ((substr($_SERVER['REQUEST_URI'], -1) == '/' || is_dir($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : dirname($_SERVER['REQUEST_URI']).'/');
 53	if (!file_exists(dirname(__FILE__).'/../install'))
 54		die('Error: "install" directory is missing');
 55	header('Location: install/');
 56	exit;
 57}
 58
 59require_once(dirname(__FILE__).'/settings.inc.php');
 60require_once(dirname(__FILE__).'/defines.inc.php');
 61require_once(dirname(__FILE__).'/autoload.php');
 62
 63if (_PS_DEBUG_PROFILING_)
 64{
 65	include_once(_PS_TOOL_DIR_.'profiling/Controller.php');
 66	include_once(_PS_TOOL_DIR_.'profiling/ObjectModel.php');
 67	include_once(_PS_TOOL_DIR_.'profiling/Hook.php');
 68	include_once(_PS_TOOL_DIR_.'profiling/Db.php');
 69}
 70
 71/* Redefine REQUEST_URI if empty (on some webservers...) */
 72if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
 73{
 74	if (!isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['SCRIPT_FILENAME']))
 75		$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME'];
 76	if (isset($_SERVER['SCRIPT_NAME']))
 77	{
 78		if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && empty($_SERVER['QUERY_STRING']))
 79			$_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']).'/';
 80		else
 81		{
 82			$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
 83			if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))
 84				$_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
 85		}
 86	}
 87}
 88
 89/* Trying to redefine HTTP_HOST if empty (on some webservers...) */
 90if (!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
 91	$_SERVER['HTTP_HOST'] = @getenv('HTTP_HOST');
 92
 93/* Initialize the current Shop */
 94Context::getContext()->shop = Shop::initialize();
 95define('_THEME_NAME_', Context::getContext()->shop->getTheme());
 96define('__PS_BASE_URI__', Context::getContext()->shop->getBaseURI());
 97
 98/* Include all defines related to base uri and theme name */
 99require_once(dirname(__FILE__).'/defines_uri.inc.php');
100
101global $_MODULES;
102$_MODULES = array();
103
104/* Load configuration */
105Configuration::loadConfiguration();
106
107/* Load all languages */
108Language::loadLanguages();
109
110/* Loading default country */
111$defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
112Context::getContext()->country = $defaultCountry;
113
114/* It is not safe to rely on the system's timezone settings, and this would generate a PHP Strict Standards notice. */
115@date_default_timezone_set(Configuration::get('PS_TIMEZONE'));
116
117/* Instantiate cookie */
118$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
119if (defined('_PS_ADMIN_DIR_'))
120	$cookie = new Cookie('psAdmin', '', $cookieLifetime);
121else
122{
123	if (Context::getContext()->shop->getGroup()->share_order)
124		$cookie = new Cookie('ps-sg'.Context::getContext()->shop->getGroup()->id, '', $cookieLifetime, Context::getContext()->shop->getUrlsSharedCart());
125	else
126		$cookie = new Cookie('ps-s'.Context::getContext()->shop->id, '', $cookieLifetime);
127}
128
129Context::getContext()->cookie = $cookie;
130/* Create employee if in BO, customer else */
131if (defined('_PS_ADMIN_DIR_'))
132{
133	$employee = new Employee($cookie->id_employee);
134	Context::getContext()->employee = $employee;
135
136	/* Auth on shops are recached after employee assignation */
137	if ($employee->id_profile != _PS_ADMIN_PROFILE_)
138		Shop::cacheShops(true);
139
140	$cookie->id_lang = (int)$employee->id_lang;
141}
142else
143{
144	if (isset($cookie->id_customer) && (int)$cookie->id_customer)
145	{
146		$customer = new Customer($cookie->id_customer);
147		$customer->logged = $cookie->logged;
148	}
149	else
150	{
151		$customer = new Customer();
152		
153		// Change the default group 
154		if (Group::isFeatureActive())
155			$customer->id_default_group = Configuration::get('PS_UNIDENTIFIED_GROUP');
156	}
157	$customer->id_guest = $cookie->id_guest;
158	Context::getContext()->customer = $customer;
159}
160
161/* if the language stored in the cookie is not available language, use default language */
162if (isset($cookie->id_lang) && $cookie->id_lang)
163	$language = new Language($cookie->id_lang);
164if (!isset($language) || !Validate::isLoadedObject($language))
165	$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
166Context::getContext()->language = $language;
167
168/**
169 * @deprecated : these defines are going to be deleted on 1.6 version of Prestashop
170 * USE : Configuration::get() method in order to getting the id of order state
171 */
172define('_PS_OS_CHEQUE_',      Configuration::get('PS_OS_CHEQUE'));
173define('_PS_OS_PAYMENT_',     Configuration::get('PS_OS_PAYMENT'));
174define('_PS_OS_PREPARATION_', Configuration::get('PS_OS_PREPARATION'));
175define('_PS_OS_SHIPPING_',    Configuration::get('PS_OS_SHIPPING'));
176define('_PS_OS_DELIVERED_',   Configuration::get('PS_OS_DELIVERED'));
177define('_PS_OS_CANCELED_',    Configuration::get('PS_OS_CANCELED'));
178define('_PS_OS_REFUND_',      Configuration::get('PS_OS_REFUND'));
179define('_PS_OS_ERROR_',       Configuration::get('PS_OS_ERROR'));
180define('_PS_OS_OUTOFSTOCK_',  Configuration::get('PS_OS_OUTOFSTOCK'));
181define('_PS_OS_BANKWIRE_',    Configuration::get('PS_OS_BANKWIRE'));
182define('_PS_OS_PAYPAL_',      Configuration::get('PS_OS_PAYPAL'));
183define('_PS_OS_WS_PAYMENT_', Configuration::get('PS_OS_WS_PAYMENT'));
184
185/* Get smarty */
186require_once(dirname(__FILE__).'/smarty.config.inc.php');
187Context::getContext()->smarty = $smarty;