This repository was archived by the owner on Nov 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathmodel.php
146 lines (128 loc) · 5 KB
/
model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@set_time_limit(0);
@ini_set('max_execution_time', '0');
// setting the memory limit to 128M only if current is lower
$memory_limit = ini_get('memory_limit');
if (substr($memory_limit,-1) != 'G'
AND ((substr($memory_limit,-1) == 'M' AND substr($memory_limit,0,-1) < 128)
OR is_numeric($memory_limit) AND (intval($memory_limit) < 131072))
){
@ini_set('memory_limit','128M');
}
require_once(dirname(__FILE__).'/../config/autoload.php');
/* Redefine REQUEST_URI if empty (on some webservers...) */
if (!isset($_SERVER['REQUEST_URI']) || empty($_SERVER['REQUEST_URI']))
{
if (!isset($_SERVER['SCRIPT_NAME']) && isset($_SERVER['SCRIPT_FILENAME']))
$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME'];
if (isset($_SERVER['SCRIPT_NAME']))
{
if (basename($_SERVER['SCRIPT_NAME']) == 'index.php' && empty($_SERVER['QUERY_STRING']))
$_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']).'/';
else
{
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING']))
$_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
}
}
}
$_SERVER['REQUEST_URI'] = str_replace('//', '/', $_SERVER['REQUEST_URI']);
define('INSTALL_VERSION', '1.4.11.0');
define('INSTALL_PATH', dirname(__FILE__));
define('PS_INSTALLATION_IN_PROGRESS', true);
require_once(INSTALL_PATH.'/classes/ToolsInstall.php');
define('SETTINGS_FILE', INSTALL_PATH.'/../config/settings.inc.php');
define('DEFINES_FILE', INSTALL_PATH.'/../config/defines.inc.php');
define('INSTALLER__PS_BASE_URI', substr($_SERVER['REQUEST_URI'], 0, -1 * (strlen($_SERVER['REQUEST_URI']) - strrpos($_SERVER['REQUEST_URI'], '/')) - strlen(substr(dirname($_SERVER['REQUEST_URI']), strrpos(dirname($_SERVER['REQUEST_URI']), '/')+1))));
define('INSTALLER__PS_BASE_URI_ABSOLUTE', 'http://'.ToolsInstall::getHttpHost(false, true).INSTALLER__PS_BASE_URI);
if (isset($_GET['method']) AND in_array($_GET['method'], array('createDB', 'checkDB', 'checkConfig')))
define('DONT_LOAD_SETTINGS_FILE', true);
else
define('DONT_LOAD_SETTINGS_FILE', false);
/* Emulate configuration defines, only if we are in the last step of installation */
if (file_exists(SETTINGS_FILE) && !DONT_LOAD_SETTINGS_FILE)
{
/* Keep a backward compatibility for Smarty v2 (will be removed in PrestaShop v1.5) */
define('_PS_FORCE_SMARTY_2_', (int)Configuration::get('PS_FORCE_SMARTY_2'));
Configuration::loadConfiguration();
/* The main shop domains and SSL options */
define('_PS_SHOP_DOMAIN_', Configuration::get('PS_SHOP_DOMAIN'));
define('_PS_SHOP_DOMAIN_SSL_', Configuration::get('PS_SHOP_DOMAIN_SSL'));
define('_PS_SSL_ENABLED_', (int)Configuration::get('PS_SSL_ENABLED'));
/* Default currency and default country */
define('_PS_CURRENCY_DEFAULT_', (int)Configuration::get('PS_CURRENCY_DEFAULT'));
define('_PS_COUNTRY_DEFAULT_', (int)Configuration::get('PS_COUNTRY_DEFAULT'));
define('_PS_LANG_DEFAULT_', (int)Configuration::get('PS_LANG_DEFAULT'));
/* Geolocation options */
define('_PS_GEOLOCATION_ENABLED_', (int)Configuration::get('PS_GEOLOCATION_ENABLED'));
/* Tax options */
define('_PS_TAX_', (int)Configuration::get('PS_TAX'));
}
// XML Header
if (empty($_GET['return_type']))
$return_type = 'xml';
else
$return_type = $_GET['return_type'];
if ($return_type == 'xml')
{
header('Content-Type: text/xml');
}
// Switching method
if (isset($_GET['method']))
{
if (in_array($_GET['method'], array('doUpgrade', 'createDB', 'checkShopInfos')))
{
global $logger;
$logger = new FileLogger();
$logger->setFilename(dirname(__FILE__).'/../log/'.@date('Ymd').'_installation.log');
}
switch ($_GET['method'])
{
case 'checkConfig' :
require_once('xml/checkConfig.php');
break;
case 'checkDB' :
require_once('xml/checkDB.php');
break;
case 'createDB' :
require_once('xml/createDB.php');
break;
case 'checkMail' :
require_once('xml/checkMail.php');
break;
case 'checkShopInfos' :
require_once('xml/checkShopInfos.php');
break;
case 'doUpgrade' :
require_once('xml/doUpgrade.php');
break;
case 'getVersionFromDb' :
require_once('xml/getVersionFromDb.php');
break;
}
}