Version Notes
First stable release.
Download this release
Release Info
Developer | Zikkio |
Extension | Zikkio |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/HPO/ZikkioAdminController/Model/Observer.php +40 -0
- app/code/local/HPO/ZikkioAdminController/controllers/Adminhtml/CustomController.php +20 -0
- app/code/local/HPO/ZikkioAdminController/etc/config.xml +32 -0
- app/code/local/HPO/ZikkioAdminController/etc/system.xml +27 -0
- bridge2cart/bridge.php +3888 -0
- bridge2cart/index.html +0 -0
- package.xml +18 -0
app/code/local/HPO/ZikkioAdminController/Model/Observer.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class HPO_ZikkioAdminController_Model_Observer {
|
3 |
+
|
4 |
+
public function saveApiKey() {
|
5 |
+
Mage::log('HPOAdminZikkio_CreateAdminController_Model_Options -> saveApiKey()', null, 'HPO_LOG.log');
|
6 |
+
|
7 |
+
$zikkio_api_key = Mage::getStoreConfig('catalog/zikkio/zikkio_api', Mage::app()->getStore());
|
8 |
+
//Mage::log($zikkio_api_key, null, 'HPO_LOG.log');
|
9 |
+
|
10 |
+
$content_file = '';
|
11 |
+
|
12 |
+
$root_magento = Mage::getBaseDir();
|
13 |
+
|
14 |
+
//Mage::log($root_magento, null, 'HPO_LOG.log');
|
15 |
+
|
16 |
+
$file = $root_magento."/bridge2cart/bridge.php";
|
17 |
+
$fh = fopen($file, 'r');
|
18 |
+
|
19 |
+
while (($row_file = fgets($fh)) !== false) {
|
20 |
+
|
21 |
+
//Mage::log($row_file, null, 'HPO_LOG.log');
|
22 |
+
|
23 |
+
if(preg_match('/M1_TOKEN/i', $row_file)) {
|
24 |
+
$content_file = $content_file . "\n".'define("M1_TOKEN", "'.$zikkio_api_key.'");'."\n";
|
25 |
+
//Mage::log($row_file, null, 'HPO_LOG.log');
|
26 |
+
}else{
|
27 |
+
$content_file = $content_file . $row_file;
|
28 |
+
}
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
//Mage::log($content_file, null, 'HPO_LOG.log');
|
33 |
+
|
34 |
+
file_put_contents($file, $content_file);
|
35 |
+
|
36 |
+
fclose($fh);
|
37 |
+
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
app/code/local/HPO/ZikkioAdminController/controllers/Adminhtml/CustomController.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class HPOAdminZikkio_CreateAdminController_Adminhtml_CustomController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout();
|
8 |
+
$this->_setActiveMenu('simpleadmin/simple_one');
|
9 |
+
$leftBlock=$this->getLayout()
|
10 |
+
->createBlock('core/text', 'left-admin-block')
|
11 |
+
->setText('<h1>Blocco di sinistra</h1>');
|
12 |
+
$contentBlock=$this->getLayout()
|
13 |
+
->createBlock('core/text', 'content-admin-block')
|
14 |
+
->setText('<h1>Blocco centrale</h1>');
|
15 |
+
$this->_addLeft($leftBlock);
|
16 |
+
$this->_addContent($contentBlock);
|
17 |
+
$this->renderLayout();
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/local/HPO/ZikkioAdminController/etc/config.xml
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HPO_ZikkioAdminController>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
<depends>
|
7 |
+
<!-- no dependencies -->
|
8 |
+
</depends>
|
9 |
+
</HPO_ZikkioAdminController>
|
10 |
+
</modules>
|
11 |
+
<global>
|
12 |
+
<events>
|
13 |
+
<admin_system_config_section_save_after>
|
14 |
+
<observers>
|
15 |
+
<HPO_ZikkioAdminController_save_api_zikkio>
|
16 |
+
<type>singleton</type>
|
17 |
+
<class>HPO_ZikkioAdminController_Model_Observer</class>
|
18 |
+
<method>saveApiKey</method>
|
19 |
+
</HPO_ZikkioAdminController_save_api_zikkio>
|
20 |
+
</observers>
|
21 |
+
</admin_system_config_section_save_after>
|
22 |
+
</events>
|
23 |
+
<models>
|
24 |
+
<ZikkioAdminController>
|
25 |
+
<class>HPO_ZikkioAdminController_Model</class>
|
26 |
+
</ZikkioAdminController>
|
27 |
+
</models>
|
28 |
+
<resources />
|
29 |
+
<extraconfig />
|
30 |
+
<blocks />
|
31 |
+
</global>
|
32 |
+
</config>
|
app/code/local/HPO/ZikkioAdminController/etc/system.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<sections>
|
3 |
+
<catalog>
|
4 |
+
<groups>
|
5 |
+
<zikkio translate="label">
|
6 |
+
<label>Zikkio</label>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>50</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<fields>
|
13 |
+
<zikkio_api translate="label">
|
14 |
+
<label>Please enter here your Zikkio API KEY</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>50</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<comment>Insert here the API KEY</comment>
|
21 |
+
</zikkio_api>
|
22 |
+
</fields>
|
23 |
+
</zikkio>
|
24 |
+
</groups>
|
25 |
+
</catalog>
|
26 |
+
</sections>
|
27 |
+
</config>
|
bridge2cart/bridge.php
ADDED
@@ -0,0 +1,3888 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*-----------------------------------------------------------------------------+
|
3 |
+
| MagneticOne |
|
4 |
+
| Copyright (c) 2012 MagneticOne.com <contact@magneticone.com> |
|
5 |
+
| All rights reserved |
|
6 |
+
+------------------------------------------------------------------------------+
|
7 |
+
| PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "license.txt"|
|
8 |
+
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE |
|
9 |
+
| AT THE FOLLOWING URL: http://www.magneticone.com/store/license.php |
|
10 |
+
| |
|
11 |
+
| THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE |
|
12 |
+
| THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT MAGNETICONE |
|
13 |
+
| (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING |
|
14 |
+
| AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). |
|
15 |
+
| PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT |
|
16 |
+
| CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, |
|
17 |
+
| COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY |
|
18 |
+
| (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS |
|
19 |
+
| LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS |
|
20 |
+
| AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND |
|
21 |
+
| OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS |
|
22 |
+
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE |
|
23 |
+
| THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE. |
|
24 |
+
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. |
|
25 |
+
| |
|
26 |
+
| The Developer of the Code is MagneticOne, |
|
27 |
+
| Copyright (C) 2006 - 2012 All Rights Reserved. |
|
28 |
+
+------------------------------------------------------------------------------+
|
29 |
+
| |
|
30 |
+
| ATTENTION! |
|
31 |
+
+------------------------------------------------------------------------------+
|
32 |
+
| By our Terms of Use you agreed not to change, modify, add, or remove portions|
|
33 |
+
| of Bridge Script source code as it is owned by MagneticOne company. |
|
34 |
+
| You agreed not to use, reproduce, modify, adapt, publish, translate |
|
35 |
+
| the Bridge Script source code into any form, medium, or technology |
|
36 |
+
| now known or later developed throughout the universe. |
|
37 |
+
| |
|
38 |
+
| Full text of our TOS located at |
|
39 |
+
| https://www.api2cart.com/terms-of-service |
|
40 |
+
+-----------------------------------------------------------------------------*/
|
41 |
+
|
42 |
+
|
43 |
+
class M1_Bridge_Action_Getconfig
|
44 |
+
{
|
45 |
+
|
46 |
+
function parseMemoryLimit($val)
|
47 |
+
{
|
48 |
+
$last = strtolower($val[strlen($val)-1]);
|
49 |
+
switch($last) {
|
50 |
+
case 'g':
|
51 |
+
$val *= 1024;
|
52 |
+
case 'm':
|
53 |
+
$val *= 1024;
|
54 |
+
case 'k':
|
55 |
+
$val *= 1024;
|
56 |
+
}
|
57 |
+
|
58 |
+
return $val;
|
59 |
+
}
|
60 |
+
|
61 |
+
function getMemoryLimit()
|
62 |
+
{
|
63 |
+
$memoryLimit = trim(@ini_get('memory_limit'));
|
64 |
+
if (strlen($memoryLimit) === 0) {
|
65 |
+
$memoryLimit = "0";
|
66 |
+
}
|
67 |
+
$memoryLimit = $this->parseMemoryLimit($memoryLimit);
|
68 |
+
|
69 |
+
$maxPostSize = trim(@ini_get('post_max_size'));
|
70 |
+
if (strlen($maxPostSize) === 0) {
|
71 |
+
$maxPostSize = "0";
|
72 |
+
}
|
73 |
+
$maxPostSize = $this->parseMemoryLimit($maxPostSize);
|
74 |
+
|
75 |
+
$suhosinMaxPostSize = trim(@ini_get('suhosin.post.max_value_length'));
|
76 |
+
if (strlen($suhosinMaxPostSize) === 0) {
|
77 |
+
$suhosinMaxPostSize = "0";
|
78 |
+
}
|
79 |
+
$suhosinMaxPostSize = $this->parseMemoryLimit($suhosinMaxPostSize);
|
80 |
+
|
81 |
+
if ($suhosinMaxPostSize == 0) {
|
82 |
+
$suhosinMaxPostSize = $maxPostSize;
|
83 |
+
}
|
84 |
+
|
85 |
+
if ($maxPostSize == 0) {
|
86 |
+
$suhosinMaxPostSize = $maxPostSize = $memoryLimit;
|
87 |
+
}
|
88 |
+
|
89 |
+
return min($suhosinMaxPostSize, $maxPostSize, $memoryLimit);
|
90 |
+
}
|
91 |
+
|
92 |
+
function isZlibSupported()
|
93 |
+
{
|
94 |
+
return function_exists('gzdecode');
|
95 |
+
}
|
96 |
+
|
97 |
+
function perform($bridge)
|
98 |
+
{
|
99 |
+
if (!defined("DEFAULT_LANGUAGE_ISO2")) {
|
100 |
+
define("DEFAULT_LANGUAGE_ISO2", ""); //variable for Interspire cart
|
101 |
+
}
|
102 |
+
|
103 |
+
$result = array(
|
104 |
+
"images" => array(
|
105 |
+
"imagesPath" => $bridge->config->imagesDir, // path to images folder - relative to store root
|
106 |
+
"categoriesImagesPath" => $bridge->config->categoriesImagesDir,
|
107 |
+
"categoriesImagesPaths" => $bridge->config->categoriesImagesDirs,
|
108 |
+
"productsImagesPath" => $bridge->config->productsImagesDir,
|
109 |
+
"productsImagesPaths" => $bridge->config->productsImagesDirs,
|
110 |
+
"manufacturersImagesPath" => $bridge->config->manufacturersImagesDir,
|
111 |
+
"manufacturersImagesPaths" => $bridge->config->manufacturersImagesDirs,
|
112 |
+
),
|
113 |
+
"languages" => $bridge->config->languages,
|
114 |
+
"baseDirFs" => M1_STORE_BASE_DIR, // filesystem path to store root
|
115 |
+
"defaultLanguageIso2" => DEFAULT_LANGUAGE_ISO2,
|
116 |
+
"databaseName" => $bridge->config->Dbname,
|
117 |
+
"memoryLimit" => $this->getMemoryLimit(),
|
118 |
+
"zlibSupported" => $this->isZlibSupported(),
|
119 |
+
//"orderStatus" => $bridge->config->orderStatus,
|
120 |
+
"cartVars" => $bridge->config->cartVars,
|
121 |
+
);
|
122 |
+
|
123 |
+
echo serialize($result);
|
124 |
+
}
|
125 |
+
|
126 |
+
}
|
127 |
+
|
128 |
+
class M1_Bridge_Action_Cubecart
|
129 |
+
{
|
130 |
+
function perform($bridge)
|
131 |
+
{
|
132 |
+
$dirHandle = opendir(M1_STORE_BASE_DIR . 'language/');
|
133 |
+
|
134 |
+
$languages = array();
|
135 |
+
|
136 |
+
while ($dirEntry = readdir($dirHandle)) {
|
137 |
+
if (!is_dir(M1_STORE_BASE_DIR . 'language/' . $dirEntry) || $dirEntry == '.' || $dirEntry == '..' || strpos($dirEntry, "_") !== false) {
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
|
141 |
+
$lang['id'] = $dirEntry;
|
142 |
+
$lang['iso2'] = $dirEntry;
|
143 |
+
|
144 |
+
$cnfile = "config.inc.php";
|
145 |
+
|
146 |
+
if (!file_exists(M1_STORE_BASE_DIR . 'language/' . $dirEntry . '/'. $cnfile)) {
|
147 |
+
$cnfile = "config.php";
|
148 |
+
}
|
149 |
+
|
150 |
+
if (!file_exists( M1_STORE_BASE_DIR . 'language/' . $dirEntry . '/'. $cnfile)) {
|
151 |
+
continue;
|
152 |
+
}
|
153 |
+
|
154 |
+
$str = file_get_contents(M1_STORE_BASE_DIR . 'language/' . $dirEntry . '/'.$cnfile);
|
155 |
+
preg_match("/".preg_quote('$langName')."[\s]*=[\s]*[\"\'](.*)[\"\'];/", $str, $match);
|
156 |
+
|
157 |
+
if (isset($match[1])) {
|
158 |
+
$lang['name'] = $match[1];
|
159 |
+
$languages[] = $lang;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
echo serialize($languages);
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
class M1_Bridge_Action_Clearcache
|
168 |
+
{
|
169 |
+
function perform($bridge)
|
170 |
+
{
|
171 |
+
switch($bridge->config->cartType) {
|
172 |
+
case "Cubecart":
|
173 |
+
$this->_CubecartClearCache();
|
174 |
+
break;
|
175 |
+
case "Prestashop11":
|
176 |
+
$this->_PrestashopClearCache();
|
177 |
+
break;
|
178 |
+
case "Interspire":
|
179 |
+
$this->_InterspireClearCache();
|
180 |
+
break;
|
181 |
+
case "Opencart14" :
|
182 |
+
$this->_OpencartClearCache();
|
183 |
+
break;
|
184 |
+
case "XtcommerceVeyton" :
|
185 |
+
$this->_Xtcommerce4ClearCache();
|
186 |
+
break;
|
187 |
+
case "Ubercart" :
|
188 |
+
$this->_ubercartClearCache();
|
189 |
+
break;
|
190 |
+
case "Tomatocart" :
|
191 |
+
$this->_tomatocartClearCache();
|
192 |
+
break;
|
193 |
+
case "Virtuemart113" :
|
194 |
+
$this->_virtuemartClearCache();
|
195 |
+
break;
|
196 |
+
case "Magento1212" :
|
197 |
+
//$this->_magentoClearCache();
|
198 |
+
break;
|
199 |
+
case "Oscommerce3":
|
200 |
+
$this->_Oscommerce3ClearCache();
|
201 |
+
break;
|
202 |
+
case "Oxid":
|
203 |
+
$this->_OxidClearCache();
|
204 |
+
break;
|
205 |
+
case "XCart":
|
206 |
+
$this->_XcartClearCache();
|
207 |
+
break;
|
208 |
+
case "Cscart203":
|
209 |
+
$this->_CscartClearCache();
|
210 |
+
break;
|
211 |
+
case "Prestashop15":
|
212 |
+
$this->_Prestashop15ClearCache();
|
213 |
+
break;
|
214 |
+
case "Gambio":
|
215 |
+
$this->_GambioClearCache();
|
216 |
+
break;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
*
|
222 |
+
* @var $fileExclude - name file in format pregmatch
|
223 |
+
*/
|
224 |
+
|
225 |
+
function _removeGarbage($dirs = array(), $fileExclude = '')
|
226 |
+
{
|
227 |
+
$result = true;
|
228 |
+
|
229 |
+
foreach ($dirs as $dir) {
|
230 |
+
|
231 |
+
if (!file_exists($dir)) {
|
232 |
+
continue;
|
233 |
+
}
|
234 |
+
|
235 |
+
$dirHandle = opendir($dir);
|
236 |
+
|
237 |
+
while (false !== ($file = readdir($dirHandle))) {
|
238 |
+
if ($file == "." || $file == "..") {
|
239 |
+
continue;
|
240 |
+
}
|
241 |
+
|
242 |
+
if ((trim($fileExclude) != '') && preg_match("/^" .$fileExclude . "?$/", $file)) {
|
243 |
+
continue;
|
244 |
+
}
|
245 |
+
|
246 |
+
if (is_dir($dir . $file)) {
|
247 |
+
continue;
|
248 |
+
}
|
249 |
+
|
250 |
+
if (!unlink($dir . $file)) {
|
251 |
+
$result = false;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
closedir($dirHandle);
|
256 |
+
}
|
257 |
+
|
258 |
+
if ($result) {
|
259 |
+
echo 'OK';
|
260 |
+
} else {
|
261 |
+
echo 'ERROR';
|
262 |
+
}
|
263 |
+
|
264 |
+
return $result;
|
265 |
+
}
|
266 |
+
|
267 |
+
function _magentoClearCache()
|
268 |
+
{
|
269 |
+
chdir('../');
|
270 |
+
|
271 |
+
$indexes = array(
|
272 |
+
'catalog_product_attribute',
|
273 |
+
'catalog_product_price',
|
274 |
+
'catalog_url',
|
275 |
+
'catalog_product_flat',
|
276 |
+
'catalog_category_flat',
|
277 |
+
'catalog_category_product',
|
278 |
+
'catalogsearch_fulltext',
|
279 |
+
'cataloginventory_stock',
|
280 |
+
'tag_summary'
|
281 |
+
);
|
282 |
+
|
283 |
+
$phpExecutable = getPHPExecutable();
|
284 |
+
if ($phpExecutable) {
|
285 |
+
foreach ($indexes as $index) {
|
286 |
+
exec($phpExecutable . " shell/indexer.php --reindex $index", $out);
|
287 |
+
}
|
288 |
+
echo 'OK';
|
289 |
+
} else {
|
290 |
+
echo 'Error: can not find PHP executable file.';
|
291 |
+
}
|
292 |
+
|
293 |
+
echo 'OK';
|
294 |
+
}
|
295 |
+
|
296 |
+
function _InterspireClearCache()
|
297 |
+
{
|
298 |
+
$res = true;
|
299 |
+
$file = M1_STORE_BASE_DIR . 'cache' . DIRECTORY_SEPARATOR . 'datastore' . DIRECTORY_SEPARATOR . 'RootCategories.php';
|
300 |
+
if (file_exists($file)) {
|
301 |
+
if (!unlink($file)) {
|
302 |
+
$res = false;
|
303 |
+
}
|
304 |
+
}
|
305 |
+
if ($res === true) {
|
306 |
+
echo "OK";
|
307 |
+
} else {
|
308 |
+
echo "ERROR";
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
function _CubecartClearCache()
|
313 |
+
{
|
314 |
+
$ok = true;
|
315 |
+
|
316 |
+
if (file_exists(M1_STORE_BASE_DIR . 'cache')) {
|
317 |
+
$dirHandle = opendir(M1_STORE_BASE_DIR . 'cache/');
|
318 |
+
|
319 |
+
while (false !== ($file = readdir($dirHandle))) {
|
320 |
+
if ($file != "." && $file != ".." && !preg_match("/^index\.html?$/", $file) && !preg_match("/^\.htaccess?$/", $file)) {
|
321 |
+
if (is_file( M1_STORE_BASE_DIR . 'cache/' . $file)) {
|
322 |
+
if (!unlink(M1_STORE_BASE_DIR . 'cache/' . $file)) {
|
323 |
+
$ok = false;
|
324 |
+
}
|
325 |
+
}
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
closedir($dirHandle);
|
330 |
+
}
|
331 |
+
|
332 |
+
if (file_exists(M1_STORE_BASE_DIR.'includes/extra/admin_cat_cache.txt')) {
|
333 |
+
unlink(M1_STORE_BASE_DIR.'includes/extra/admin_cat_cache.txt');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($ok) {
|
337 |
+
echo 'OK';
|
338 |
+
} else {
|
339 |
+
echo 'ERROR';
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
function _PrestashopClearCache()
|
344 |
+
{
|
345 |
+
$dirs = array(
|
346 |
+
M1_STORE_BASE_DIR . 'tools/smarty/compile/',
|
347 |
+
M1_STORE_BASE_DIR . 'tools/smarty/cache/',
|
348 |
+
M1_STORE_BASE_DIR . 'img/tmp/'
|
349 |
+
);
|
350 |
+
|
351 |
+
$this->_removeGarbage($dirs, 'index\.php');
|
352 |
+
}
|
353 |
+
|
354 |
+
function _OpencartClearCache()
|
355 |
+
{
|
356 |
+
$dirs = array(
|
357 |
+
M1_STORE_BASE_DIR . 'system/cache/',
|
358 |
+
);
|
359 |
+
|
360 |
+
$this->_removeGarbage($dirs, 'index\.html');
|
361 |
+
}
|
362 |
+
|
363 |
+
function _Xtcommerce4ClearCache()
|
364 |
+
{
|
365 |
+
$dirs = array(
|
366 |
+
M1_STORE_BASE_DIR . 'cache/',
|
367 |
+
);
|
368 |
+
|
369 |
+
$this->_removeGarbage($dirs, 'index\.html');
|
370 |
+
}
|
371 |
+
|
372 |
+
function _ubercartClearCache()
|
373 |
+
{
|
374 |
+
$dirs = array(
|
375 |
+
M1_STORE_BASE_DIR . 'sites/default/files/imagecache/product/',
|
376 |
+
M1_STORE_BASE_DIR . 'sites/default/files/imagecache/product_full/',
|
377 |
+
M1_STORE_BASE_DIR . 'sites/default/files/imagecache/product_list/',
|
378 |
+
M1_STORE_BASE_DIR . 'sites/default/files/imagecache/uc_category/',
|
379 |
+
M1_STORE_BASE_DIR . 'sites/default/files/imagecache/uc_thumbnail/',
|
380 |
+
);
|
381 |
+
|
382 |
+
$this->_removeGarbage($dirs);
|
383 |
+
}
|
384 |
+
|
385 |
+
function _tomatocartClearCache()
|
386 |
+
{
|
387 |
+
$dirs = array(
|
388 |
+
M1_STORE_BASE_DIR . 'includes/work/',
|
389 |
+
);
|
390 |
+
|
391 |
+
$this->_removeGarbage($dirs, '\.htaccess');
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Try chage permissions actually :)
|
396 |
+
*/
|
397 |
+
function _virtuemartClearCache()
|
398 |
+
{
|
399 |
+
$pathToImages = 'components/com_virtuemart/shop_image';
|
400 |
+
|
401 |
+
$dirParts = explode("/", $pathToImages);
|
402 |
+
$path = M1_STORE_BASE_DIR;
|
403 |
+
foreach ($dirParts as $item) {
|
404 |
+
if ($item == '') {
|
405 |
+
continue;
|
406 |
+
}
|
407 |
+
|
408 |
+
$path .= $item . DIRECTORY_SEPARATOR;
|
409 |
+
@chmod($path, 0755);
|
410 |
+
}
|
411 |
+
}
|
412 |
+
|
413 |
+
function _Oscommerce3ClearCache()
|
414 |
+
{
|
415 |
+
$dirs = array(
|
416 |
+
M1_STORE_BASE_DIR . 'osCommerce/OM/Work/Cache/',
|
417 |
+
);
|
418 |
+
|
419 |
+
$this->_removeGarbage($dirs, '\.htaccess');
|
420 |
+
}
|
421 |
+
|
422 |
+
function _GambioClearCache()
|
423 |
+
{
|
424 |
+
$dirs = array(
|
425 |
+
M1_STORE_BASE_DIR . 'cache/',
|
426 |
+
);
|
427 |
+
|
428 |
+
$this->_removeGarbage($dirs, 'index\.html');
|
429 |
+
}
|
430 |
+
|
431 |
+
function _OxidClearCache()
|
432 |
+
{
|
433 |
+
$dirs = array(
|
434 |
+
M1_STORE_BASE_DIR . 'tmp/',
|
435 |
+
);
|
436 |
+
|
437 |
+
$this->_removeGarbage($dirs, '\.htaccess');
|
438 |
+
}
|
439 |
+
|
440 |
+
function _XcartClearCache()
|
441 |
+
{
|
442 |
+
$dirs = array(
|
443 |
+
M1_STORE_BASE_DIR . 'var/cache/',
|
444 |
+
);
|
445 |
+
|
446 |
+
$this->_removeGarbage($dirs, '\.htaccess');
|
447 |
+
}
|
448 |
+
|
449 |
+
function _CscartClearCache()
|
450 |
+
{
|
451 |
+
$dir = M1_STORE_BASE_DIR . 'var/cache/';
|
452 |
+
$res = $this->removeDirRec($dir);
|
453 |
+
|
454 |
+
if ($res) {
|
455 |
+
echo 'OK';
|
456 |
+
} else {
|
457 |
+
echo 'ERROR';
|
458 |
+
}
|
459 |
+
}
|
460 |
+
|
461 |
+
function _Prestashop15ClearCache()
|
462 |
+
{
|
463 |
+
$dirs = array(
|
464 |
+
M1_STORE_BASE_DIR . 'cache/smarty/compile/',
|
465 |
+
M1_STORE_BASE_DIR . 'cache/smarty/cache/',
|
466 |
+
M1_STORE_BASE_DIR . 'img/tmp/'
|
467 |
+
);
|
468 |
+
|
469 |
+
$this->_removeGarbage($dirs, 'index\.php');
|
470 |
+
}
|
471 |
+
|
472 |
+
function removeDirRec($dir)
|
473 |
+
{
|
474 |
+
$result = true;
|
475 |
+
|
476 |
+
if ($objs = glob($dir."/*")) {
|
477 |
+
foreach ($objs as $obj) {
|
478 |
+
if (is_dir($obj)) {
|
479 |
+
//print "IS DIR! START RECURSIVE FUNCTION.\n";
|
480 |
+
$this->removeDirRec($obj);
|
481 |
+
} else {
|
482 |
+
if (!unlink($obj)) {
|
483 |
+
//print "!UNLINK FILE: ".$obj."\n";
|
484 |
+
$result = false;
|
485 |
+
}
|
486 |
+
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
if (!rmdir($dir)) {
|
490 |
+
//print "ERROR REMOVE DIR: ".$dir."\n";
|
491 |
+
$result = false;
|
492 |
+
}
|
493 |
+
|
494 |
+
return $result;
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
class M1_Bridge_Action_Mysqlver
|
499 |
+
{
|
500 |
+
function perform($bridge)
|
501 |
+
{
|
502 |
+
$m = array();
|
503 |
+
preg_match('/^(\d+)\.(\d+)\.(\d+)/', mysql_get_server_info($bridge->getLink()), $m);
|
504 |
+
echo sprintf("%d%02d%02d", $m[1], $m[2], $m[3]);
|
505 |
+
}
|
506 |
+
}
|
507 |
+
|
508 |
+
|
509 |
+
class M1_Bridge_Action_Batchsavefile extends M1_Bridge_Action_Savefile
|
510 |
+
{
|
511 |
+
function perform($bridge) {
|
512 |
+
$result = array();
|
513 |
+
|
514 |
+
foreach ($_POST['files'] as $fileInfo) {
|
515 |
+
$result[$fileInfo['id']] = $this->_saveFile(
|
516 |
+
$fileInfo['source'],
|
517 |
+
$fileInfo['target'],
|
518 |
+
(int)$fileInfo['width'],
|
519 |
+
(int)$fileInfo['height'],
|
520 |
+
$fileInfo['local_source']
|
521 |
+
);
|
522 |
+
}
|
523 |
+
|
524 |
+
echo serialize($result);
|
525 |
+
}
|
526 |
+
|
527 |
+
}
|
528 |
+
|
529 |
+
class M1_Bridge_Action_Phpinfo
|
530 |
+
{
|
531 |
+
function perform($bridge)
|
532 |
+
{
|
533 |
+
phpinfo();
|
534 |
+
}
|
535 |
+
}
|
536 |
+
|
537 |
+
|
538 |
+
class M1_Bridge_Action_Deleteimages
|
539 |
+
{
|
540 |
+
function perform($bridge)
|
541 |
+
{
|
542 |
+
switch($bridge->config->cartType) {
|
543 |
+
case "Pinnacle361":
|
544 |
+
$this->_PinnacleDeleteImages($bridge);
|
545 |
+
break;
|
546 |
+
case "Prestashop11":
|
547 |
+
$this->_PrestaShopDeleteImages($bridge);
|
548 |
+
break;
|
549 |
+
case 'Summercart3' :
|
550 |
+
$this->_SummercartDeleteImages($bridge);
|
551 |
+
break;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
|
555 |
+
function _PinnacleDeleteImages($bridge)
|
556 |
+
{
|
557 |
+
$dirs = array(
|
558 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'catalog/',
|
559 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'manufacturers/',
|
560 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'products/',
|
561 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'products/thumbs/',
|
562 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'products/secondary/',
|
563 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'products/preview/',
|
564 |
+
);
|
565 |
+
|
566 |
+
$ok = true;
|
567 |
+
|
568 |
+
foreach($dirs as $dir) {
|
569 |
+
|
570 |
+
if( !file_exists( $dir ) ) {
|
571 |
+
continue;
|
572 |
+
}
|
573 |
+
|
574 |
+
$dirHandle = opendir($dir);
|
575 |
+
|
576 |
+
while (false !== ($file = readdir($dirHandle))) {
|
577 |
+
if ($file != "." && $file != ".." && !preg_match("/^readme\.txt?$/",$file) && !preg_match("/\.bak$/i",$file)) {
|
578 |
+
$file_path = $dir . $file;
|
579 |
+
if( is_file($file_path) ) {
|
580 |
+
if(!rename($file_path, $file_path.".bak")) $ok = false;
|
581 |
+
}
|
582 |
+
}
|
583 |
+
}
|
584 |
+
|
585 |
+
closedir($dirHandle);
|
586 |
+
|
587 |
+
}
|
588 |
+
|
589 |
+
if ($ok) print "OK";
|
590 |
+
else print "ERROR";
|
591 |
+
}
|
592 |
+
|
593 |
+
function _PrestaShopDeleteImages($bridge)
|
594 |
+
{
|
595 |
+
$dirs = array(
|
596 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'c/',
|
597 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'p/',
|
598 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'm/',
|
599 |
+
);
|
600 |
+
|
601 |
+
$ok = true;
|
602 |
+
|
603 |
+
foreach($dirs as $dir) {
|
604 |
+
|
605 |
+
if( !file_exists( $dir ) ) {
|
606 |
+
continue;
|
607 |
+
}
|
608 |
+
|
609 |
+
$dirHandle = opendir($dir);
|
610 |
+
|
611 |
+
while (false !== ($file = readdir($dirHandle))) {
|
612 |
+
if ($file != "." && $file != ".." && preg_match( "/(\d+).*\.jpg?$/",$file )) {
|
613 |
+
$file_path = $dir . $file;
|
614 |
+
if( is_file($file_path) ) {
|
615 |
+
if(!rename($file_path, $file_path.".bak")) $ok = false;
|
616 |
+
}
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
closedir($dirHandle);
|
621 |
+
|
622 |
+
}
|
623 |
+
|
624 |
+
if ($ok) print "OK";
|
625 |
+
else print "ERROR";
|
626 |
+
}
|
627 |
+
|
628 |
+
function _SummercartDeleteImages($bridge)
|
629 |
+
{
|
630 |
+
$dirs = array(
|
631 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'categoryimages/',
|
632 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'manufacturer/',
|
633 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'productimages/',
|
634 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'productthumbs/',
|
635 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'productboximages/',
|
636 |
+
M1_STORE_BASE_DIR . $bridge->config->imagesDir . 'productlargeimages/',
|
637 |
+
);
|
638 |
+
|
639 |
+
$ok = true;
|
640 |
+
|
641 |
+
foreach($dirs as $dir) {
|
642 |
+
|
643 |
+
if( !file_exists( $dir ) ) {
|
644 |
+
continue;
|
645 |
+
}
|
646 |
+
|
647 |
+
$dirHandle = opendir($dir);
|
648 |
+
|
649 |
+
while (false !== ($file = readdir($dirHandle))) {
|
650 |
+
if (($file != ".") && ($file != "..") && !preg_match("/\.bak$/i",$file) ) {
|
651 |
+
$file_path = $dir . $file;
|
652 |
+
if( is_file($file_path) ) {
|
653 |
+
if(!rename($file_path, $file_path.".bak")) $ok = false;
|
654 |
+
}
|
655 |
+
}
|
656 |
+
}
|
657 |
+
|
658 |
+
closedir($dirHandle);
|
659 |
+
|
660 |
+
}
|
661 |
+
|
662 |
+
if ($ok) print "OK";
|
663 |
+
else print "ERROR";
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
class M1_Bridge_Action_Update
|
668 |
+
{
|
669 |
+
var $uri = "BRIDGE_DOWNLOAD_LINK";
|
670 |
+
|
671 |
+
var $pathToTmpDir;
|
672 |
+
|
673 |
+
var $pathToFile = __FILE__;
|
674 |
+
|
675 |
+
function M1_Bridge_Action_Update()
|
676 |
+
{
|
677 |
+
$this->pathToTmpDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "temp_c2c";
|
678 |
+
}
|
679 |
+
|
680 |
+
function perform($bridge)
|
681 |
+
{
|
682 |
+
$response = new stdClass();
|
683 |
+
if ( !($this->_checkBridgeDirPermission() && $this->_checkBridgeFilePermission()) ) {
|
684 |
+
$response->is_error = true;
|
685 |
+
$response->message = "Bridge Update couldn't be performed. Please change permission for bridge folder to 777 and bridge.php file inside it to 666";
|
686 |
+
echo serialize($response);die;
|
687 |
+
}
|
688 |
+
|
689 |
+
|
690 |
+
if ( ($data = $this->_downloadFile()) === false ) {
|
691 |
+
$response->is_error = true;
|
692 |
+
$response->message = "Bridge Version is outdated. Files couldn't be updated automatically. Please set write permission or re-upload files manually.";
|
693 |
+
echo serialize($response);die;
|
694 |
+
}
|
695 |
+
|
696 |
+
if ( !$this->_writeToFile($data, $this->pathToFile) ) {
|
697 |
+
$response->is_error = true;
|
698 |
+
$response->message = "Couln't create file in temporary folder or file is write protected.";
|
699 |
+
echo serialize($response);die;
|
700 |
+
}
|
701 |
+
|
702 |
+
$response->is_error = false;
|
703 |
+
$response->message = "Bridge successfully updated to latest version";
|
704 |
+
echo serialize($response);
|
705 |
+
die;
|
706 |
+
}
|
707 |
+
|
708 |
+
function _fetch( $uri )
|
709 |
+
{
|
710 |
+
$ch = curl_init();
|
711 |
+
|
712 |
+
curl_setopt($ch, CURLOPT_URL, $uri);
|
713 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
714 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
715 |
+
|
716 |
+
$response = new stdClass();
|
717 |
+
|
718 |
+
$response->body = curl_exec($ch);
|
719 |
+
$response->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
720 |
+
$response->content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
|
721 |
+
$response->content_length = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
|
722 |
+
|
723 |
+
curl_close($ch);
|
724 |
+
|
725 |
+
return $response;
|
726 |
+
}
|
727 |
+
|
728 |
+
function _checkBridgeDirPermission()
|
729 |
+
{
|
730 |
+
if (!is_writeable(dirname(__FILE__))) {
|
731 |
+
@chmod(dirname(__FILE__), 0777);
|
732 |
+
}
|
733 |
+
return is_writeable(dirname(__FILE__));
|
734 |
+
}
|
735 |
+
|
736 |
+
function _checkBridgeFilePermission()
|
737 |
+
{
|
738 |
+
$pathToFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bridge.php";
|
739 |
+
if (!is_writeable($pathToFile)) {
|
740 |
+
@chmod($pathToFile, 0666);
|
741 |
+
}
|
742 |
+
return is_writeable($pathToFile);
|
743 |
+
}
|
744 |
+
|
745 |
+
function _createTempDir()
|
746 |
+
{
|
747 |
+
@mkdir($this->pathToTmpDir, 0777);
|
748 |
+
return file_exists($this->pathToTmpDir);
|
749 |
+
}
|
750 |
+
|
751 |
+
function _removeTempDir()
|
752 |
+
{
|
753 |
+
@unlink($this->pathToTmpDir . DIRECTORY_SEPARATOR . "bridge.php_c2c");
|
754 |
+
@rmdir($this->pathToTmpDir);
|
755 |
+
return !file_exists($this->pathToTmpDir);
|
756 |
+
}
|
757 |
+
|
758 |
+
function _downloadFile()
|
759 |
+
{
|
760 |
+
$file = $this->_fetch($this->uri);
|
761 |
+
if ( $file->http_code == 200 ) {
|
762 |
+
return $file;
|
763 |
+
}
|
764 |
+
return false;
|
765 |
+
}
|
766 |
+
|
767 |
+
function _writeToFile($data, $file)
|
768 |
+
{
|
769 |
+
if (function_exists("file_put_contents")) {
|
770 |
+
$bytes = file_put_contents($file, $data->body);
|
771 |
+
return $bytes == $data->content_length;
|
772 |
+
}
|
773 |
+
|
774 |
+
$handle = @fopen($file, 'w+');
|
775 |
+
$bytes = fwrite($handle, $data->body);
|
776 |
+
@fclose($handle);
|
777 |
+
|
778 |
+
return $bytes == $data->content_length;
|
779 |
+
|
780 |
+
}
|
781 |
+
|
782 |
+
}
|
783 |
+
|
784 |
+
|
785 |
+
class M1_Bridge_Action_Basedirfs
|
786 |
+
{
|
787 |
+
function perform($bridge)
|
788 |
+
{
|
789 |
+
echo M1_STORE_BASE_DIR;
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
class M1_Bridge_Action_Savefile
|
794 |
+
{
|
795 |
+
var $_imageType = null;
|
796 |
+
|
797 |
+
function perform($bridge)
|
798 |
+
{
|
799 |
+
$source = $_POST['src'];
|
800 |
+
$destination = $_POST['dst'];
|
801 |
+
$width = (int)$_POST['width'];
|
802 |
+
$height = (int)$_POST['height'];
|
803 |
+
$local = $_POST['local_source'];
|
804 |
+
|
805 |
+
echo $this->_saveFile($source, $destination, $width, $height, $local);
|
806 |
+
}
|
807 |
+
|
808 |
+
function _saveFile($source, $destination, $width, $height, $local = '')
|
809 |
+
{
|
810 |
+
if (trim($local) != '') {
|
811 |
+
|
812 |
+
if ($this->_copyLocal($local, $destination, $width, $height)) {
|
813 |
+
return "OK";
|
814 |
+
}
|
815 |
+
|
816 |
+
}
|
817 |
+
|
818 |
+
if (!preg_match('/^https?:\/\//i', $source)) {
|
819 |
+
$result = $this->_createFile($source, $destination);
|
820 |
+
} elseif ($this->_isSameHost($source)) {
|
821 |
+
$result = $this->_saveFileLocal($source, $destination);
|
822 |
+
} else {
|
823 |
+
$result = $this->_saveFileCurl($source, $destination);
|
824 |
+
}
|
825 |
+
|
826 |
+
if ($result != "OK") {
|
827 |
+
return $result;
|
828 |
+
}
|
829 |
+
|
830 |
+
$destination = M1_STORE_BASE_DIR . $destination;
|
831 |
+
|
832 |
+
if ($width != 0 && $height != 0) {
|
833 |
+
$this->_scaled2( $destination, $width, $height );
|
834 |
+
}
|
835 |
+
|
836 |
+
if ($this->cartType == "Prestashop11") {
|
837 |
+
// convert destination.gif(png) to destination.jpg
|
838 |
+
$imageGd = $this->_loadImage($destination);
|
839 |
+
|
840 |
+
if ($imageGd === false) {
|
841 |
+
return $result;
|
842 |
+
}
|
843 |
+
|
844 |
+
if (!$this->_convert($imageGd, $destination, IMAGETYPE_JPEG, 'jpg')) {
|
845 |
+
return "CONVERT FAILED";
|
846 |
+
}
|
847 |
+
}
|
848 |
+
|
849 |
+
return $result;
|
850 |
+
}
|
851 |
+
|
852 |
+
function _copyLocal($source, $destination, $width, $height)
|
853 |
+
{
|
854 |
+
$source = M1_STORE_BASE_DIR . $source;
|
855 |
+
$destination = M1_STORE_BASE_DIR . $destination;
|
856 |
+
|
857 |
+
if (!@copy($source, $destination)) {
|
858 |
+
return false;
|
859 |
+
}
|
860 |
+
|
861 |
+
if ($width != 0 && $height != 0) {
|
862 |
+
$this->_scaled2($destination, $width, $height);
|
863 |
+
}
|
864 |
+
|
865 |
+
return true;
|
866 |
+
}
|
867 |
+
|
868 |
+
function _loadImage($filename, $skipJpg = true)
|
869 |
+
{
|
870 |
+
$imageInfo = @getimagesize($filename);
|
871 |
+
if ($imageInfo === false) {
|
872 |
+
return false;
|
873 |
+
}
|
874 |
+
|
875 |
+
$this->_imageType = $imageInfo[2];
|
876 |
+
|
877 |
+
switch ($this->_imageType) {
|
878 |
+
case IMAGETYPE_JPEG:
|
879 |
+
$image = imagecreatefromjpeg($filename);
|
880 |
+
break;
|
881 |
+
case IMAGETYPE_GIF:
|
882 |
+
$image = imagecreatefromgif($filename);
|
883 |
+
break;
|
884 |
+
case IMAGETYPE_PNG:
|
885 |
+
$image = imagecreatefrompng($filename);
|
886 |
+
break;
|
887 |
+
default:
|
888 |
+
return false;
|
889 |
+
}
|
890 |
+
|
891 |
+
if ($skipJpg && ($this->_imageType == IMAGETYPE_JPEG)) {
|
892 |
+
return false;
|
893 |
+
}
|
894 |
+
|
895 |
+
return $image;
|
896 |
+
}
|
897 |
+
|
898 |
+
function _saveImage($image, $filename, $imageType = IMAGETYPE_JPEG, $compression = 85, $permissions = null)
|
899 |
+
{
|
900 |
+
$result = true;
|
901 |
+
if ($imageType == IMAGETYPE_JPEG) {
|
902 |
+
$result = imagejpeg($image, $filename, $compression);
|
903 |
+
} elseif ($imageType == IMAGETYPE_GIF) {
|
904 |
+
$result = imagegif($image, $filename);
|
905 |
+
} elseif ($imageType == IMAGETYPE_PNG) {
|
906 |
+
$result = imagepng($image, $filename);
|
907 |
+
}
|
908 |
+
|
909 |
+
if ($permissions != null) {
|
910 |
+
chmod($filename, $permissions);
|
911 |
+
}
|
912 |
+
|
913 |
+
imagedestroy($image);
|
914 |
+
|
915 |
+
return $result;
|
916 |
+
}
|
917 |
+
|
918 |
+
function _createFile($source, $destination)
|
919 |
+
{
|
920 |
+
if ($this->_create_dir(dirname($destination)) !== false) {
|
921 |
+
$destination = M1_STORE_BASE_DIR . $destination;
|
922 |
+
$body = base64_decode($source);
|
923 |
+
if ($body === false || file_put_contents($destination, $body) === false) {
|
924 |
+
return '[BRIDGE ERROR] File save failed!';
|
925 |
+
}
|
926 |
+
|
927 |
+
return 'OK';
|
928 |
+
}
|
929 |
+
|
930 |
+
return '[BRIDGE ERROR] Directory creation failed!';
|
931 |
+
}
|
932 |
+
|
933 |
+
function _saveFileLocal($source, $destination)
|
934 |
+
{
|
935 |
+
$srcInfo = parse_url($source);
|
936 |
+
$src = rtrim($_SERVER['DOCUMENT_ROOT'], "/") . $srcInfo['path'];
|
937 |
+
|
938 |
+
if ($this->_create_dir(dirname($destination)) !== false) {
|
939 |
+
$dst = M1_STORE_BASE_DIR . $destination;
|
940 |
+
|
941 |
+
if (!@copy($src, $dst)) {
|
942 |
+
return $this->_saveFileCurl($source, $destination);
|
943 |
+
}
|
944 |
+
|
945 |
+
} else {
|
946 |
+
return "[BRIDGE ERROR] Directory creation failed!";
|
947 |
+
}
|
948 |
+
|
949 |
+
return "OK";
|
950 |
+
}
|
951 |
+
|
952 |
+
function _saveFileCurl($source, $destination)
|
953 |
+
{
|
954 |
+
$source = $this->_escapeSource($source);
|
955 |
+
if ($this->_create_dir(dirname($destination)) !== false) {
|
956 |
+
$destination = M1_STORE_BASE_DIR . $destination;
|
957 |
+
|
958 |
+
$ch = curl_init();
|
959 |
+
curl_setopt($ch, CURLOPT_URL, $source);
|
960 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
961 |
+
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
962 |
+
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
|
963 |
+
curl_setopt($ch, CURLOPT_NOBODY, true);
|
964 |
+
curl_exec($ch);
|
965 |
+
$httpResponseCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
966 |
+
|
967 |
+
if ($httpResponseCode != 200) {
|
968 |
+
curl_close($ch);
|
969 |
+
return "[BRIDGE ERROR] Bad response received from source, HTTP code $httpResponseCode!";
|
970 |
+
}
|
971 |
+
|
972 |
+
$dst = @fopen($destination, "wb");
|
973 |
+
if ($dst === false) {
|
974 |
+
return "[BRIDGE ERROR] Can't create $destination!";
|
975 |
+
}
|
976 |
+
curl_setopt($ch, CURLOPT_NOBODY, false);
|
977 |
+
curl_setopt($ch, CURLOPT_FILE, $dst);
|
978 |
+
curl_setopt($ch, CURLOPT_HTTPGET, true);
|
979 |
+
curl_exec($ch);
|
980 |
+
if (($error_no = curl_errno($ch)) != CURLE_OK) {
|
981 |
+
return "[BRIDGE ERROR] $error_no: " . curl_error($ch);
|
982 |
+
}
|
983 |
+
curl_close($ch);
|
984 |
+
@chmod($destination, 0777);
|
985 |
+
|
986 |
+
return "OK";
|
987 |
+
|
988 |
+
} else {
|
989 |
+
return "[BRIDGE ERROR] Directory creation failed!";
|
990 |
+
}
|
991 |
+
}
|
992 |
+
|
993 |
+
function _escapeSource($source)
|
994 |
+
{
|
995 |
+
return str_replace(" ", "%20", $source);
|
996 |
+
}
|
997 |
+
|
998 |
+
function _create_dir($dir) {
|
999 |
+
$dirParts = explode("/", $dir);
|
1000 |
+
$path = M1_STORE_BASE_DIR;
|
1001 |
+
foreach ($dirParts as $item) {
|
1002 |
+
if ($item == '') {
|
1003 |
+
continue;
|
1004 |
+
}
|
1005 |
+
$path .= $item . DIRECTORY_SEPARATOR;
|
1006 |
+
if (!is_dir($path)) {
|
1007 |
+
$res = @mkdir($path);
|
1008 |
+
if (!$res) {
|
1009 |
+
return false;
|
1010 |
+
}
|
1011 |
+
}
|
1012 |
+
@chmod($path, 0777);
|
1013 |
+
}
|
1014 |
+
return true;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
function _isSameHost($source)
|
1018 |
+
{
|
1019 |
+
$srcInfo = parse_url($source);
|
1020 |
+
|
1021 |
+
if (preg_match('/\.php$/', $srcInfo['path'])) {
|
1022 |
+
return false;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
$hostInfo = parse_url("http://" . $_SERVER['HTTP_HOST']);
|
1026 |
+
if (@$srcInfo['host'] == $hostInfo['host']) {
|
1027 |
+
return true;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
return false;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
/**
|
1034 |
+
* @param $image - GD image object
|
1035 |
+
* @param $filename - store sorce pathfile ex. M1_STORE_BASE_DIR . '/img/c/2.gif';
|
1036 |
+
* @param $type - IMAGETYPE_JPEG, IMAGETYPE_GIF or IMAGETYPE_PNG
|
1037 |
+
* @param $extension - file extension, this use for jpg or jpeg extension in prestashop
|
1038 |
+
*
|
1039 |
+
* @return true if success or false if no
|
1040 |
+
*/
|
1041 |
+
function _convert($image, $filename, $type = IMAGETYPE_JPEG, $extension = '')
|
1042 |
+
{
|
1043 |
+
$end = pathinfo($filename, PATHINFO_EXTENSION);
|
1044 |
+
|
1045 |
+
if ($extension == '') {
|
1046 |
+
$extension = image_type_to_extension($type, false);
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
if ($end == $extension) {
|
1050 |
+
return true;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
$width = imagesx($image);
|
1054 |
+
$height = imagesy($image);
|
1055 |
+
|
1056 |
+
$newImage = imagecreatetruecolor($width, $height);
|
1057 |
+
|
1058 |
+
/* Allow to keep nice look even if resized */
|
1059 |
+
$white = imagecolorallocate($newImage, 255, 255, 255);
|
1060 |
+
imagefill($newImage, 0, 0, $white);
|
1061 |
+
imagecopyresampled($newImage, $image, 0, 0, 0, 0, $width, $height, $width, $height );
|
1062 |
+
imagecolortransparent($newImage, $white);
|
1063 |
+
|
1064 |
+
$pathSave = rtrim($filename, $end);
|
1065 |
+
|
1066 |
+
$pathSave .= $extension;
|
1067 |
+
|
1068 |
+
return $this->_saveImage($newImage, $pathSave, $type);
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
function _scaled($destination, $width, $height)
|
1072 |
+
{
|
1073 |
+
$image = $this->_loadImage($destination, false);
|
1074 |
+
|
1075 |
+
if ($image === false) {
|
1076 |
+
return;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
$originWidth = imagesx( $image );
|
1080 |
+
$originHeight = imagesy( $image );
|
1081 |
+
|
1082 |
+
$rw = (int)$height * (int)$originWidth / (int)$originHeight;
|
1083 |
+
$useHeight = ($rw <= $width);
|
1084 |
+
|
1085 |
+
if ($useHeight) {
|
1086 |
+
$width = (int)$rw;
|
1087 |
+
} else {
|
1088 |
+
$height = (int)((int)($width) * (int)($originHeight) / (int)($originWidth));
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
$newImage = imagecreatetruecolor($width, $height);
|
1092 |
+
$white = imagecolorallocate($newImage, 255, 255, 255);
|
1093 |
+
imagefill($newImage, 0, 0, $white);
|
1094 |
+
imagecopyresampled($newImage, $image, 0, 0, 0, 0, $width, $height, $originWidth, $originHeight);
|
1095 |
+
imagecolortransparent($newImage, $white);
|
1096 |
+
|
1097 |
+
return $this->_saveImage($newImage, $destination, $this->_imageType, 100) ? "OK" : "CAN'T SCALE IMAGE";
|
1098 |
+
}
|
1099 |
+
|
1100 |
+
//scaled2 method optimizet for prestashop
|
1101 |
+
function _scaled2($destination, $destWidth, $destHeight)
|
1102 |
+
{
|
1103 |
+
$method = 0;
|
1104 |
+
|
1105 |
+
$sourceImage = $this->_loadImage($destination, false);
|
1106 |
+
|
1107 |
+
if ($sourceImage === false) {
|
1108 |
+
return "IMAGE NOT SUPPORTED";
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
$sourceWidth = imagesx($sourceImage);
|
1112 |
+
$sourceHeight = imagesy($sourceImage);
|
1113 |
+
|
1114 |
+
$widthDiff = $destWidth / $sourceWidth;
|
1115 |
+
$heightDiff = $destHeight / $sourceHeight;
|
1116 |
+
|
1117 |
+
if ($widthDiff > 1 && $heightDiff > 1) {
|
1118 |
+
$nextWidth = $sourceWidth;
|
1119 |
+
$nextHeight = $sourceHeight;
|
1120 |
+
} else {
|
1121 |
+
if (intval($method) == 2 || (intval($method) == 0 AND $widthDiff > $heightDiff)) {
|
1122 |
+
$nextHeight = $destHeight;
|
1123 |
+
$nextWidth = intval(($sourceWidth * $nextHeight) / $sourceHeight);
|
1124 |
+
$destWidth = ((intval($method) == 0 ) ? $destWidth : $nextWidth);
|
1125 |
+
} else {
|
1126 |
+
$nextWidth = $destWidth;
|
1127 |
+
$nextHeight = intval($sourceHeight * $destWidth / $sourceWidth);
|
1128 |
+
$destHeight = (intval($method) == 0 ? $destHeight : $nextHeight);
|
1129 |
+
}
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
$borderWidth = intval(($destWidth - $nextWidth) / 2);
|
1133 |
+
$borderHeight = intval(($destHeight - $nextHeight) / 2);
|
1134 |
+
|
1135 |
+
$destImage = imagecreatetruecolor($destWidth, $destHeight);
|
1136 |
+
|
1137 |
+
$white = imagecolorallocate($destImage, 255, 255, 255);
|
1138 |
+
imagefill($destImage, 0, 0, $white);
|
1139 |
+
|
1140 |
+
imagecopyresampled($destImage, $sourceImage, $borderWidth, $borderHeight, 0, 0, $nextWidth, $nextHeight, $sourceWidth, $sourceHeight);
|
1141 |
+
imagecolortransparent($destImage, $white);
|
1142 |
+
|
1143 |
+
return $this->_saveImage($destImage, $destination, $this->_imageType, 100) ? "OK" : "CAN'T SCALE IMAGE";
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
class M1_Bridge_Action_Query
|
1148 |
+
{
|
1149 |
+
function perform($bridge)
|
1150 |
+
{
|
1151 |
+
if (isset($_POST['query']) && isset($_POST['fetchMode'])) {
|
1152 |
+
$query = base64_decode($_POST['query']);
|
1153 |
+
|
1154 |
+
$res = $bridge->query($query, (int)$_POST['fetchMode']);
|
1155 |
+
|
1156 |
+
if (is_array($res['result']) || is_bool($res['result'])) {
|
1157 |
+
$result = serialize(array(
|
1158 |
+
'res' => $res['result'],
|
1159 |
+
'fetchedFields' => @$res['fetchedFields'],
|
1160 |
+
'insertId' => $bridge->getLink()->getLastInsertId(),
|
1161 |
+
'affectedRows' => $bridge->getLink()->getAffectedRows(),
|
1162 |
+
));
|
1163 |
+
|
1164 |
+
echo base64_encode($result);
|
1165 |
+
} else {
|
1166 |
+
echo base64_encode($res['message']);
|
1167 |
+
}
|
1168 |
+
} else {
|
1169 |
+
return false;
|
1170 |
+
}
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
|
1175 |
+
class M1_Config_Adapter
|
1176 |
+
{
|
1177 |
+
var $Host = 'localhost';
|
1178 |
+
var $Port = null;//"3306";
|
1179 |
+
var $Username = 'root';
|
1180 |
+
var $Password = '';
|
1181 |
+
var $Dbname = '';
|
1182 |
+
var $TblPrefix = '';
|
1183 |
+
|
1184 |
+
var $cartType = 'Oscommerce22ms2';
|
1185 |
+
var $imagesDir = '';
|
1186 |
+
var $categoriesImagesDir = '';
|
1187 |
+
var $productsImagesDir = '';
|
1188 |
+
var $manufacturersImagesDir = '';
|
1189 |
+
var $categoriesImagesDirs = '';
|
1190 |
+
var $productsImagesDirs = '';
|
1191 |
+
var $manufacturersImagesDirs = '';
|
1192 |
+
|
1193 |
+
var $languages = array();
|
1194 |
+
var $cartVars = array();
|
1195 |
+
|
1196 |
+
function create()
|
1197 |
+
{
|
1198 |
+
if (isset($_GET["action"]) && $_GET["action"] == "update") {
|
1199 |
+
return null;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
$cartType = $this->_detectCartType();
|
1203 |
+
$className = "M1_Config_Adapter_" . $cartType;
|
1204 |
+
|
1205 |
+
$obj = new $className();
|
1206 |
+
$obj->cartType = $cartType;
|
1207 |
+
|
1208 |
+
return $obj;
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
function _detectCartType()
|
1212 |
+
{
|
1213 |
+
// Zencart137
|
1214 |
+
if (file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "configure.php")
|
1215 |
+
&& file_exists(M1_STORE_BASE_DIR . "ipn_main_handler.php")
|
1216 |
+
) {
|
1217 |
+
return "Zencart137";
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
//osCommerce
|
1221 |
+
/* is if not tomatocart */
|
1222 |
+
if (file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "configure.php")
|
1223 |
+
&& !file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "toc_constants.php")
|
1224 |
+
) {
|
1225 |
+
return "Oscommerce22ms2";
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
if (file_exists(M1_STORE_BASE_DIR . "/includes/configure.php")) {
|
1229 |
+
return "Gambio";
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
//JooCart
|
1233 |
+
if (file_exists(M1_STORE_BASE_DIR . '/components/com_opencart/opencart.php')) {
|
1234 |
+
return 'JooCart';
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
//ACEShop
|
1238 |
+
if (file_exists(M1_STORE_BASE_DIR . '/components/com_aceshop/aceshop.php')) {
|
1239 |
+
return 'AceShop';
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
//Litecommerce
|
1243 |
+
if ((file_exists(M1_STORE_BASE_DIR .'/etc/config.php'))
|
1244 |
+
|| (file_exists(M1_STORE_BASE_DIR .'/modules/lc_connector/litecommerce/etc/config.php'))
|
1245 |
+
) {
|
1246 |
+
return "Litecommerce";
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
//Prestashop11
|
1250 |
+
if (file_exists(M1_STORE_BASE_DIR . "config/config.inc.php")) {
|
1251 |
+
if (file_exists(M1_STORE_BASE_DIR . "cache/class_index.php")) {
|
1252 |
+
return "Prestashop15";
|
1253 |
+
}
|
1254 |
+
return "Prestashop11";
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
/*
|
1258 |
+
* Virtuemart113
|
1259 |
+
*/
|
1260 |
+
if (file_exists(M1_STORE_BASE_DIR . "configuration.php")) {
|
1261 |
+
return "Virtuemart113";
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
/*
|
1265 |
+
* Pinnacle361
|
1266 |
+
*/
|
1267 |
+
if (file_exists(M1_STORE_BASE_DIR . 'content/engine/engine_config.php')) {
|
1268 |
+
return "Pinnacle361";
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
// Magento1212, we can be sure that PHP is >= 5.2.0
|
1272 |
+
if (file_exists(M1_STORE_BASE_DIR . 'app/etc/local.xml')) {
|
1273 |
+
return "Magento1212";
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
//Cubecart3
|
1277 |
+
if (file_exists(M1_STORE_BASE_DIR . 'includes/global.inc.php')) {
|
1278 |
+
return "Cubecart";
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
//Cscart203 - 3
|
1282 |
+
if (file_exists(M1_STORE_BASE_DIR . "config.local.php") || file_exists(M1_STORE_BASE_DIR . "partner.php")) {
|
1283 |
+
return "Cscart203";
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
//Opencart14
|
1287 |
+
if ((file_exists(M1_STORE_BASE_DIR . "system/startup.php")
|
1288 |
+
|| (file_exists(M1_STORE_BASE_DIR . "common.php"))
|
1289 |
+
|| (file_exists(M1_STORE_BASE_DIR . "library/locator.php"))
|
1290 |
+
) && file_exists(M1_STORE_BASE_DIR . "config.php")
|
1291 |
+
) {
|
1292 |
+
return "Opencart14";
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
//Shopware
|
1296 |
+
if (file_exists(M1_STORE_BASE_DIR . "config.php") && file_exists(M1_STORE_BASE_DIR . "shopware.php")) {
|
1297 |
+
return "Shopware";
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
//XCart
|
1301 |
+
if (file_exists(M1_STORE_BASE_DIR . "config.php")) {
|
1302 |
+
return "XCart";
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
//LemonStand
|
1306 |
+
if (file_exists(M1_STORE_BASE_DIR . "boot.php")) {
|
1307 |
+
return "LemonStand";
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
//Interspire
|
1311 |
+
if (file_exists(M1_STORE_BASE_DIR . "config/config.php")) {
|
1312 |
+
return "Interspire";
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
//Squirrelcart242
|
1316 |
+
if (file_exists(M1_STORE_BASE_DIR . 'squirrelcart/config.php')) {
|
1317 |
+
return "Squirrelcart242";
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
//Shopscript WebAsyst
|
1321 |
+
if (file_exists(M1_STORE_BASE_DIR . 'kernel/wbs.xml')) {
|
1322 |
+
return "WebAsyst";
|
1323 |
+
}
|
1324 |
+
|
1325 |
+
//Shopscript Premium
|
1326 |
+
if (file_exists(M1_STORE_BASE_DIR . 'cfg/general.inc.php') && file_exists(M1_STORE_BASE_DIR . 'cfg/connect.inc.php')) {
|
1327 |
+
return "SSFree";
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
//Shopscript Premium
|
1331 |
+
if (file_exists(M1_STORE_BASE_DIR . 'cfg/connect.inc.php')) {
|
1332 |
+
return "SSPremium";
|
1333 |
+
}
|
1334 |
+
|
1335 |
+
//ShopScript5
|
1336 |
+
if (file_exists(M1_STORE_BASE_DIR . 'wa.php') && file_exists(M1_STORE_BASE_DIR . 'wa-config/db.php')) {
|
1337 |
+
return "SSPremium";
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
//Summercart3
|
1341 |
+
if (file_exists(M1_STORE_BASE_DIR . 'sclic.lic') && file_exists(M1_STORE_BASE_DIR . 'include/miphpf/Config.php')) {
|
1342 |
+
return "Summercart3";
|
1343 |
+
}
|
1344 |
+
|
1345 |
+
//XtcommerceVeyton
|
1346 |
+
if (file_exists(M1_STORE_BASE_DIR . 'conf/config.php')) {
|
1347 |
+
return "XtcommerceVeyton";
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
//Ubercart
|
1351 |
+
if (file_exists(M1_STORE_BASE_DIR . 'sites/default/settings.php' )) {
|
1352 |
+
if (file_exists( M1_STORE_BASE_DIR . '/modules/ubercart/uc_store/includes/coder_review_uc3x.inc')) {
|
1353 |
+
return "Ubercart3";
|
1354 |
+
} elseif (file_exists(M1_STORE_BASE_DIR . 'sites/all/modules/commerce/includes/commerce.controller.inc')) {
|
1355 |
+
return "DrupalCommerce";
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
return "Ubercart";
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
//Woocommerce
|
1362 |
+
if (file_exists(M1_STORE_BASE_DIR . 'wp-config.php')
|
1363 |
+
&& file_exists(M1_STORE_BASE_DIR . 'wp-content/plugins/woocommerce/woocommerce.php')
|
1364 |
+
) {
|
1365 |
+
return 'Woocommerce';
|
1366 |
+
}
|
1367 |
+
|
1368 |
+
if (file_exists(dirname(M1_STORE_BASE_DIR) . '/wp-config.php')
|
1369 |
+
&& file_exists(M1_STORE_BASE_DIR . 'wp-content/plugins/woocommerce/woocommerce.php')
|
1370 |
+
) {
|
1371 |
+
return 'Woocommerce';
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
//WPecommerce
|
1375 |
+
if (file_exists(M1_STORE_BASE_DIR . 'wp-config.php')) {
|
1376 |
+
return 'WPecommerce';
|
1377 |
+
}
|
1378 |
+
|
1379 |
+
//OXID e-shop
|
1380 |
+
if (file_exists( M1_STORE_BASE_DIR . 'config.inc.php')) {
|
1381 |
+
return 'Oxid';
|
1382 |
+
}
|
1383 |
+
|
1384 |
+
//HHGMultistore
|
1385 |
+
if (file_exists(M1_STORE_BASE_DIR . 'core/config/configure.php')) {
|
1386 |
+
return 'Hhgmultistore';
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
//SunShop
|
1390 |
+
if (file_exists(M1_STORE_BASE_DIR . "include" . DIRECTORY_SEPARATOR . "config.php")
|
1391 |
+
|| file_exists(M1_STORE_BASE_DIR . "include" . DIRECTORY_SEPARATOR . "db_mysql.php")
|
1392 |
+
) {
|
1393 |
+
return "Sunshop4";
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
//Tomatocart
|
1397 |
+
if (file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "configure.php")
|
1398 |
+
&& file_exists(M1_STORE_BASE_DIR. "includes" . DIRECTORY_SEPARATOR . "toc_constants.php")
|
1399 |
+
) {
|
1400 |
+
return 'Tomatocart';
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
die ("BRIDGE_ERROR_CONFIGURATION_NOT_FOUND");
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
function getAdapterPath($cartType)
|
1407 |
+
{
|
1408 |
+
return M1_STORE_BASE_DIR . M1_BRIDGE_DIRECTORY_NAME . DIRECTORY_SEPARATOR
|
1409 |
+
. "app" . DIRECTORY_SEPARATOR
|
1410 |
+
. "class" . DIRECTORY_SEPARATOR
|
1411 |
+
. "config_adapter" . DIRECTORY_SEPARATOR . $cartType . ".php";
|
1412 |
+
}
|
1413 |
+
|
1414 |
+
function setHostPort($source)
|
1415 |
+
{
|
1416 |
+
$source = trim($source);
|
1417 |
+
|
1418 |
+
if ($source == '') {
|
1419 |
+
$this->Host = 'localhost';
|
1420 |
+
return;
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
$conf = explode(":", $source);
|
1424 |
+
|
1425 |
+
if (isset($conf[0]) && isset($conf[1])) {
|
1426 |
+
$this->Host = $conf[0];
|
1427 |
+
$this->Port = $conf[1];
|
1428 |
+
} elseif ($source[0] == '/') {
|
1429 |
+
$this->Host = 'localhost';
|
1430 |
+
$this->Port = $source;
|
1431 |
+
} else {
|
1432 |
+
$this->Host = $source;
|
1433 |
+
}
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
function connect()
|
1437 |
+
{
|
1438 |
+
if (function_exists('mysql_connect')) {
|
1439 |
+
$link = new M1_Mysql($this);
|
1440 |
+
} elseif (function_exists('mysqli_connect')) {
|
1441 |
+
$link = new M1_Mysqli($this);
|
1442 |
+
} elseif (extension_loaded('pdo_mysql')) {
|
1443 |
+
$link = new M1_Pdo($this);
|
1444 |
+
} else {
|
1445 |
+
$link = false;
|
1446 |
+
}
|
1447 |
+
|
1448 |
+
return $link;
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
function getCartVersionFromDb($field, $tableName, $where)
|
1452 |
+
{
|
1453 |
+
$version = '';
|
1454 |
+
|
1455 |
+
$link = $this->connect();
|
1456 |
+
if (!$link) {
|
1457 |
+
return '[ERROR] MySQL Query Error: Can not connect to DB';
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
$result = $link->localQuery("
|
1461 |
+
SELECT " . $field . " AS version
|
1462 |
+
FROM " . $this->TblPrefix . $tableName . "
|
1463 |
+
WHERE " . $where
|
1464 |
+
);
|
1465 |
+
|
1466 |
+
if (is_array($result) && isset($result[0]['version'])) {
|
1467 |
+
$version = $result[0]['version'];
|
1468 |
+
}
|
1469 |
+
|
1470 |
+
return $version;
|
1471 |
+
}
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
/**
|
1475 |
+
* @package api2cart
|
1476 |
+
* @author Vasul Babiy (v.babyi@magneticone.com)
|
1477 |
+
* @license Not public license
|
1478 |
+
* @link https://www.api2cart.com
|
1479 |
+
*/
|
1480 |
+
|
1481 |
+
class M1_Mysqli
|
1482 |
+
{
|
1483 |
+
var $config = null; // config adapter
|
1484 |
+
var $result = array();
|
1485 |
+
var $dataBaseHandle = null;
|
1486 |
+
|
1487 |
+
/**
|
1488 |
+
* mysql constructor
|
1489 |
+
*
|
1490 |
+
* @param M1_Config_Adapter $config
|
1491 |
+
* @return M1_Mysql
|
1492 |
+
*/
|
1493 |
+
function M1_Mysqli($config)
|
1494 |
+
{
|
1495 |
+
$this->config = $config;
|
1496 |
+
}
|
1497 |
+
|
1498 |
+
/**
|
1499 |
+
* @return bool|null|resource
|
1500 |
+
*/
|
1501 |
+
function getDataBaseHandle()
|
1502 |
+
{
|
1503 |
+
if ($this->dataBaseHandle) {
|
1504 |
+
return $this->dataBaseHandle;
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
$this->dataBaseHandle = $this->connect();
|
1508 |
+
|
1509 |
+
if (!$this->dataBaseHandle) {
|
1510 |
+
exit('[ERROR] MySQLi Query Error: Can not connect to DB');
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
return $this->dataBaseHandle;
|
1514 |
+
}
|
1515 |
+
|
1516 |
+
/**
|
1517 |
+
* @return bool|null|resource
|
1518 |
+
*/
|
1519 |
+
function connect()
|
1520 |
+
{
|
1521 |
+
$triesCount = 10;
|
1522 |
+
$link = null;
|
1523 |
+
$host = $this->config->Host . ($this->config->Port ? ':' . $this->config->Port : '');
|
1524 |
+
$password = stripslashes($this->config->Password);
|
1525 |
+
|
1526 |
+
while (!$link) {
|
1527 |
+
if (!$triesCount--) {
|
1528 |
+
break;
|
1529 |
+
}
|
1530 |
+
|
1531 |
+
$link = @mysqli_connect($host, $this->config->Username, $password);
|
1532 |
+
if (!$link) {
|
1533 |
+
sleep(5);
|
1534 |
+
}
|
1535 |
+
}
|
1536 |
+
|
1537 |
+
if ($link) {
|
1538 |
+
mysqli_select_db($link, $this->config->Dbname);
|
1539 |
+
} else {
|
1540 |
+
return false;
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
return $link;
|
1544 |
+
}
|
1545 |
+
|
1546 |
+
/**
|
1547 |
+
* @param $sql
|
1548 |
+
*
|
1549 |
+
* @return array|bool|mysqli_result
|
1550 |
+
*/
|
1551 |
+
function localQuery($sql)
|
1552 |
+
{
|
1553 |
+
$result = array();
|
1554 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
1555 |
+
|
1556 |
+
$sth = mysqli_query($dataBaseHandle, $sql);
|
1557 |
+
|
1558 |
+
if (is_bool($sth)) {
|
1559 |
+
return $sth;
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
while (($row = mysqli_fetch_assoc($sth))) {
|
1563 |
+
$result[] = $row;
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
return $result;
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
/**
|
1570 |
+
* @param $sql
|
1571 |
+
* @param $fetchType
|
1572 |
+
*
|
1573 |
+
* @return array
|
1574 |
+
*/
|
1575 |
+
function query($sql, $fetchType)
|
1576 |
+
{
|
1577 |
+
$result = array(
|
1578 |
+
'result' => null,
|
1579 |
+
'message' => ''
|
1580 |
+
);
|
1581 |
+
|
1582 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
1583 |
+
|
1584 |
+
if (!$dataBaseHandle) {
|
1585 |
+
$result['message'] = '[ERROR] MySQLi Query Error: Can not connect to DB';
|
1586 |
+
return $result;
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
if (isset($_GET['disable_checks'])) {
|
1590 |
+
$this->localQuery('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0');
|
1591 |
+
$this->localQuery("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
|
1592 |
+
}
|
1593 |
+
|
1594 |
+
if (isset($_REQUEST['set_names'])) {
|
1595 |
+
@mysqli_query($dataBaseHandle, "SET NAMES " . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1596 |
+
@mysqli_query($dataBaseHandle, "SET CHARACTER SET " . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1597 |
+
@mysqli_query($dataBaseHandle, "SET CHARACTER_SET_CONNECTION=" . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1598 |
+
}
|
1599 |
+
|
1600 |
+
$fetchMode = MYSQLI_ASSOC;
|
1601 |
+
switch ($fetchType) {
|
1602 |
+
case 3:
|
1603 |
+
$fetchMode = MYSQLI_BOTH;
|
1604 |
+
break;
|
1605 |
+
case 2:
|
1606 |
+
$fetchMode = MYSQLI_NUM;
|
1607 |
+
break;
|
1608 |
+
case 1:
|
1609 |
+
$fetchMode = MYSQLI_ASSOC;
|
1610 |
+
break;
|
1611 |
+
default:
|
1612 |
+
break;
|
1613 |
+
}
|
1614 |
+
|
1615 |
+
$res = mysqli_query($dataBaseHandle, $sql);
|
1616 |
+
|
1617 |
+
$triesCount = 10;
|
1618 |
+
while (mysqli_errno($dataBaseHandle) == 2013) {
|
1619 |
+
if (!$triesCount--) {
|
1620 |
+
break;
|
1621 |
+
}
|
1622 |
+
// reconnect
|
1623 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
1624 |
+
if ($dataBaseHandle) {
|
1625 |
+
|
1626 |
+
if (isset($_REQUEST['set_names'])) {
|
1627 |
+
@mysqli_query($dataBaseHandle, "SET NAMES " . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1628 |
+
@mysqli_query($dataBaseHandle, "SET CHARACTER SET " . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1629 |
+
@mysqli_query($dataBaseHandle, "SET CHARACTER_SET_CONNECTION=" . @mysqli_real_escape_string($dataBaseHandle, $_REQUEST['set_names']));
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
// execute query once again
|
1633 |
+
$res = mysqli_query($dataBaseHandle, $sql);
|
1634 |
+
}
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
if (($errno = mysqli_errno($dataBaseHandle)) != 0) {
|
1638 |
+
$result['message'] = '[ERROR] MySQLi Query Error: ' . $errno . ', ' . mysqli_error($dataBaseHandle);
|
1639 |
+
return $result;
|
1640 |
+
}
|
1641 |
+
|
1642 |
+
$fetchedFields = array();
|
1643 |
+
while ($field = mysqli_fetch_field($res)) {
|
1644 |
+
$fetchedFields[] = $field;
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
$rows = array();
|
1648 |
+
while ($row = mysqli_fetch_array($res, $fetchMode)) {
|
1649 |
+
$rows[] = $row;
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
if (isset($_GET['disable_checks'])) {
|
1653 |
+
$this->localQuery("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
|
1654 |
+
$this->localQuery("SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS,0)");
|
1655 |
+
}
|
1656 |
+
|
1657 |
+
$result['result'] = $rows;
|
1658 |
+
$result['fetchedFields'] = $fetchedFields;
|
1659 |
+
|
1660 |
+
mysqli_free_result($res);
|
1661 |
+
|
1662 |
+
return $result;
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
/**
|
1666 |
+
* @return int
|
1667 |
+
*/
|
1668 |
+
function getLastInsertId()
|
1669 |
+
{
|
1670 |
+
return mysqli_insert_id($this->dataBaseHandle);
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
/**
|
1674 |
+
* @return int
|
1675 |
+
*/
|
1676 |
+
function getAffectedRows()
|
1677 |
+
{
|
1678 |
+
return mysqli_affected_rows($this->dataBaseHandle);
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
/**
|
1682 |
+
* @return void
|
1683 |
+
*/
|
1684 |
+
function __destruct()
|
1685 |
+
{
|
1686 |
+
if ($this->dataBaseHandle) {
|
1687 |
+
mysqli_close($this->dataBaseHandle);
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
$this->dataBaseHandle = null;
|
1691 |
+
}
|
1692 |
+
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
|
1696 |
+
class M1_Config_Adapter_Cscart203 extends M1_Config_Adapter
|
1697 |
+
{
|
1698 |
+
function M1_Config_Adapter_Cscart203()
|
1699 |
+
{
|
1700 |
+
define("IN_CSCART", 1);
|
1701 |
+
define("CSCART_DIR", M1_STORE_BASE_DIR);
|
1702 |
+
define("AREA", 1);
|
1703 |
+
define("DIR_ROOT", M1_STORE_BASE_DIR);
|
1704 |
+
define("DIR_CSCART", M1_STORE_BASE_DIR);
|
1705 |
+
define('DS', DIRECTORY_SEPARATOR);
|
1706 |
+
define('BOOTSTRAP', '');
|
1707 |
+
require_once M1_STORE_BASE_DIR . 'config.php';
|
1708 |
+
defined('DIR_IMAGES') or define('DIR_IMAGES', DIR_ROOT . '/images/');
|
1709 |
+
|
1710 |
+
//For CS CART 1.3.x
|
1711 |
+
if( isset( $db_host ) && isset($db_name) && isset($db_user) && isset($db_password) ) {
|
1712 |
+
$this->setHostPort($db_host);
|
1713 |
+
$this->Dbname = $db_name;
|
1714 |
+
$this->Username = $db_user;
|
1715 |
+
$this->Password = $db_password;
|
1716 |
+
$this->imagesDir = str_replace(M1_STORE_BASE_DIR, '', IMAGES_STORAGE_DIR );
|
1717 |
+
} else {
|
1718 |
+
|
1719 |
+
$this->setHostPort($config['db_host']);
|
1720 |
+
$this->Dbname = $config['db_name'];
|
1721 |
+
$this->Username = $config['db_user'];
|
1722 |
+
$this->Password = $config['db_password'];
|
1723 |
+
$this->imagesDir = str_replace(M1_STORE_BASE_DIR, '', DIR_IMAGES);
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1727 |
+
$this->productsImagesDir = $this->imagesDir;
|
1728 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1729 |
+
|
1730 |
+
if( defined('MAX_FILES_IN_DIR') ) {
|
1731 |
+
$this->cartVars['cs_max_files_in_dir'] = MAX_FILES_IN_DIR;
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
if( defined('PRODUCT_VERSION') ) {
|
1735 |
+
$this->cartVars['dbVersion'] = PRODUCT_VERSION;
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
|
1741 |
+
class M1_Config_Adapter_Opencart14 extends M1_Config_Adapter
|
1742 |
+
{
|
1743 |
+
function M1_Config_Adapter_Opencart14()
|
1744 |
+
{
|
1745 |
+
include_once( M1_STORE_BASE_DIR . "/config.php");
|
1746 |
+
|
1747 |
+
if( defined('DB_HOST') ) {
|
1748 |
+
$this->setHostPort(DB_HOST);
|
1749 |
+
} else {
|
1750 |
+
$this->setHostPort(DB_HOSTNAME);
|
1751 |
+
}
|
1752 |
+
|
1753 |
+
if( defined('DB_USER') ) {
|
1754 |
+
$this->Username = DB_USER;
|
1755 |
+
} else {
|
1756 |
+
$this->Username = DB_USERNAME;
|
1757 |
+
}
|
1758 |
+
|
1759 |
+
$this->Password = DB_PASSWORD;
|
1760 |
+
|
1761 |
+
if( defined('DB_NAME') ) {
|
1762 |
+
$this->Dbname = DB_NAME;
|
1763 |
+
} else {
|
1764 |
+
$this->Dbname = DB_DATABASE;
|
1765 |
+
}
|
1766 |
+
|
1767 |
+
$indexFileContent = '';
|
1768 |
+
$startupFileContent = '';
|
1769 |
+
|
1770 |
+
if ( file_exists(M1_STORE_BASE_DIR . "/index.php") ) {
|
1771 |
+
$indexFileContent = file_get_contents(M1_STORE_BASE_DIR . "/index.php");
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
if (file_exists(M1_STORE_BASE_DIR . "/system/startup.php")) {
|
1775 |
+
$startupFileContent = file_get_contents(M1_STORE_BASE_DIR . "/system/startup.php");
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
if ( preg_match("/define\('\VERSION\'\, \'(.+)\'\)/", $indexFileContent, $match) == 0 ) {
|
1779 |
+
preg_match("/define\('\VERSION\'\, \'(.+)\'\)/", $startupFileContent, $match);
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
if ( count($match) > 0 ) {
|
1783 |
+
$this->cartVars['dbVersion'] = $match[1];
|
1784 |
+
unset($match);
|
1785 |
+
}
|
1786 |
+
|
1787 |
+
$this->imagesDir = "/image/";
|
1788 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1789 |
+
$this->productsImagesDir = $this->imagesDir;
|
1790 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1791 |
+
|
1792 |
+
}
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
|
1796 |
+
|
1797 |
+
class M1_Config_Adapter_Oscommerce3 extends M1_Config_Adapter
|
1798 |
+
{
|
1799 |
+
function M1_Config_Adapter_Oscommerce3()
|
1800 |
+
{
|
1801 |
+
$file = M1_STORE_BASE_DIR .'/osCommerce/OM/Config/settings.ini';
|
1802 |
+
$settings=parse_ini_file($file);
|
1803 |
+
$this->imagesDir = "/public/";
|
1804 |
+
$this->categoriesImagesDir = $this->imagesDir."/categories";
|
1805 |
+
$this->productsImagesDir = $this->imagesDir."/products";
|
1806 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1807 |
+
|
1808 |
+
$this->Host = $settings['db_server'];
|
1809 |
+
$this->setHostPort($settings['db_server_port']);
|
1810 |
+
$this->Username = $settings['db_server_username'];
|
1811 |
+
$this->Password = $settings['db_server_password'];
|
1812 |
+
$this->Dbname = $settings['db_database'];
|
1813 |
+
}
|
1814 |
+
}
|
1815 |
+
|
1816 |
+
|
1817 |
+
|
1818 |
+
class M1_Config_Adapter_SSPremium extends M1_Config_Adapter
|
1819 |
+
{
|
1820 |
+
function M1_Config_Adapter_SSPremium()
|
1821 |
+
{
|
1822 |
+
if ( file_exists(M1_STORE_BASE_DIR . 'cfg/connect.inc.php') ){
|
1823 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . 'cfg/connect.inc.php');
|
1824 |
+
preg_match("/define\(\'DB_NAME\', \'(.+)\'\);/", $config, $match);
|
1825 |
+
$this->Dbname = $match[1];
|
1826 |
+
preg_match("/define\(\'DB_USER\', \'(.+)\'\);/", $config, $match);
|
1827 |
+
$this->Username = $match[1];
|
1828 |
+
preg_match("/define\(\'DB_PASS\', \'(.*)\'\);/", $config, $match);
|
1829 |
+
$this->Password = $match[1];
|
1830 |
+
preg_match("/define\(\'DB_HOST\', \'(.+)\'\);/", $config, $match);
|
1831 |
+
$this->setHostPort( $match[1] );
|
1832 |
+
|
1833 |
+
$this->imagesDir = "products_pictures/";
|
1834 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1835 |
+
$this->productsImagesDir = $this->imagesDir;
|
1836 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1837 |
+
|
1838 |
+
$version = $this->getCartVersionFromDb("value", "SS_system", "varName = 'version_number'");
|
1839 |
+
if ( $version != '' ) {
|
1840 |
+
$this->cartVars['dbVersion'] = $version;
|
1841 |
+
}
|
1842 |
+
} else {
|
1843 |
+
$config = include M1_STORE_BASE_DIR . "wa-config/db.php";
|
1844 |
+
$this->Dbname = $config['default']['database'];
|
1845 |
+
$this->Username = $config['default']['user'];
|
1846 |
+
$this->Password = $config['default']['password'];
|
1847 |
+
$this->setHostPort($config['default']['host']);
|
1848 |
+
|
1849 |
+
$this->imagesDir = "products_pictures/";
|
1850 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1851 |
+
$this->productsImagesDir = $this->imagesDir;
|
1852 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1853 |
+
$this->cartVars['dbVersion'] = '5.0';
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
class M1_Config_Adapter_Ubercart extends M1_Config_Adapter
|
1861 |
+
{
|
1862 |
+
function M1_Config_Adapter_Ubercart()
|
1863 |
+
{
|
1864 |
+
@include_once M1_STORE_BASE_DIR . "sites/default/settings.php";
|
1865 |
+
|
1866 |
+
$url = parse_url($db_url);
|
1867 |
+
|
1868 |
+
$url['user'] = urldecode($url['user']);
|
1869 |
+
// Test if database url has a password.
|
1870 |
+
$url['pass'] = isset($url['pass']) ? urldecode($url['pass']) : '';
|
1871 |
+
$url['host'] = urldecode($url['host']);
|
1872 |
+
$url['path'] = urldecode($url['path']);
|
1873 |
+
// Allow for non-standard MySQL port.
|
1874 |
+
if (isset($url['port'])) {
|
1875 |
+
$url['host'] = $url['host'] .':'. $url['port'];
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
$this->setHostPort( $url['host'] );
|
1879 |
+
$this->Dbname = ltrim( $url['path'], '/' );
|
1880 |
+
$this->Username = $url['user'];
|
1881 |
+
$this->Password = $url['pass'];
|
1882 |
+
|
1883 |
+
$this->imagesDir = "/sites/default/files/";
|
1884 |
+
if( !file_exists( M1_STORE_BASE_DIR . $this->imagesDir ) ) {
|
1885 |
+
$this->imagesDir = "/files";
|
1886 |
+
}
|
1887 |
+
|
1888 |
+
if ( file_exists(M1_STORE_BASE_DIR . "/modules/ubercart/uc_cart/uc_cart.info") ) {
|
1889 |
+
$str = file_get_contents(M1_STORE_BASE_DIR . "/modules/ubercart/uc_cart/uc_cart.info");
|
1890 |
+
if ( preg_match('/version\s+=\s+".+-(.+)"/', $str, $match) != 0 ) {
|
1891 |
+
$this->cartVars['dbVersion'] = $match[1];
|
1892 |
+
unset($match);
|
1893 |
+
}
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1897 |
+
$this->productsImagesDir = $this->imagesDir;
|
1898 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1899 |
+
}
|
1900 |
+
}
|
1901 |
+
|
1902 |
+
|
1903 |
+
|
1904 |
+
class M1_Config_Adapter_Prestashop11 extends M1_Config_Adapter
|
1905 |
+
{
|
1906 |
+
function M1_Config_Adapter_Prestashop11()
|
1907 |
+
{
|
1908 |
+
$confFileOne = file_get_contents(M1_STORE_BASE_DIR . "/config/settings.inc.php");
|
1909 |
+
$confFileTwo = file_get_contents(M1_STORE_BASE_DIR . "/config/config.inc.php");
|
1910 |
+
|
1911 |
+
$filesLines = array_merge(explode("\n", $confFileOne), explode("\n", $confFileTwo));
|
1912 |
+
|
1913 |
+
$execute = '$currentDir = \'\';';
|
1914 |
+
|
1915 |
+
$isComment = false;
|
1916 |
+
foreach ($filesLines as $line) {
|
1917 |
+
$startComment = preg_match("/^(\/\*)/", $line);
|
1918 |
+
$endComment = preg_match("/(\*\/)$/", $line);
|
1919 |
+
|
1920 |
+
if ($isComment) {
|
1921 |
+
if ($endComment) {
|
1922 |
+
$isComment = false;
|
1923 |
+
}
|
1924 |
+
continue;
|
1925 |
+
} elseif ($startComment) {
|
1926 |
+
$isComment = true;
|
1927 |
+
if ($endComment) {
|
1928 |
+
$isComment = false;
|
1929 |
+
}
|
1930 |
+
continue;
|
1931 |
+
}
|
1932 |
+
|
1933 |
+
if (preg_match("/^(\s*)define\(/i", $line)) {
|
1934 |
+
if ((strpos($line, '_DB_') !== false) || (strpos($line, '_PS_IMG_DIR_') !== false) || (strpos($line, '_PS_VERSION_') !== false)) {
|
1935 |
+
$execute .= " " . $line;
|
1936 |
+
}
|
1937 |
+
}
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
define( '_PS_ROOT_DIR_', M1_STORE_BASE_DIR );
|
1941 |
+
eval($execute);
|
1942 |
+
|
1943 |
+
$this->setHostPort(_DB_SERVER_);
|
1944 |
+
$this->Dbname = _DB_NAME_;
|
1945 |
+
$this->Username = _DB_USER_;
|
1946 |
+
$this->Password = _DB_PASSWD_;
|
1947 |
+
|
1948 |
+
if (defined('_PS_IMG_DIR_') && defined('_PS_ROOT_DIR_')) {
|
1949 |
+
|
1950 |
+
preg_match("/(\/\w+\/)$/i", _PS_IMG_DIR_, $m);
|
1951 |
+
$this->imagesDir = $m[1];
|
1952 |
+
|
1953 |
+
} else {
|
1954 |
+
$this->imagesDir = "/img/";
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1958 |
+
$this->productsImagesDir = $this->imagesDir;
|
1959 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1960 |
+
|
1961 |
+
if (defined('_PS_VERSION_')) {
|
1962 |
+
$this->cartVars['dbVersion'] = _PS_VERSION_;
|
1963 |
+
}
|
1964 |
+
}
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
|
1968 |
+
|
1969 |
+
class M1_Config_Adapter_Interspire extends M1_Config_Adapter
|
1970 |
+
{
|
1971 |
+
function M1_Config_Adapter_Interspire()
|
1972 |
+
{
|
1973 |
+
require_once M1_STORE_BASE_DIR . "config/config.php";
|
1974 |
+
|
1975 |
+
$this->setHostPort($GLOBALS['ISC_CFG']["dbServer"]);
|
1976 |
+
$this->Username = $GLOBALS['ISC_CFG']["dbUser"];
|
1977 |
+
$this->Password = $GLOBALS['ISC_CFG']["dbPass"];
|
1978 |
+
$this->Dbname = $GLOBALS['ISC_CFG']["dbDatabase"];
|
1979 |
+
|
1980 |
+
$this->imagesDir = $GLOBALS['ISC_CFG']["ImageDirectory"];
|
1981 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
1982 |
+
$this->productsImagesDir = $this->imagesDir;
|
1983 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
1984 |
+
|
1985 |
+
define('DEFAULT_LANGUAGE_ISO2',$GLOBALS['ISC_CFG']["Language"]);
|
1986 |
+
|
1987 |
+
$version = $this->getCartVersionFromDb("database_version", $GLOBALS['ISC_CFG']["tablePrefix"] . "config", '1');
|
1988 |
+
if ( $version != '' ) {
|
1989 |
+
$this->cartVars['dbVersion'] = $version;
|
1990 |
+
}
|
1991 |
+
}
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
class M1_Config_Adapter_Hhgmultistore extends M1_Config_Adapter
|
1995 |
+
{
|
1996 |
+
function M1_Config_Adapter_Hhgmultistore()
|
1997 |
+
{
|
1998 |
+
define('SITE_PATH','');
|
1999 |
+
define('WEB_PATH','');
|
2000 |
+
require_once M1_STORE_BASE_DIR . "core/config/configure.php";
|
2001 |
+
require_once M1_STORE_BASE_DIR . "core/config/paths.php";
|
2002 |
+
|
2003 |
+
$baseDir = "/store_files/1/";
|
2004 |
+
$this->imagesDir = $baseDir . DIR_WS_IMAGES;
|
2005 |
+
|
2006 |
+
$this->categoriesImagesDir = $baseDir . DIR_WS_CATEGORIE_IMAGES;
|
2007 |
+
$this->productsImagesDirs['info'] = $baseDir . DIR_WS_PRODUCT_INFO_IMAGES;
|
2008 |
+
$this->productsImagesDirs['org'] = $baseDir . DIR_WS_PRODUCT_ORG_IMAGES;
|
2009 |
+
$this->productsImagesDirs['thumb'] = $baseDir . DIR_WS_PRODUCT_THUMBNAIL_IMAGES;
|
2010 |
+
$this->productsImagesDirs['popup'] = $baseDir . DIR_WS_PRODUCT_POPUP_IMAGES;
|
2011 |
+
|
2012 |
+
$this->manufacturersImagesDirs['img'] = $baseDir . DIR_WS_MANUFACTURERS_IMAGES;
|
2013 |
+
$this->manufacturersImagesDirs['org'] = $baseDir . DIR_WS_MANUFACTURERS_ORG_IMAGES;
|
2014 |
+
|
2015 |
+
$this->Host = DB_SERVER;
|
2016 |
+
$this->Username = DB_SERVER_USERNAME;
|
2017 |
+
$this->Password = DB_SERVER_PASSWORD;
|
2018 |
+
$this->Dbname = DB_DATABASE;
|
2019 |
+
|
2020 |
+
if ( file_exists(M1_STORE_BASE_DIR . "/core/config/conf.hhg_startup.php") ) {
|
2021 |
+
$ver = file_get_contents(M1_STORE_BASE_DIR . "/core/config/conf.hhg_startup.php");
|
2022 |
+
if (preg_match('/PROJECT_VERSION.+\((.+)\)\'\)/', $ver, $match) != 0) {
|
2023 |
+
$this->cartVars['dbVersion'] = $match[1];
|
2024 |
+
unset($match);
|
2025 |
+
}
|
2026 |
+
}
|
2027 |
+
}
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
|
2031 |
+
class M1_Config_Adapter_Sunshop4 extends M1_Config_Adapter
|
2032 |
+
{
|
2033 |
+
function M1_Config_Adapter_Sunshop4()
|
2034 |
+
{
|
2035 |
+
@require_once M1_STORE_BASE_DIR
|
2036 |
+
. "include" . DIRECTORY_SEPARATOR
|
2037 |
+
. "config.php";
|
2038 |
+
|
2039 |
+
$this->imagesDir = "images/products/";
|
2040 |
+
|
2041 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2042 |
+
$this->productsImagesDir = $this->imagesDir;
|
2043 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2044 |
+
|
2045 |
+
if ( defined('ADMIN_DIR') ) {
|
2046 |
+
$this->cartVars['AdminUrl'] = ADMIN_DIR;
|
2047 |
+
}
|
2048 |
+
|
2049 |
+
$this->setHostPort($servername);
|
2050 |
+
$this->Username = $dbusername;
|
2051 |
+
$this->Password = $dbpassword;
|
2052 |
+
$this->Dbname = $dbname;
|
2053 |
+
|
2054 |
+
if (isset($dbprefix)) {
|
2055 |
+
$this->TblPrefix = $dbprefix;
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
$version = $this->getCartVersionFromDb("value", "settings", "name = 'version'");
|
2059 |
+
if ( $version != '' ) {
|
2060 |
+
$this->cartVars['dbVersion'] = $version;
|
2061 |
+
}
|
2062 |
+
|
2063 |
+
}
|
2064 |
+
}
|
2065 |
+
|
2066 |
+
|
2067 |
+
|
2068 |
+
class M1_Config_Adapter_Virtuemart113 extends M1_Config_Adapter
|
2069 |
+
{
|
2070 |
+
function M1_Config_Adapter_Virtuemart113()
|
2071 |
+
{
|
2072 |
+
require_once M1_STORE_BASE_DIR . "/configuration.php";
|
2073 |
+
|
2074 |
+
if (class_exists("JConfig")) {
|
2075 |
+
|
2076 |
+
$jconfig = new JConfig();
|
2077 |
+
|
2078 |
+
$this->setHostPort($jconfig->host);
|
2079 |
+
$this->Dbname = $jconfig->db;
|
2080 |
+
$this->Username = $jconfig->user;
|
2081 |
+
$this->Password = $jconfig->password;
|
2082 |
+
|
2083 |
+
} else {
|
2084 |
+
|
2085 |
+
$this->setHostPort($mosConfig_host);
|
2086 |
+
$this->Dbname = $mosConfig_db;
|
2087 |
+
$this->Username = $mosConfig_user;
|
2088 |
+
$this->Password = $mosConfig_password;
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
if ( file_exists(M1_STORE_BASE_DIR . "/administrator/components/com_virtuemart/version.php") ) {
|
2092 |
+
$ver = file_get_contents(M1_STORE_BASE_DIR . "/administrator/components/com_virtuemart/version.php");
|
2093 |
+
if (preg_match('/\$RELEASE.+\'(.+)\'/', $ver, $match) != 0) {
|
2094 |
+
$this->cartVars['dbVersion'] = $match[1];
|
2095 |
+
unset($match);
|
2096 |
+
}
|
2097 |
+
}
|
2098 |
+
|
2099 |
+
$this->imagesDir = "components/com_virtuemart/shop_image";
|
2100 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2101 |
+
$this->productsImagesDir = $this->imagesDir;
|
2102 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2103 |
+
|
2104 |
+
if ( is_dir( M1_STORE_BASE_DIR . 'images/stories/virtuemart/product' ) ) {
|
2105 |
+
$this->imagesDir = 'images/stories/virtuemart';
|
2106 |
+
$this->productsImagesDir = $this->imagesDir . '/product';
|
2107 |
+
$this->categoriesImagesDir = $this->imagesDir . '/category';
|
2108 |
+
$this->manufacturersImagesDir = $this->imagesDir . '/manufacturer';
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
}
|
2112 |
+
}
|
2113 |
+
|
2114 |
+
|
2115 |
+
class miSettings {
|
2116 |
+
var $arr;
|
2117 |
+
|
2118 |
+
function singleton() {
|
2119 |
+
static $instance = null;
|
2120 |
+
if ( $instance == null ) {
|
2121 |
+
$instance = new miSettings();
|
2122 |
+
}
|
2123 |
+
return $instance;
|
2124 |
+
}
|
2125 |
+
|
2126 |
+
function setArray($arr)
|
2127 |
+
{
|
2128 |
+
$this->arr[] = $arr;
|
2129 |
+
}
|
2130 |
+
|
2131 |
+
function getArray()
|
2132 |
+
{
|
2133 |
+
return $this->arr;
|
2134 |
+
}
|
2135 |
+
|
2136 |
+
}
|
2137 |
+
|
2138 |
+
class M1_Config_Adapter_Summercart3 extends M1_Config_Adapter
|
2139 |
+
{
|
2140 |
+
function M1_Config_Adapter_Summercart3()
|
2141 |
+
{
|
2142 |
+
@include_once M1_STORE_BASE_DIR . "include/miphpf/Config.php";
|
2143 |
+
|
2144 |
+
$instance = miSettings::singleton();
|
2145 |
+
|
2146 |
+
$data = $instance->getArray();
|
2147 |
+
|
2148 |
+
$this->setHostPort($data[0]['MI_DEFAULT_DB_HOST']);
|
2149 |
+
$this->Dbname = $data[0]['MI_DEFAULT_DB_NAME'];
|
2150 |
+
$this->Username = $data[0]['MI_DEFAULT_DB_USER'];
|
2151 |
+
$this->Password = $data[0]['MI_DEFAULT_DB_PASS'];
|
2152 |
+
$this->imagesDir = "/userfiles/";
|
2153 |
+
|
2154 |
+
$this->categoriesImagesDir = $this->imagesDir . "categoryimages";
|
2155 |
+
$this->productsImagesDir = $this->imagesDir . "productimages";
|
2156 |
+
$this->manufacturersImagesDir = $this->imagesDir . "manufacturer";
|
2157 |
+
|
2158 |
+
if ( file_exists(M1_STORE_BASE_DIR . "/include/VERSION") ) {
|
2159 |
+
$indexFileContent = file_get_contents(M1_STORE_BASE_DIR . "/include/VERSION");
|
2160 |
+
$this->cartVars['dbVersion'] = trim($indexFileContent);
|
2161 |
+
}
|
2162 |
+
|
2163 |
+
}
|
2164 |
+
}
|
2165 |
+
|
2166 |
+
|
2167 |
+
|
2168 |
+
class M1_Config_Adapter_Cubecart3 extends M1_Config_Adapter
|
2169 |
+
{
|
2170 |
+
function M1_Config_Adapter_Cubecart3()
|
2171 |
+
{
|
2172 |
+
include_once(M1_STORE_BASE_DIR . 'includes/global.inc.php');
|
2173 |
+
|
2174 |
+
$this->setHostPort($glob['dbhost']);
|
2175 |
+
$this->Dbname = $glob['dbdatabase'];
|
2176 |
+
$this->Username = $glob['dbusername'];
|
2177 |
+
$this->Password = $glob['dbpassword'];
|
2178 |
+
|
2179 |
+
$this->imagesDir = 'images/uploads';
|
2180 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2181 |
+
$this->productsImagesDir = $this->imagesDir;
|
2182 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2183 |
+
}
|
2184 |
+
}
|
2185 |
+
|
2186 |
+
class M1_Config_Adapter_Tomatocart extends M1_Config_Adapter
|
2187 |
+
{
|
2188 |
+
function M1_Config_Adapter_Tomatocart()
|
2189 |
+
{
|
2190 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . "includes/configure.php");
|
2191 |
+
preg_match("/define\(\'DB_DATABASE\', \'(.+)\'\);/", $config, $match);
|
2192 |
+
$this->Dbname = $match[1];
|
2193 |
+
preg_match("/define\(\'DB_SERVER_USERNAME\', \'(.+)\'\);/", $config, $match);
|
2194 |
+
$this->Username = $match[1];
|
2195 |
+
preg_match("/define\(\'DB_SERVER_PASSWORD\', \'(.*)\'\);/", $config, $match);
|
2196 |
+
$this->Password = $match[1];
|
2197 |
+
preg_match("/define\(\'DB_SERVER\', \'(.+)\'\);/", $config, $match);
|
2198 |
+
$this->setHostPort( $match[1] );
|
2199 |
+
|
2200 |
+
preg_match("/define\(\'DIR_WS_IMAGES\', \'(.+)\'\);/", $config, $match);
|
2201 |
+
$this->imagesDir = $match[1];
|
2202 |
+
|
2203 |
+
$this->categoriesImagesDir = $this->imagesDir.'categories/';
|
2204 |
+
$this->productsImagesDir = $this->imagesDir.'products/';
|
2205 |
+
$this->manufacturersImagesDir = $this->imagesDir . 'manufacturers/';
|
2206 |
+
if ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'application_top.php') ) {
|
2207 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "application_top.php");
|
2208 |
+
preg_match("/define\('PROJECT_VERSION.*/", $conf, $match);
|
2209 |
+
|
2210 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2211 |
+
preg_match("/\d.*/", $match[0], $project);
|
2212 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2213 |
+
$version = $project[0];
|
2214 |
+
$version = str_replace(array(" ","-","_","'",");"), "", $version);
|
2215 |
+
if ($version != '') {
|
2216 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2217 |
+
}
|
2218 |
+
}
|
2219 |
+
} else {
|
2220 |
+
//if another version
|
2221 |
+
if ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'version.php') ) {
|
2222 |
+
@require_once M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "version.php";
|
2223 |
+
if (defined('PROJECT_VERSION') && PROJECT_VERSION != '' ) {
|
2224 |
+
$version = PROJECT_VERSION;
|
2225 |
+
preg_match("/\d.*/", $version, $vers);
|
2226 |
+
if (isset($vers[0]) && !empty($vers[0])) {
|
2227 |
+
$version = $vers[0];
|
2228 |
+
$version = str_replace(array(" ","-","_"), "", $version);
|
2229 |
+
if ($version != '') {
|
2230 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2231 |
+
}
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
}
|
2235 |
+
}
|
2236 |
+
}
|
2237 |
+
}
|
2238 |
+
}
|
2239 |
+
|
2240 |
+
|
2241 |
+
|
2242 |
+
class M1_Config_Adapter_XCart extends M1_Config_Adapter
|
2243 |
+
{
|
2244 |
+
function M1_Config_Adapter_XCart()
|
2245 |
+
{
|
2246 |
+
define('XCART_START', 1);
|
2247 |
+
|
2248 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . "config.php");
|
2249 |
+
|
2250 |
+
preg_match('/\$sql_host.+\'(.+)\';/', $config, $match);
|
2251 |
+
$this->setHostPort( $match[1] );
|
2252 |
+
preg_match('/\$sql_user.+\'(.+)\';/', $config, $match);
|
2253 |
+
$this->Username = $match[1];
|
2254 |
+
preg_match('/\$sql_db.+\'(.+)\';/', $config, $match);
|
2255 |
+
$this->Dbname = $match[1];
|
2256 |
+
preg_match('/\$sql_password.+\'(.*)\';/', $config, $match);
|
2257 |
+
$this->Password = $match[1];
|
2258 |
+
|
2259 |
+
$this->imagesDir = 'images/'; // xcart starting from 4.1.x hardcodes images location
|
2260 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2261 |
+
$this->productsImagesDir = $this->imagesDir;
|
2262 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2263 |
+
|
2264 |
+
if(file_exists(M1_STORE_BASE_DIR . "VERSION")) {
|
2265 |
+
$version = file_get_contents(M1_STORE_BASE_DIR . "VERSION");
|
2266 |
+
$this->cartVars['dbVersion'] = preg_replace('/(Version| |\\n)/','',$version);
|
2267 |
+
}
|
2268 |
+
|
2269 |
+
}
|
2270 |
+
}
|
2271 |
+
|
2272 |
+
class M1_Config_Adapter_Woocommerce extends M1_Config_Adapter
|
2273 |
+
{
|
2274 |
+
function M1_Config_Adapter_Woocommerce()
|
2275 |
+
{
|
2276 |
+
//@include_once M1_STORE_BASE_DIR . "wp-config.php";
|
2277 |
+
if (file_exists(M1_STORE_BASE_DIR . 'wp-config.php')) {
|
2278 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . 'wp-config.php');
|
2279 |
+
} else {
|
2280 |
+
$config = file_get_contents(dirname(M1_STORE_BASE_DIR) . '/wp-config.php');
|
2281 |
+
}
|
2282 |
+
|
2283 |
+
preg_match('/define\s*\(\s*\'DB_NAME\',\s*\'(.+)\'\s*\)\s*;/', $config, $match);
|
2284 |
+
$this->Dbname = $match[1];
|
2285 |
+
preg_match('/define\s*\(\s*\'DB_USER\',\s*\'(.+)\'\s*\)\s*;/', $config, $match);
|
2286 |
+
$this->Username = $match[1];
|
2287 |
+
preg_match('/define\s*\(\s*\'DB_PASSWORD\',\s*\'(.*)\'\s*\)\s*;/', $config, $match);
|
2288 |
+
$this->Password = $match[1];
|
2289 |
+
preg_match('/define\s*\(\s*\'DB_HOST\',\s*\'(.+)\'\s*\)\s*;/', $config, $match);
|
2290 |
+
$this->setHostPort( $match[1] );
|
2291 |
+
preg_match('/\$table_prefix\s*=\s*\'(.*)\'\s*;/', $config, $match);
|
2292 |
+
$this->TblPrefix = $match[1];
|
2293 |
+
$version = $this->getCartVersionFromDb("option_value", "options", "option_name = 'woocommerce_db_version'");
|
2294 |
+
|
2295 |
+
if ( $version != '' ) {
|
2296 |
+
$this->cartVars['dbVersion'] = $version;
|
2297 |
+
}
|
2298 |
+
|
2299 |
+
$this->cartVars['categoriesDirRelative'] = 'images/categories/';
|
2300 |
+
$this->cartVars['productsDirRelative'] = 'images/products/';
|
2301 |
+
$this->imagesDir = "wp-content/uploads/images/";
|
2302 |
+
$this->categoriesImagesDir = $this->imagesDir . 'categories/';
|
2303 |
+
$this->productsImagesDir = $this->imagesDir . 'products/';
|
2304 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2305 |
+
}
|
2306 |
+
}
|
2307 |
+
|
2308 |
+
|
2309 |
+
|
2310 |
+
class M1_Config_Adapter_XtcommerceVeyton extends M1_Config_Adapter
|
2311 |
+
{
|
2312 |
+
function M1_Config_Adapter_XtcommerceVeyton()
|
2313 |
+
{
|
2314 |
+
define('_VALID_CALL','TRUE');
|
2315 |
+
define('_SRV_WEBROOT','TRUE');
|
2316 |
+
require_once M1_STORE_BASE_DIR
|
2317 |
+
. 'conf'
|
2318 |
+
. DIRECTORY_SEPARATOR
|
2319 |
+
. 'config.php';
|
2320 |
+
|
2321 |
+
require_once M1_STORE_BASE_DIR
|
2322 |
+
. 'conf'
|
2323 |
+
. DIRECTORY_SEPARATOR
|
2324 |
+
. 'paths.php';
|
2325 |
+
|
2326 |
+
$this->setHostPort(_SYSTEM_DATABASE_HOST);
|
2327 |
+
$this->Dbname = _SYSTEM_DATABASE_DATABASE;
|
2328 |
+
$this->Username = _SYSTEM_DATABASE_USER;
|
2329 |
+
$this->Password = _SYSTEM_DATABASE_PWD;
|
2330 |
+
$this->imagesDir = _SRV_WEB_IMAGES;
|
2331 |
+
$this->TblPrefix = DB_PREFIX . "_";
|
2332 |
+
|
2333 |
+
$version = $this->getCartVersionFromDb("config_value", "config", "config_key = '_SYSTEM_VERSION'");
|
2334 |
+
if ( $version != '' ) {
|
2335 |
+
$this->cartVars['dbVersion'] = $version;
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2339 |
+
$this->productsImagesDir = $this->imagesDir;
|
2340 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2341 |
+
}
|
2342 |
+
}
|
2343 |
+
|
2344 |
+
|
2345 |
+
class M1_Config_Adapter_AceShop extends M1_Config_Adapter
|
2346 |
+
{
|
2347 |
+
function M1_Config_Adapter_AceShop()
|
2348 |
+
{
|
2349 |
+
require_once M1_STORE_BASE_DIR . "/configuration.php";
|
2350 |
+
|
2351 |
+
if (class_exists("JConfig")) {
|
2352 |
+
|
2353 |
+
$jconfig = new JConfig();
|
2354 |
+
|
2355 |
+
$this->setHostPort($jconfig->host);
|
2356 |
+
$this->Dbname = $jconfig->db;
|
2357 |
+
$this->Username = $jconfig->user;
|
2358 |
+
$this->Password = $jconfig->password;
|
2359 |
+
|
2360 |
+
} else {
|
2361 |
+
|
2362 |
+
$this->setHostPort($mosConfig_host);
|
2363 |
+
$this->Dbname = $mosConfig_db;
|
2364 |
+
$this->Username = $mosConfig_user;
|
2365 |
+
$this->Password = $mosConfig_password;
|
2366 |
+
}
|
2367 |
+
|
2368 |
+
|
2369 |
+
$this->imagesDir = "components/com_aceshop/opencart/image/";
|
2370 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2371 |
+
$this->productsImagesDir = $this->imagesDir;
|
2372 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2373 |
+
}
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
|
2377 |
+
class M1_Config_Adapter_WebAsyst extends M1_Config_Adapter
|
2378 |
+
{
|
2379 |
+
function M1_Config_Adapter_WebAsyst()
|
2380 |
+
{
|
2381 |
+
$config = simplexml_load_file(M1_STORE_BASE_DIR . 'kernel/wbs.xml');
|
2382 |
+
|
2383 |
+
$dbKey = (string)$config->FRONTEND['dbkey'];
|
2384 |
+
|
2385 |
+
$config = simplexml_load_file(M1_STORE_BASE_DIR . 'dblist'. '/' . strtoupper($dbKey) . '.xml');
|
2386 |
+
|
2387 |
+
$host = (string)$config->DBSETTINGS['SQLSERVER'];
|
2388 |
+
|
2389 |
+
$this->setHostPort($host);
|
2390 |
+
$this->Dbname = (string)$config->DBSETTINGS['DB_NAME'];
|
2391 |
+
$this->Username = (string)$config->DBSETTINGS['DB_USER'];
|
2392 |
+
$this->Password = (string)$config->DBSETTINGS['DB_PASSWORD'];
|
2393 |
+
|
2394 |
+
$this->imagesDir = 'published/publicdata/'.strtoupper($dbKey).'/attachments/SC/products_pictures';
|
2395 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2396 |
+
$this->productsImagesDir = $this->imagesDir;
|
2397 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2398 |
+
|
2399 |
+
if ( isset($config->VERSIONS['SYSTEM']) ) {
|
2400 |
+
$this->cartVars['dbVersion'] = (string)$config->VERSIONS['SYSTEM'];
|
2401 |
+
}
|
2402 |
+
}
|
2403 |
+
|
2404 |
+
}
|
2405 |
+
|
2406 |
+
class M1_Config_Adapter_Squirrelcart242 extends M1_Config_Adapter
|
2407 |
+
{
|
2408 |
+
function M1_Config_Adapter_Squirrelcart242()
|
2409 |
+
{
|
2410 |
+
include_once(M1_STORE_BASE_DIR . 'squirrelcart/config.php');
|
2411 |
+
|
2412 |
+
$this->setHostPort($sql_host);
|
2413 |
+
$this->Dbname = $db;
|
2414 |
+
$this->Username = $sql_username;
|
2415 |
+
$this->Password = $sql_password;
|
2416 |
+
|
2417 |
+
$this->imagesDir = $img_path;
|
2418 |
+
$this->categoriesImagesDir = $img_path . "/categories";
|
2419 |
+
$this->productsImagesDir = $img_path . "/products";
|
2420 |
+
$this->manufacturersImagesDir = $img_path;
|
2421 |
+
|
2422 |
+
$version = $this->getCartVersionFromDb("DB_Version", "Store_Information", "record_number = 1");
|
2423 |
+
if ( $version != '' ) {
|
2424 |
+
$this->cartVars['dbVersion'] = $version;
|
2425 |
+
}
|
2426 |
+
}
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
class M1_Config_Adapter_Shopware extends M1_Config_Adapter
|
2430 |
+
{
|
2431 |
+
function M1_Config_Adapter_Shopware()
|
2432 |
+
{
|
2433 |
+
$configs = include(M1_STORE_BASE_DIR . "config.php");
|
2434 |
+
$this->setHostPort($configs['db']['host']);
|
2435 |
+
$this->Username = $configs['db']['username'];
|
2436 |
+
$this->Password = $configs['db']['password'];
|
2437 |
+
$this->Dbname = $configs['db']['dbname'];
|
2438 |
+
}
|
2439 |
+
}
|
2440 |
+
|
2441 |
+
class M1_Config_Adapter_WPecommerce extends M1_Config_Adapter
|
2442 |
+
{
|
2443 |
+
function M1_Config_Adapter_WPecommerce()
|
2444 |
+
{
|
2445 |
+
//@include_once M1_STORE_BASE_DIR . "wp-config.php";
|
2446 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . "wp-config.php");
|
2447 |
+
preg_match("/define\(\'DB_NAME\', \'(.+)\'\);/", $config, $match);
|
2448 |
+
$this->Dbname = $match[1];
|
2449 |
+
preg_match("/define\(\'DB_USER\', \'(.+)\'\);/", $config, $match);
|
2450 |
+
$this->Username = $match[1];
|
2451 |
+
preg_match("/define\(\'DB_PASSWORD\', \'(.*)\'\);/", $config, $match);
|
2452 |
+
$this->Password = $match[1];
|
2453 |
+
preg_match("/define\(\'DB_HOST\', \'(.+)\'\);/", $config, $match);
|
2454 |
+
$this->setHostPort( $match[1] );
|
2455 |
+
preg_match("/(table_prefix)(.*)(')(.*)(')(.*)/", $config, $match);
|
2456 |
+
$this->TblPrefix = $match[4];
|
2457 |
+
$version = $this->getCartVersionFromDb("option_value", "options", "option_name = 'wpsc_version'");
|
2458 |
+
if ( $version != '' ) {
|
2459 |
+
$this->cartVars['dbVersion'] = $version;
|
2460 |
+
} else {
|
2461 |
+
if ( file_exists(M1_STORE_BASE_DIR . "wp-content".DIRECTORY_SEPARATOR."plugins".DIRECTORY_SEPARATOR."wp-shopping-cart".DIRECTORY_SEPARATOR."wp-shopping-cart.php") ) {
|
2462 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . "wp-content".DIRECTORY_SEPARATOR."plugins".DIRECTORY_SEPARATOR."wp-shopping-cart".DIRECTORY_SEPARATOR."wp-shopping-cart.php");
|
2463 |
+
preg_match("/define\('WPSC_VERSION.*/", $conf, $match);
|
2464 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2465 |
+
preg_match("/\d.*/", $match[0], $project);
|
2466 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2467 |
+
$version = $project[0];
|
2468 |
+
$version = str_replace(array(" ","-","_","'",");",")",";"), "", $version);
|
2469 |
+
if ($version != '') {
|
2470 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2471 |
+
}
|
2472 |
+
}
|
2473 |
+
}
|
2474 |
+
}
|
2475 |
+
}
|
2476 |
+
if ( file_exists(M1_STORE_BASE_DIR . "wp-content/plugins/shopp/Shopp.php") || file_exists(M1_STORE_BASE_DIR . "wp-content/plugins/wp-e-commerce/editor.php") ) {
|
2477 |
+
$this->imagesDir = "wp-content/uploads/wpsc/";
|
2478 |
+
$this->categoriesImagesDir = $this->imagesDir.'category_images/';
|
2479 |
+
$this->productsImagesDir = $this->imagesDir.'product_images/';
|
2480 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2481 |
+
} elseif ( file_exists(M1_STORE_BASE_DIR . "wp-content/plugins/wp-e-commerce/wp-shopping-cart.php") ) {
|
2482 |
+
$this->imagesDir = "wp-content/uploads/";
|
2483 |
+
$this->categoriesImagesDir = $this->imagesDir."wpsc/category_images/";
|
2484 |
+
$this->productsImagesDir = $this->imagesDir;
|
2485 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2486 |
+
} else {
|
2487 |
+
$this->imagesDir = "images/";
|
2488 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2489 |
+
$this->productsImagesDir = $this->imagesDir;
|
2490 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2491 |
+
}
|
2492 |
+
}
|
2493 |
+
}
|
2494 |
+
|
2495 |
+
|
2496 |
+
|
2497 |
+
class M1_Config_Adapter_Ubercart3 extends M1_Config_Adapter
|
2498 |
+
{
|
2499 |
+
function M1_Config_Adapter_Ubercart3()
|
2500 |
+
{
|
2501 |
+
@include_once M1_STORE_BASE_DIR . "sites/default/settings.php";
|
2502 |
+
|
2503 |
+
$url = $databases['default']['default'];
|
2504 |
+
|
2505 |
+
$url['username'] = urldecode($url['username']);
|
2506 |
+
$url['password'] = isset($url['password']) ? urldecode($url['password']) : '';
|
2507 |
+
$url['host'] = urldecode($url['host']);
|
2508 |
+
$url['database'] = urldecode($url['database']);
|
2509 |
+
if (isset($url['port'])) {
|
2510 |
+
$url['host'] = $url['host'] .':'. $url['port'];
|
2511 |
+
}
|
2512 |
+
|
2513 |
+
$this->setHostPort( $url['host'] );
|
2514 |
+
$this->Dbname = ltrim( $url['database'], '/' );
|
2515 |
+
$this->Username = $url['username'];
|
2516 |
+
$this->Password = $url['password'];
|
2517 |
+
|
2518 |
+
$this->imagesDir = "/sites/default/files/";
|
2519 |
+
if (!file_exists( M1_STORE_BASE_DIR . $this->imagesDir )) {
|
2520 |
+
$this->imagesDir = "/files";
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
$fileInfo = M1_STORE_BASE_DIR . "/modules/ubercart/uc_cart/uc_cart.info";
|
2524 |
+
if (file_exists( $fileInfo )) {
|
2525 |
+
$str = file_get_contents( $fileInfo );
|
2526 |
+
if (preg_match('/version\s+=\s+".+-(.+)"/', $str, $match) != 0) {
|
2527 |
+
$this->cartVars['dbVersion'] = $match[1];
|
2528 |
+
unset($match);
|
2529 |
+
}
|
2530 |
+
}
|
2531 |
+
|
2532 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2533 |
+
$this->productsImagesDir = $this->imagesDir;
|
2534 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2535 |
+
}
|
2536 |
+
}
|
2537 |
+
|
2538 |
+
|
2539 |
+
class M1_Config_Adapter_Zencart137 extends M1_Config_Adapter
|
2540 |
+
{
|
2541 |
+
function M1_Config_Adapter_Zencart137()
|
2542 |
+
{
|
2543 |
+
$cur_dir = getcwd();
|
2544 |
+
|
2545 |
+
chdir(M1_STORE_BASE_DIR);
|
2546 |
+
|
2547 |
+
@require_once M1_STORE_BASE_DIR
|
2548 |
+
. "includes" . DIRECTORY_SEPARATOR
|
2549 |
+
. "configure.php";
|
2550 |
+
|
2551 |
+
chdir($cur_dir);
|
2552 |
+
|
2553 |
+
$this->imagesDir = DIR_WS_IMAGES;
|
2554 |
+
|
2555 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2556 |
+
$this->productsImagesDir = $this->imagesDir;
|
2557 |
+
if ( defined('DIR_WS_PRODUCT_IMAGES') ) {
|
2558 |
+
$this->productsImagesDir = DIR_WS_PRODUCT_IMAGES;
|
2559 |
+
}
|
2560 |
+
if ( defined('DIR_WS_ORIGINAL_IMAGES') ) {
|
2561 |
+
$this->productsImagesDir = DIR_WS_ORIGINAL_IMAGES;
|
2562 |
+
}
|
2563 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2564 |
+
|
2565 |
+
//$this->Host = DB_SERVER;
|
2566 |
+
$this->setHostPort(DB_SERVER);
|
2567 |
+
$this->Username = DB_SERVER_USERNAME;
|
2568 |
+
$this->Password = DB_SERVER_PASSWORD;
|
2569 |
+
$this->Dbname = DB_DATABASE;
|
2570 |
+
if ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'version.php') ) {
|
2571 |
+
@require_once M1_STORE_BASE_DIR
|
2572 |
+
. "includes" . DIRECTORY_SEPARATOR
|
2573 |
+
. "version.php";
|
2574 |
+
$major = PROJECT_VERSION_MAJOR;
|
2575 |
+
$minor = PROJECT_VERSION_MINOR;
|
2576 |
+
if (defined('EXPECTED_DATABASE_VERSION_MAJOR') && EXPECTED_DATABASE_VERSION_MAJOR != '' ) {
|
2577 |
+
$major = EXPECTED_DATABASE_VERSION_MAJOR;
|
2578 |
+
}
|
2579 |
+
if (defined('EXPECTED_DATABASE_VERSION_MINOR') && EXPECTED_DATABASE_VERSION_MINOR != '' ) {
|
2580 |
+
$minor = EXPECTED_DATABASE_VERSION_MINOR;
|
2581 |
+
}
|
2582 |
+
|
2583 |
+
if ( $major != '' && $minor != '' ) {
|
2584 |
+
$this->cartVars['dbVersion'] = $major.'.'.$minor;
|
2585 |
+
}
|
2586 |
+
|
2587 |
+
}
|
2588 |
+
}
|
2589 |
+
}
|
2590 |
+
|
2591 |
+
|
2592 |
+
|
2593 |
+
class M1_Config_Adapter_Oxid extends M1_Config_Adapter
|
2594 |
+
{
|
2595 |
+
function M1_Config_Adapter_Oxid()
|
2596 |
+
{
|
2597 |
+
//@include_once M1_STORE_BASE_DIR . "config.inc.php";
|
2598 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . "config.inc.php");
|
2599 |
+
preg_match("/dbName(.+)?=(.+)?\'(.+)\';/", $config, $match);
|
2600 |
+
$this->Dbname = $match[3];
|
2601 |
+
preg_match("/dbUser(.+)?=(.+)?\'(.+)\';/", $config, $match);
|
2602 |
+
$this->Username = $match[3];
|
2603 |
+
preg_match("/dbPwd(.+)?=(.+)?\'(.+)\';/", $config, $match);
|
2604 |
+
$this->Password = isset($match[3])?$match[3]:'';
|
2605 |
+
preg_match("/dbHost(.+)?=(.+)?\'(.*)\';/", $config, $match);
|
2606 |
+
$this->setHostPort($match[3]);
|
2607 |
+
|
2608 |
+
//check about last slash
|
2609 |
+
$this->imagesDir = "out/pictures/";
|
2610 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2611 |
+
$this->productsImagesDir = $this->imagesDir;
|
2612 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2613 |
+
|
2614 |
+
//add key for decoding config values in oxid db
|
2615 |
+
//check slash
|
2616 |
+
$key_config_file = file_get_contents(M1_STORE_BASE_DIR .'/core/oxconfk.php');
|
2617 |
+
preg_match("/sConfigKey(.+)?=(.+)?\"(.+)?\";/", $key_config_file, $match);
|
2618 |
+
$this->cartVars['sConfigKey'] = $match[3];
|
2619 |
+
$version = $this->getCartVersionFromDb("OXVERSION", "oxshops", "OXACTIVE=1 LIMIT 1" );
|
2620 |
+
if ( $version != '' ) {
|
2621 |
+
$this->cartVars['dbVersion'] = $version;
|
2622 |
+
}
|
2623 |
+
}
|
2624 |
+
}
|
2625 |
+
|
2626 |
+
|
2627 |
+
|
2628 |
+
class M1_Config_Adapter_SSFree extends M1_Config_Adapter
|
2629 |
+
{
|
2630 |
+
function M1_Config_Adapter_SSFree()
|
2631 |
+
{
|
2632 |
+
$config = file_get_contents(M1_STORE_BASE_DIR . 'cfg/connect.inc.php');
|
2633 |
+
preg_match("/define\(\'DB_NAME\', \'(.+)\'\);/", $config, $match);
|
2634 |
+
$this->Dbname = $match[1];
|
2635 |
+
preg_match("/define\(\'DB_USER\', \'(.+)\'\);/", $config, $match);
|
2636 |
+
$this->Username = $match[1];
|
2637 |
+
preg_match("/define\(\'DB_PASS\', \'(.*)\'\);/", $config, $match);
|
2638 |
+
$this->Password = $match[1];
|
2639 |
+
preg_match("/define\(\'DB_HOST\', \'(.+)\'\);/", $config, $match);
|
2640 |
+
$this->setHostPort( $match[1] );
|
2641 |
+
|
2642 |
+
$this->imagesDir = "products_pictures/";
|
2643 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2644 |
+
$this->productsImagesDir = $this->imagesDir;
|
2645 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2646 |
+
|
2647 |
+
$generalInc = file_get_contents(M1_STORE_BASE_DIR . 'cfg/general.inc.php');
|
2648 |
+
|
2649 |
+
preg_match("/define\(\'CONF_CURRENCY_ISO3\', \'(.+)\'\);/", $generalInc, $match);
|
2650 |
+
if (count($match) != 0) {
|
2651 |
+
$this->cartVars['iso3Currency'] = $match[1];
|
2652 |
+
}
|
2653 |
+
|
2654 |
+
preg_match("/define\(\'CONF_CURRENCY_ID_LEFT\', \'(.+)\'\);/", $generalInc, $match);
|
2655 |
+
if (count($match) != 0) {
|
2656 |
+
$this->cartVars['currencySymbolLeft'] = $match[1];
|
2657 |
+
}
|
2658 |
+
|
2659 |
+
preg_match("/define\(\'CONF_CURRENCY_ID_RIGHT\', \'(.+)\'\);/", $generalInc, $match);
|
2660 |
+
if (count($match) != 0) {
|
2661 |
+
$this->cartVars['currencySymbolRight'] = $match[1];
|
2662 |
+
}
|
2663 |
+
}
|
2664 |
+
|
2665 |
+
}
|
2666 |
+
|
2667 |
+
class M1_Config_Adapter_DrupalCommerce extends M1_Config_Adapter
|
2668 |
+
{
|
2669 |
+
|
2670 |
+
function M1_Config_Adapter_DrupalCommerce()
|
2671 |
+
{
|
2672 |
+
@include_once M1_STORE_BASE_DIR . "sites/default/settings.php";
|
2673 |
+
|
2674 |
+
$url = $databases['default']['default'];
|
2675 |
+
|
2676 |
+
$url['username'] = urldecode($url['username']);
|
2677 |
+
$url['password'] = isset($url['password']) ? urldecode($url['password']) : '';
|
2678 |
+
$url['host'] = urldecode($url['host']);
|
2679 |
+
$url['database'] = urldecode($url['database']);
|
2680 |
+
if (isset($url['port'])) {
|
2681 |
+
$url['host'] = $url['host'] .':'. $url['port'];
|
2682 |
+
}
|
2683 |
+
|
2684 |
+
$this->setHostPort( $url['host'] );
|
2685 |
+
$this->Dbname = ltrim( $url['database'], '/' );
|
2686 |
+
$this->Username = $url['username'];
|
2687 |
+
$this->Password = $url['password'];
|
2688 |
+
|
2689 |
+
$this->imagesDir = "/sites/default/files/";
|
2690 |
+
if( !file_exists( M1_STORE_BASE_DIR . $this->imagesDir ) ) {
|
2691 |
+
$this->imagesDir = "/files";
|
2692 |
+
}
|
2693 |
+
|
2694 |
+
|
2695 |
+
$fileInfo = M1_STORE_BASE_DIR . "/sites/all/modules/commerce/commerce.info";
|
2696 |
+
if ( file_exists( $fileInfo ) ) {
|
2697 |
+
$str = file_get_contents( $fileInfo );
|
2698 |
+
if ( preg_match('/version\s+=\s+".+-(.+)"/', $str, $match) != 0 ) {
|
2699 |
+
$this->cartVars['dbVersion'] = $match[1];
|
2700 |
+
unset($match);
|
2701 |
+
}
|
2702 |
+
}
|
2703 |
+
|
2704 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2705 |
+
$this->productsImagesDir = $this->imagesDir;
|
2706 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2707 |
+
|
2708 |
+
|
2709 |
+
}
|
2710 |
+
}
|
2711 |
+
|
2712 |
+
class M1_Config_Adapter_LemonStand extends M1_Config_Adapter
|
2713 |
+
{
|
2714 |
+
function M1_Config_Adapter_LemonStand()
|
2715 |
+
{
|
2716 |
+
include (M1_STORE_BASE_DIR . 'phproad/system/phpr.php');
|
2717 |
+
include (M1_STORE_BASE_DIR . 'phproad/modules/phpr/classes/phpr_securityframework.php');
|
2718 |
+
|
2719 |
+
define('PATH_APP','');
|
2720 |
+
|
2721 |
+
|
2722 |
+
if(phpversion() > 5)
|
2723 |
+
{
|
2724 |
+
eval ('Phpr::$config = new MockConfig();
|
2725 |
+
Phpr::$config->set("SECURE_CONFIG_PATH", M1_STORE_BASE_DIR . "config/config.dat");
|
2726 |
+
$framework = Phpr_SecurityFramework::create();');
|
2727 |
+
}
|
2728 |
+
|
2729 |
+
$config_content = $framework->get_config_content();
|
2730 |
+
|
2731 |
+
$this->setHostPort($config_content['mysql_params']['host']);
|
2732 |
+
$this->Dbname = $config_content['mysql_params']['database'];
|
2733 |
+
$this->Username = $config_content['mysql_params']['user'];
|
2734 |
+
$this->Password = $config_content['mysql_params']['password'];
|
2735 |
+
|
2736 |
+
$this->categoriesImagesDir = '/uploaded/thumbnails/';
|
2737 |
+
$this->productsImagesDir = '/uploaded/';
|
2738 |
+
$this->manufacturersImagesDir = '/uploaded/thumbnails/';
|
2739 |
+
|
2740 |
+
$version = $this->getCartVersionFromDb("version_str", "core_versions", "moduleId = 'shop'");
|
2741 |
+
$this->cartVars['dbVersion'] = $version;
|
2742 |
+
|
2743 |
+
}
|
2744 |
+
}
|
2745 |
+
|
2746 |
+
class MockConfig {
|
2747 |
+
var $_data = array();
|
2748 |
+
function set($key, $value)
|
2749 |
+
{
|
2750 |
+
$this->_data[$key] = $value;
|
2751 |
+
}
|
2752 |
+
|
2753 |
+
function get($key, $default = 'default')
|
2754 |
+
{
|
2755 |
+
return isset($this->_data[$key]) ? $this->_data[$key] : $default;
|
2756 |
+
}
|
2757 |
+
}
|
2758 |
+
|
2759 |
+
|
2760 |
+
class M1_Config_Adapter_Oscommerce22ms2 extends M1_Config_Adapter
|
2761 |
+
{
|
2762 |
+
function M1_Config_Adapter_Oscommerce22ms2()
|
2763 |
+
{
|
2764 |
+
$cur_dir = getcwd();
|
2765 |
+
|
2766 |
+
chdir(M1_STORE_BASE_DIR);
|
2767 |
+
|
2768 |
+
@require_once M1_STORE_BASE_DIR
|
2769 |
+
. "includes" . DIRECTORY_SEPARATOR
|
2770 |
+
. "configure.php";
|
2771 |
+
|
2772 |
+
chdir($cur_dir);
|
2773 |
+
|
2774 |
+
$this->imagesDir = DIR_WS_IMAGES;
|
2775 |
+
|
2776 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2777 |
+
$this->productsImagesDir = $this->imagesDir;
|
2778 |
+
if ( defined('DIR_WS_PRODUCT_IMAGES') ) {
|
2779 |
+
$this->productsImagesDir = DIR_WS_PRODUCT_IMAGES;
|
2780 |
+
}
|
2781 |
+
if ( defined('DIR_WS_ORIGINAL_IMAGES') ) {
|
2782 |
+
$this->productsImagesDir = DIR_WS_ORIGINAL_IMAGES;
|
2783 |
+
}
|
2784 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2785 |
+
|
2786 |
+
//$this->Host = DB_SERVER;
|
2787 |
+
$this->setHostPort(DB_SERVER);
|
2788 |
+
$this->Username = DB_SERVER_USERNAME;
|
2789 |
+
$this->Password = DB_SERVER_PASSWORD;
|
2790 |
+
$this->Dbname = DB_DATABASE;
|
2791 |
+
chdir(M1_STORE_BASE_DIR);
|
2792 |
+
if ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'application_top.php') ) {
|
2793 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "application_top.php");
|
2794 |
+
preg_match("/define\('PROJECT_VERSION.*/", $conf, $match);
|
2795 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2796 |
+
preg_match("/\d.*/", $match[0], $project);
|
2797 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2798 |
+
$version = $project[0];
|
2799 |
+
$version = str_replace(array(" ","-","_","'",");"), "", $version);
|
2800 |
+
if ($version != '') {
|
2801 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2802 |
+
}
|
2803 |
+
}
|
2804 |
+
} else {
|
2805 |
+
//if another oscommerce based cart
|
2806 |
+
if ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'version.php') ) {
|
2807 |
+
@require_once M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "version.php";
|
2808 |
+
if (defined('PROJECT_VERSION') && PROJECT_VERSION != '' ) {
|
2809 |
+
$version = PROJECT_VERSION;
|
2810 |
+
preg_match("/\d.*/", $version, $vers);
|
2811 |
+
if (isset($vers[0]) && !empty($vers[0])) {
|
2812 |
+
$version = $vers[0];
|
2813 |
+
$version = str_replace(array(" ","-","_"), "", $version);
|
2814 |
+
if ($version != '') {
|
2815 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2816 |
+
}
|
2817 |
+
}
|
2818 |
+
//if zen_cart
|
2819 |
+
} else {
|
2820 |
+
if (defined('PROJECT_VERSION_MAJOR') && PROJECT_VERSION_MAJOR != '' ) {
|
2821 |
+
$this->cartVars['dbVersion'] = PROJECT_VERSION_MAJOR;
|
2822 |
+
}
|
2823 |
+
if (defined('PROJECT_VERSION_MINOR') && PROJECT_VERSION_MINOR != '' ) {
|
2824 |
+
$this->cartVars['dbVersion'] .= '.' . PROJECT_VERSION_MINOR;
|
2825 |
+
}
|
2826 |
+
}
|
2827 |
+
}
|
2828 |
+
}
|
2829 |
+
}
|
2830 |
+
chdir($cur_dir);
|
2831 |
+
}
|
2832 |
+
}
|
2833 |
+
|
2834 |
+
|
2835 |
+
|
2836 |
+
class M1_Config_Adapter_Cubecart extends M1_Config_Adapter
|
2837 |
+
{
|
2838 |
+
function M1_Config_Adapter_Cubecart()
|
2839 |
+
{
|
2840 |
+
include_once(M1_STORE_BASE_DIR . 'includes/global.inc.php');
|
2841 |
+
|
2842 |
+
$this->setHostPort($glob['dbhost']);
|
2843 |
+
$this->Dbname = $glob['dbdatabase'];
|
2844 |
+
$this->Username = $glob['dbusername'];
|
2845 |
+
$this->Password = $glob['dbpassword'];
|
2846 |
+
|
2847 |
+
$this->imagesDir = 'images';
|
2848 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
2849 |
+
$this->productsImagesDir = $this->imagesDir;
|
2850 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2851 |
+
$dirHandle = opendir(M1_STORE_BASE_DIR . 'language/');
|
2852 |
+
//settings for cube 5
|
2853 |
+
$languages = array();
|
2854 |
+
while ($dirEntry = readdir($dirHandle)) {
|
2855 |
+
$info = pathinfo($dirEntry);
|
2856 |
+
$xmlflag = false;
|
2857 |
+
|
2858 |
+
if (isset($info['extension'])) {
|
2859 |
+
$xmlflag = strtoupper($info['extension']) != "XML" ? true : false;
|
2860 |
+
}
|
2861 |
+
if (is_dir(M1_STORE_BASE_DIR . 'language/' . $dirEntry) || $dirEntry == '.' || $dirEntry == '..' || strpos($dirEntry, "_") !== false || $xmlflag) {
|
2862 |
+
continue;
|
2863 |
+
}
|
2864 |
+
$configXml = simplexml_load_file(M1_STORE_BASE_DIR . 'language/'.$dirEntry);
|
2865 |
+
if ($configXml->info->title){
|
2866 |
+
$lang['name'] = (string)$configXml->info->title;
|
2867 |
+
$lang['code'] = substr((string)$configXml->info->code,0,2);
|
2868 |
+
$lang['locale'] = substr((string)$configXml->info->code,0,2);
|
2869 |
+
$lang['currency'] = (string)$configXml->info->default_currency;
|
2870 |
+
$lang['fileName'] = str_replace(".xml","",$dirEntry);
|
2871 |
+
$languages[] = $lang;
|
2872 |
+
}
|
2873 |
+
}
|
2874 |
+
if (!empty($languages)) {
|
2875 |
+
$this->cartVars['languages'] = $languages;
|
2876 |
+
}
|
2877 |
+
if ( file_exists(M1_STORE_BASE_DIR . 'ini.inc.php') ) {
|
2878 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . 'ini.inc.php');
|
2879 |
+
preg_match("/ini\['ver'\].*/", $conf, $match);
|
2880 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2881 |
+
preg_match("/\d.*/", $match[0], $project);
|
2882 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2883 |
+
$version = $project[0];
|
2884 |
+
$version = str_replace(array(" ","-","_","'",");",";",")"), "", $version);
|
2885 |
+
if ($version != '') {
|
2886 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2887 |
+
}
|
2888 |
+
}
|
2889 |
+
} else {
|
2890 |
+
preg_match("/define\('CC_VERSION.*/", $conf, $match);
|
2891 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2892 |
+
preg_match("/\d.*/", $match[0], $project);
|
2893 |
+
if (isset($project[0]) && !empty($project[0])){
|
2894 |
+
$version = $project[0];
|
2895 |
+
$version = str_replace(array(" ","-","_","'",");",";",")"), "", $version);
|
2896 |
+
if ($version != '') {
|
2897 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2898 |
+
}
|
2899 |
+
}
|
2900 |
+
}
|
2901 |
+
|
2902 |
+
}
|
2903 |
+
} elseif ( file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'ini.inc.php') ) {
|
2904 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'ini.inc.php');
|
2905 |
+
preg_match("/ini\['ver'\].*/", $conf, $match);
|
2906 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2907 |
+
preg_match("/\d.*/", $match[0], $project);
|
2908 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2909 |
+
$version = $project[0];
|
2910 |
+
$version = str_replace(array(" ","-","_","'",");",";",")"), "", $version);
|
2911 |
+
if ($version != '') {
|
2912 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2913 |
+
}
|
2914 |
+
}
|
2915 |
+
} else {
|
2916 |
+
preg_match("/define\('CC_VERSION.*/", $conf, $match);
|
2917 |
+
if (isset($match[0]) && !empty($match[0])) {
|
2918 |
+
preg_match("/\d.*/", $match[0], $project);
|
2919 |
+
if (isset($project[0]) && !empty($project[0])) {
|
2920 |
+
$version = $project[0];
|
2921 |
+
$version = str_replace(array(" ","-","_","'",");",";",")"), "", $version);
|
2922 |
+
if ($version != '') {
|
2923 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
2924 |
+
}
|
2925 |
+
}
|
2926 |
+
}
|
2927 |
+
}
|
2928 |
+
}
|
2929 |
+
}
|
2930 |
+
}
|
2931 |
+
|
2932 |
+
class M1_Config_Adapter_Magento1212 extends M1_Config_Adapter
|
2933 |
+
{
|
2934 |
+
function M1_Config_Adapter_Magento1212()
|
2935 |
+
{
|
2936 |
+
/**
|
2937 |
+
* @var SimpleXMLElement
|
2938 |
+
*/
|
2939 |
+
$config = simplexml_load_file(M1_STORE_BASE_DIR . 'app/etc/local.xml');
|
2940 |
+
$statuses = simplexml_load_file(M1_STORE_BASE_DIR . 'app/code/core/Mage/Sales/etc/config.xml');
|
2941 |
+
|
2942 |
+
$version = $statuses->modules->Mage_Sales->version;
|
2943 |
+
|
2944 |
+
$result = array();
|
2945 |
+
|
2946 |
+
if( version_compare($version, '1.4.0.25') < 0 ) {
|
2947 |
+
$statuses = $statuses->global->sales->order->statuses;
|
2948 |
+
foreach ( $statuses->children() as $status ) {
|
2949 |
+
$result[$status->getName()] = (string) $status->label;
|
2950 |
+
}
|
2951 |
+
}
|
2952 |
+
|
2953 |
+
if ( file_exists(M1_STORE_BASE_DIR . "app/Mage.php") ) {
|
2954 |
+
$ver = file_get_contents(M1_STORE_BASE_DIR . "app/Mage.php");
|
2955 |
+
if ( preg_match("/getVersionInfo[^}]+\'major\' *=> *\'(\d+)\'[^}]+\'minor\' *=> *\'(\d+)\'[^}]+\'revision\' *=> *\'(\d+)\'[^}]+\'patch\' *=> *\'(\d+)\'[^}]+}/s", $ver, $match) == 1 ) {
|
2956 |
+
$mageVersion = $match[1] . '.' . $match[2] . '.' . $match[3] . '.' . $match[4];
|
2957 |
+
$this->cartVars['dbVersion'] = $mageVersion;
|
2958 |
+
unset($match);
|
2959 |
+
}
|
2960 |
+
}
|
2961 |
+
|
2962 |
+
$this->cartVars['orderStatus'] = $result;
|
2963 |
+
$this->cartVars['AdminUrl'] = (string)$config->admin->routers->adminhtml->args->frontName;
|
2964 |
+
|
2965 |
+
$this->setHostPort((string) $config->global->resources->default_setup->connection->host);
|
2966 |
+
$this->Username = (string) $config->global->resources->default_setup->connection->username;
|
2967 |
+
$this->Dbname = (string) $config->global->resources->default_setup->connection->dbname;
|
2968 |
+
$this->Password = (string) $config->global->resources->default_setup->connection->password;
|
2969 |
+
|
2970 |
+
$this->imagesDir = 'media/';
|
2971 |
+
$this->categoriesImagesDir = $this->imagesDir . "catalog/category/";
|
2972 |
+
$this->productsImagesDir = $this->imagesDir . "catalog/product/";
|
2973 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
2974 |
+
@unlink(M1_STORE_BASE_DIR . 'app/etc/use_cache.ser');
|
2975 |
+
}
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
class M1_Config_Adapter_Prestashop15 extends M1_Config_Adapter
|
2979 |
+
{
|
2980 |
+
function M1_Config_Adapter_Prestashop15()
|
2981 |
+
{
|
2982 |
+
$confFileOne = file_get_contents(M1_STORE_BASE_DIR . "/config/settings.inc.php");
|
2983 |
+
$confFileTwo = file_get_contents(M1_STORE_BASE_DIR . "/config/config.inc.php");
|
2984 |
+
|
2985 |
+
$filesLines = array_merge(explode("\n", $confFileOne), explode("\n", $confFileTwo));
|
2986 |
+
|
2987 |
+
$execute = '$currentDir = \'\';';
|
2988 |
+
|
2989 |
+
$isComment = false;
|
2990 |
+
foreach ($filesLines as $line) {
|
2991 |
+
$startComment = preg_match("/^(\/\*)/", $line);
|
2992 |
+
$endComment = preg_match("/(\*\/)$/", $line);
|
2993 |
+
|
2994 |
+
if ($isComment) {
|
2995 |
+
if ($endComment) {
|
2996 |
+
$isComment = false;
|
2997 |
+
}
|
2998 |
+
continue;
|
2999 |
+
} elseif ($startComment) {
|
3000 |
+
$isComment = true;
|
3001 |
+
if ($endComment) {
|
3002 |
+
$isComment = false;
|
3003 |
+
}
|
3004 |
+
continue;
|
3005 |
+
}
|
3006 |
+
|
3007 |
+
if (preg_match("/^(\s*)define\(/i", $line)) {
|
3008 |
+
if ((strpos($line, '_DB_') !== false) || (strpos($line, '_PS_IMG_DIR_') !== false) || (strpos($line, '_PS_VERSION_') !== false)) {
|
3009 |
+
$execute .= " " . $line;
|
3010 |
+
}
|
3011 |
+
}
|
3012 |
+
}
|
3013 |
+
|
3014 |
+
define( '_PS_ROOT_DIR_', M1_STORE_BASE_DIR );
|
3015 |
+
eval($execute);
|
3016 |
+
|
3017 |
+
$this->setHostPort(_DB_SERVER_);
|
3018 |
+
$this->Dbname = _DB_NAME_;
|
3019 |
+
$this->Username = _DB_USER_;
|
3020 |
+
$this->Password = _DB_PASSWD_;
|
3021 |
+
|
3022 |
+
if (defined('_PS_IMG_DIR_') && defined('_PS_ROOT_DIR_')) {
|
3023 |
+
|
3024 |
+
preg_match("/(\/\w+\/)$/i", _PS_IMG_DIR_ ,$m);
|
3025 |
+
$this->imagesDir = $m[1];
|
3026 |
+
|
3027 |
+
} else {
|
3028 |
+
$this->imagesDir = "/img/";
|
3029 |
+
}
|
3030 |
+
|
3031 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
3032 |
+
$this->productsImagesDir = $this->imagesDir;
|
3033 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3034 |
+
|
3035 |
+
if (defined('_PS_VERSION_')) {
|
3036 |
+
$this->cartVars['dbVersion'] = _PS_VERSION_;
|
3037 |
+
}
|
3038 |
+
}
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
|
3042 |
+
|
3043 |
+
|
3044 |
+
class M1_Config_Adapter_Gambio extends M1_Config_Adapter
|
3045 |
+
{
|
3046 |
+
function M1_Config_Adapter_Gambio()
|
3047 |
+
{
|
3048 |
+
$cur_dir = getcwd();
|
3049 |
+
|
3050 |
+
chdir(M1_STORE_BASE_DIR);
|
3051 |
+
|
3052 |
+
@require_once M1_STORE_BASE_DIR . "includes/configure.php";
|
3053 |
+
|
3054 |
+
chdir($cur_dir);
|
3055 |
+
|
3056 |
+
$this->imagesDir = DIR_WS_IMAGES;
|
3057 |
+
|
3058 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
3059 |
+
$this->productsImagesDir = $this->imagesDir;
|
3060 |
+
if (defined('DIR_WS_PRODUCT_IMAGES')) {
|
3061 |
+
$this->productsImagesDir = DIR_WS_PRODUCT_IMAGES;
|
3062 |
+
}
|
3063 |
+
if (defined('DIR_WS_ORIGINAL_IMAGES')) {
|
3064 |
+
$this->productsImagesDir = DIR_WS_ORIGINAL_IMAGES;
|
3065 |
+
}
|
3066 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3067 |
+
|
3068 |
+
$this->Host = DB_SERVER;
|
3069 |
+
//$this->setHostPort(DB_SERVER);
|
3070 |
+
$this->Username = DB_SERVER_USERNAME;
|
3071 |
+
$this->Password = DB_SERVER_PASSWORD;
|
3072 |
+
$this->Dbname = DB_DATABASE;
|
3073 |
+
|
3074 |
+
chdir(M1_STORE_BASE_DIR);
|
3075 |
+
if (file_exists(M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . 'application_top.php')) {
|
3076 |
+
$conf = file_get_contents (M1_STORE_BASE_DIR . "includes" . DIRECTORY_SEPARATOR . "application_top.php");
|
3077 |
+
preg_match("/define\('PROJECT_VERSION.*/", $conf, $match);
|
3078 |
+
if (isset($match[0]) && !empty($match[0])) {
|
3079 |
+
preg_match("/\d.*/", $match[0], $project);
|
3080 |
+
if (isset($project[0]) && !empty($project[0])) {
|
3081 |
+
$version = $project[0];
|
3082 |
+
$version = str_replace(array(" ","-","_","'",");"), "", $version);
|
3083 |
+
if ($version != '') {
|
3084 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
3085 |
+
}
|
3086 |
+
}
|
3087 |
+
} else {
|
3088 |
+
//if another oscommerce based cart
|
3089 |
+
if ( file_exists(M1_STORE_BASE_DIR . DIRECTORY_SEPARATOR . 'version_info.php') ) {
|
3090 |
+
@require_once M1_STORE_BASE_DIR . DIRECTORY_SEPARATOR . "version_info.php";
|
3091 |
+
if (defined('PROJECT_VERSION') && PROJECT_VERSION != '' ) {
|
3092 |
+
$version = PROJECT_VERSION;
|
3093 |
+
preg_match("/\d.*/", $version, $vers);
|
3094 |
+
if (isset($vers[0]) && !empty($vers[0])) {
|
3095 |
+
$version = $vers[0];
|
3096 |
+
$version = str_replace(array(" ","-","_"), "", $version);
|
3097 |
+
if ($version != '') {
|
3098 |
+
$this->cartVars['dbVersion'] = strtolower($version);
|
3099 |
+
}
|
3100 |
+
}
|
3101 |
+
//if zen_cart
|
3102 |
+
} else {
|
3103 |
+
if (defined('PROJECT_VERSION_MAJOR') && PROJECT_VERSION_MAJOR != '' ) {
|
3104 |
+
$this->cartVars['dbVersion'] = PROJECT_VERSION_MAJOR;
|
3105 |
+
}
|
3106 |
+
if (defined('PROJECT_VERSION_MINOR') && PROJECT_VERSION_MINOR != '' ) {
|
3107 |
+
$this->cartVars['dbVersion'] .= '.' . PROJECT_VERSION_MINOR;
|
3108 |
+
}
|
3109 |
+
}
|
3110 |
+
}
|
3111 |
+
}
|
3112 |
+
}
|
3113 |
+
chdir($cur_dir);
|
3114 |
+
}
|
3115 |
+
}
|
3116 |
+
|
3117 |
+
|
3118 |
+
|
3119 |
+
class M1_Config_Adapter_Litecommerce extends M1_Config_Adapter
|
3120 |
+
{
|
3121 |
+
function M1_Config_Adapter_Litecommerce()
|
3122 |
+
{
|
3123 |
+
if ((file_exists(M1_STORE_BASE_DIR .'/etc/config.php'))){
|
3124 |
+
$file = M1_STORE_BASE_DIR .'/etc/config.php';
|
3125 |
+
$this->imagesDir = "/images";
|
3126 |
+
$this->categoriesImagesDir = $this->imagesDir."/category";
|
3127 |
+
$this->productsImagesDir = $this->imagesDir."/product";
|
3128 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3129 |
+
} elseif(file_exists(M1_STORE_BASE_DIR .'/modules/lc_connector/litecommerce/etc/config.php')) {
|
3130 |
+
$file = M1_STORE_BASE_DIR .'/modules/lc_connector/litecommerce/etc/config.php';
|
3131 |
+
$this->imagesDir = "/modules/lc_connector/litecommerce/images";
|
3132 |
+
$this->categoriesImagesDir = $this->imagesDir."/category";
|
3133 |
+
$this->productsImagesDir = $this->imagesDir."/product";
|
3134 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3135 |
+
}
|
3136 |
+
|
3137 |
+
$settings = parse_ini_file($file);
|
3138 |
+
$this->Host = $settings['hostspec'];
|
3139 |
+
$this->setHostPort($settings['hostspec']);
|
3140 |
+
$this->Username = $settings['username'];
|
3141 |
+
$this->Password = $settings['password'];
|
3142 |
+
$this->Dbname = $settings['database'];
|
3143 |
+
$this->TblPrefix = $settings['table_prefix'];
|
3144 |
+
|
3145 |
+
$version = $this->getCartVersionFromDb("value", "config", "name = 'version'");
|
3146 |
+
if ( $version != '' ) {
|
3147 |
+
$this->cartVars['dbVersion'] = $version;
|
3148 |
+
}
|
3149 |
+
}
|
3150 |
+
}
|
3151 |
+
|
3152 |
+
|
3153 |
+
|
3154 |
+
class M1_Config_Adapter_Pinnacle361 extends M1_Config_Adapter
|
3155 |
+
{
|
3156 |
+
function M1_Config_Adapter_Pinnacle361()
|
3157 |
+
{
|
3158 |
+
include_once M1_STORE_BASE_DIR . 'content/engine/engine_config.php';
|
3159 |
+
|
3160 |
+
$this->imagesDir = 'images/';
|
3161 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
3162 |
+
$this->productsImagesDir = $this->imagesDir;
|
3163 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3164 |
+
|
3165 |
+
//$this->Host = DB_HOST;
|
3166 |
+
$this->setHostPort(DB_HOST);
|
3167 |
+
$this->Dbname = DB_NAME;
|
3168 |
+
$this->Username = DB_USER;
|
3169 |
+
$this->Password = DB_PASSWORD;
|
3170 |
+
|
3171 |
+
$version = $this->getCartVersionFromDb("value", (defined('DB_PREFIX') ? DB_PREFIX : '') . "settings", "name = 'AppVer'");
|
3172 |
+
if ( $version != '' ) {
|
3173 |
+
$this->cartVars['dbVersion'] = $version;
|
3174 |
+
}
|
3175 |
+
}
|
3176 |
+
}
|
3177 |
+
|
3178 |
+
|
3179 |
+
class M1_Config_Adapter_JooCart extends M1_Config_Adapter
|
3180 |
+
{
|
3181 |
+
function M1_Config_Adapter_JooCart()
|
3182 |
+
{
|
3183 |
+
require_once M1_STORE_BASE_DIR . "/configuration.php";
|
3184 |
+
|
3185 |
+
if (class_exists("JConfig")) {
|
3186 |
+
|
3187 |
+
$jconfig = new JConfig();
|
3188 |
+
|
3189 |
+
$this->setHostPort($jconfig->host);
|
3190 |
+
$this->Dbname = $jconfig->db;
|
3191 |
+
$this->Username = $jconfig->user;
|
3192 |
+
$this->Password = $jconfig->password;
|
3193 |
+
|
3194 |
+
} else {
|
3195 |
+
|
3196 |
+
$this->setHostPort($mosConfig_host);
|
3197 |
+
$this->Dbname = $mosConfig_db;
|
3198 |
+
$this->Username = $mosConfig_user;
|
3199 |
+
$this->Password = $mosConfig_password;
|
3200 |
+
}
|
3201 |
+
|
3202 |
+
|
3203 |
+
$this->imagesDir = "components/com_opencart/image/";
|
3204 |
+
$this->categoriesImagesDir = $this->imagesDir;
|
3205 |
+
$this->productsImagesDir = $this->imagesDir;
|
3206 |
+
$this->manufacturersImagesDir = $this->imagesDir;
|
3207 |
+
}
|
3208 |
+
}
|
3209 |
+
|
3210 |
+
|
3211 |
+
/**
|
3212 |
+
* @package api2cart
|
3213 |
+
* @author Vasul Babiy (v.babyi@magneticone.com)
|
3214 |
+
* @license Not public license
|
3215 |
+
* @link https://www.api2cart.com
|
3216 |
+
*/
|
3217 |
+
|
3218 |
+
class M1_Pdo
|
3219 |
+
{
|
3220 |
+
var $config = null; // config adapter
|
3221 |
+
var $noResult = array('delete', 'update', 'move', 'truncate', 'insert', 'set', 'create', 'drop');
|
3222 |
+
var $dataBaseHandle = null;
|
3223 |
+
|
3224 |
+
var $insertedId = 0;
|
3225 |
+
var $affectedRows = 0;
|
3226 |
+
|
3227 |
+
/**
|
3228 |
+
* pdo constructor
|
3229 |
+
*
|
3230 |
+
* @param M1_Config_Adapter $config configuration
|
3231 |
+
* @return M1_Pdo
|
3232 |
+
*/
|
3233 |
+
function M1_Pdo($config)
|
3234 |
+
{
|
3235 |
+
$this->config = $config;
|
3236 |
+
}
|
3237 |
+
|
3238 |
+
/**
|
3239 |
+
* @return bool|null|PDO
|
3240 |
+
*/
|
3241 |
+
function getDataBaseHandle()
|
3242 |
+
{
|
3243 |
+
if ($this->dataBaseHandle) {
|
3244 |
+
return $this->dataBaseHandle;
|
3245 |
+
}
|
3246 |
+
|
3247 |
+
$this->dataBaseHandle = $this->connect();
|
3248 |
+
|
3249 |
+
if (!$this->dataBaseHandle) {
|
3250 |
+
exit('[ERROR] MySQL Query Error: Can not connect to DB');
|
3251 |
+
}
|
3252 |
+
|
3253 |
+
return $this->dataBaseHandle;
|
3254 |
+
}
|
3255 |
+
|
3256 |
+
/**
|
3257 |
+
* @return bool|PDO
|
3258 |
+
*/
|
3259 |
+
function connect()
|
3260 |
+
{
|
3261 |
+
$triesCount = 3;
|
3262 |
+
$host = $this->config->Host . ($this->config->Port ? ':' . $this->config->Port : '');
|
3263 |
+
$password = stripslashes($this->config->Password);
|
3264 |
+
$dbName = $this->config->Dbname;
|
3265 |
+
|
3266 |
+
while ($triesCount) {
|
3267 |
+
try {
|
3268 |
+
$link = new PDO("mysql:host=$host; dbname=$dbName", $this->config->Username, $password);
|
3269 |
+
$link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
3270 |
+
|
3271 |
+
return $link;
|
3272 |
+
|
3273 |
+
} catch (PDOException $e) {
|
3274 |
+
$triesCount--;
|
3275 |
+
|
3276 |
+
// fix invalid port
|
3277 |
+
$host = $this->config->Host;
|
3278 |
+
}
|
3279 |
+
}
|
3280 |
+
return false;
|
3281 |
+
}
|
3282 |
+
|
3283 |
+
/**
|
3284 |
+
* @param string $sql sql query
|
3285 |
+
*
|
3286 |
+
* @return array|bool
|
3287 |
+
*/
|
3288 |
+
function localQuery($sql)
|
3289 |
+
{
|
3290 |
+
$result = array();
|
3291 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
3292 |
+
|
3293 |
+
$sth = $dataBaseHandle->query($sql);
|
3294 |
+
|
3295 |
+
foreach ($this->noResult as $statement) {
|
3296 |
+
if (!$sth || strpos(strtolower(trim($sql)), $statement) === 0) {
|
3297 |
+
return true;
|
3298 |
+
}
|
3299 |
+
}
|
3300 |
+
|
3301 |
+
while (($row = $sth->fetch(PDO::FETCH_ASSOC)) != false) {
|
3302 |
+
$result[] = $row;
|
3303 |
+
}
|
3304 |
+
|
3305 |
+
return $result;
|
3306 |
+
}
|
3307 |
+
|
3308 |
+
/**
|
3309 |
+
* @param string $sql sql query
|
3310 |
+
* @param int $fetchType fetch Type
|
3311 |
+
*
|
3312 |
+
* @return array
|
3313 |
+
*/
|
3314 |
+
function query($sql, $fetchType)
|
3315 |
+
{
|
3316 |
+
$result = array(
|
3317 |
+
'result' => null,
|
3318 |
+
'message' => '',
|
3319 |
+
'fetchedFields' => array()
|
3320 |
+
);
|
3321 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
3322 |
+
|
3323 |
+
if (isset($_GET['disable_checks'])) {
|
3324 |
+
$dataBaseHandle->exec('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0');
|
3325 |
+
$dataBaseHandle->exec("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
|
3326 |
+
}
|
3327 |
+
|
3328 |
+
if (isset($_REQUEST['set_names'])) {
|
3329 |
+
$dataBaseHandle->exec("SET NAMES '" . ($_REQUEST['set_names']) . "'");
|
3330 |
+
$dataBaseHandle->exec("SET CHARACTER SET '" . ($_REQUEST['set_names']) . "'");
|
3331 |
+
$dataBaseHandle->exec("SET CHARACTER_SET_CONNECTION = '" . ($_REQUEST['set_names']) . "'");
|
3332 |
+
}
|
3333 |
+
|
3334 |
+
switch ($fetchType) {
|
3335 |
+
case 3:
|
3336 |
+
$dataBaseHandle->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_BOTH);
|
3337 |
+
break;
|
3338 |
+
case 2:
|
3339 |
+
$dataBaseHandle->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM);
|
3340 |
+
break;
|
3341 |
+
case 1:
|
3342 |
+
default:
|
3343 |
+
$dataBaseHandle->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
3344 |
+
break;
|
3345 |
+
}
|
3346 |
+
|
3347 |
+
try {
|
3348 |
+
$res = $dataBaseHandle->query($sql);
|
3349 |
+
$this->affectedRows = $res->rowCount();
|
3350 |
+
$this->insertedId = $dataBaseHandle->lastInsertId();
|
3351 |
+
} catch (PDOException $e) {
|
3352 |
+
$result['message'] = '[ERROR] Mysql Query Error: ' . $e->getCode() . ', ' . $e->getMessage();
|
3353 |
+
return $result;
|
3354 |
+
}
|
3355 |
+
|
3356 |
+
foreach ($this->noResult as $statement) {
|
3357 |
+
if (!$res || strpos(strtolower(trim($sql)), $statement) === 0) {
|
3358 |
+
$result['result'] = true;
|
3359 |
+
return $result;
|
3360 |
+
}
|
3361 |
+
}
|
3362 |
+
|
3363 |
+
$rows = array();
|
3364 |
+
while (($row = $res->fetch()) !== false) {
|
3365 |
+
$rows[] = $row;
|
3366 |
+
}
|
3367 |
+
|
3368 |
+
if (isset($_GET['disable_checks'])) {
|
3369 |
+
$this->localQuery("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
|
3370 |
+
$this->localQuery("SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS,0)");
|
3371 |
+
}
|
3372 |
+
|
3373 |
+
$result['result'] = $rows;
|
3374 |
+
|
3375 |
+
unset($res);
|
3376 |
+
return $result;
|
3377 |
+
}
|
3378 |
+
|
3379 |
+
/**
|
3380 |
+
* @return string|int
|
3381 |
+
*/
|
3382 |
+
function getLastInsertId()
|
3383 |
+
{
|
3384 |
+
return $this->insertedId;
|
3385 |
+
}
|
3386 |
+
|
3387 |
+
/**
|
3388 |
+
* @return int
|
3389 |
+
*/
|
3390 |
+
function getAffectedRows()
|
3391 |
+
{
|
3392 |
+
return $this->affectedRows;
|
3393 |
+
}
|
3394 |
+
|
3395 |
+
/**
|
3396 |
+
* @return void
|
3397 |
+
*/
|
3398 |
+
function __destruct()
|
3399 |
+
{
|
3400 |
+
$this->dataBaseHandle = null;
|
3401 |
+
}
|
3402 |
+
}
|
3403 |
+
|
3404 |
+
/**
|
3405 |
+
* @package api2cart
|
3406 |
+
* @author Vasul Babiy (v.babyi@magneticone.com)
|
3407 |
+
* @license Not public license
|
3408 |
+
* @link https://www.api2cart.com
|
3409 |
+
*/
|
3410 |
+
|
3411 |
+
class M1_Mysql
|
3412 |
+
{
|
3413 |
+
var $config = null; // config adapter
|
3414 |
+
var $result = array();
|
3415 |
+
var $dataBaseHandle = null;
|
3416 |
+
|
3417 |
+
/**
|
3418 |
+
* mysql constructor
|
3419 |
+
*
|
3420 |
+
* @param M1_Config_Adapter $config
|
3421 |
+
* @return M1_Mysql
|
3422 |
+
*/
|
3423 |
+
function M1_Mysql($config)
|
3424 |
+
{
|
3425 |
+
$this->config = $config;
|
3426 |
+
}
|
3427 |
+
|
3428 |
+
/**
|
3429 |
+
* @return bool|null|resource
|
3430 |
+
*/
|
3431 |
+
function getDataBaseHandle()
|
3432 |
+
{
|
3433 |
+
if ($this->dataBaseHandle) {
|
3434 |
+
return $this->dataBaseHandle;
|
3435 |
+
}
|
3436 |
+
|
3437 |
+
$this->dataBaseHandle = $this->connect();
|
3438 |
+
|
3439 |
+
if (!$this->dataBaseHandle) {
|
3440 |
+
exit('[ERROR] MySQL Query Error: Can not connect to DB');
|
3441 |
+
}
|
3442 |
+
|
3443 |
+
return $this->dataBaseHandle;
|
3444 |
+
}
|
3445 |
+
|
3446 |
+
/**
|
3447 |
+
* @return bool|null|resource
|
3448 |
+
*/
|
3449 |
+
function connect()
|
3450 |
+
{
|
3451 |
+
$triesCount = 10;
|
3452 |
+
$link = null;
|
3453 |
+
$host = $this->config->Host . ($this->config->Port ? ':' . $this->config->Port : '');
|
3454 |
+
$password = stripslashes($this->config->Password);
|
3455 |
+
|
3456 |
+
while (!$link) {
|
3457 |
+
if (!$triesCount--) {
|
3458 |
+
break;
|
3459 |
+
}
|
3460 |
+
|
3461 |
+
$link = @mysql_connect($host, $this->config->Username, $password);
|
3462 |
+
if (!$link) {
|
3463 |
+
sleep(5);
|
3464 |
+
}
|
3465 |
+
}
|
3466 |
+
|
3467 |
+
if ($link) {
|
3468 |
+
mysql_select_db($this->config->Dbname, $link);
|
3469 |
+
} else {
|
3470 |
+
return false;
|
3471 |
+
}
|
3472 |
+
|
3473 |
+
return $link;
|
3474 |
+
}
|
3475 |
+
|
3476 |
+
/**
|
3477 |
+
* @param string $sql sql query
|
3478 |
+
*
|
3479 |
+
* @return array
|
3480 |
+
*/
|
3481 |
+
function localQuery($sql)
|
3482 |
+
{
|
3483 |
+
$result = array();
|
3484 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
3485 |
+
|
3486 |
+
$sth = mysql_query($sql, $dataBaseHandle);
|
3487 |
+
|
3488 |
+
if (is_bool($sth)) {
|
3489 |
+
return $sth;
|
3490 |
+
}
|
3491 |
+
|
3492 |
+
while (($row = mysql_fetch_assoc($sth)) != false) {
|
3493 |
+
$result[] = $row;
|
3494 |
+
}
|
3495 |
+
|
3496 |
+
return $result;
|
3497 |
+
}
|
3498 |
+
|
3499 |
+
/**
|
3500 |
+
* @param string $sql sql query
|
3501 |
+
* @param int $fetchType fetch Type
|
3502 |
+
*
|
3503 |
+
* @return array
|
3504 |
+
*/
|
3505 |
+
function query($sql, $fetchType)
|
3506 |
+
{
|
3507 |
+
$result = array(
|
3508 |
+
'result' => null,
|
3509 |
+
'message' => '',
|
3510 |
+
);
|
3511 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
3512 |
+
|
3513 |
+
if (!$dataBaseHandle) {
|
3514 |
+
$result['message'] = '[ERROR] MySQL Query Error: Can not connect to DB';
|
3515 |
+
return $result;
|
3516 |
+
}
|
3517 |
+
|
3518 |
+
if (isset($_GET['disable_checks'])) {
|
3519 |
+
$this->localQuery('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0');
|
3520 |
+
$this->localQuery("SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO'");
|
3521 |
+
}
|
3522 |
+
|
3523 |
+
if (isset($_REQUEST['set_names'])) {
|
3524 |
+
@mysql_query("SET NAMES " . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3525 |
+
@mysql_query("SET CHARACTER SET " . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3526 |
+
@mysql_query("SET CHARACTER_SET_CONNECTION=" . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3527 |
+
}
|
3528 |
+
|
3529 |
+
$fetchMode = MYSQL_ASSOC;
|
3530 |
+
switch ($fetchType) {
|
3531 |
+
case 3:
|
3532 |
+
$fetchMode = MYSQL_BOTH;
|
3533 |
+
break;
|
3534 |
+
case 2:
|
3535 |
+
$fetchMode = MYSQL_NUM;
|
3536 |
+
break;
|
3537 |
+
case 1:
|
3538 |
+
$fetchMode = MYSQL_ASSOC;
|
3539 |
+
break;
|
3540 |
+
default:
|
3541 |
+
break;
|
3542 |
+
}
|
3543 |
+
|
3544 |
+
$res = mysql_query($sql, $dataBaseHandle);
|
3545 |
+
|
3546 |
+
$triesCount = 10;
|
3547 |
+
while (mysql_errno($dataBaseHandle) == 2013) {
|
3548 |
+
if (!$triesCount--) {
|
3549 |
+
break;
|
3550 |
+
}
|
3551 |
+
// reconnect
|
3552 |
+
$dataBaseHandle = $this->getDataBaseHandle();
|
3553 |
+
if ($dataBaseHandle) {
|
3554 |
+
|
3555 |
+
if (isset($_REQUEST['set_names'])) {
|
3556 |
+
@mysql_query("SET NAMES " . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3557 |
+
@mysql_query("SET CHARACTER SET " . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3558 |
+
@mysql_query("SET CHARACTER_SET_CONNECTION=" . @mysql_real_escape_string($_REQUEST['set_names']), $dataBaseHandle);
|
3559 |
+
}
|
3560 |
+
|
3561 |
+
// execute query once again
|
3562 |
+
$res = mysql_query($sql, $dataBaseHandle);
|
3563 |
+
}
|
3564 |
+
}
|
3565 |
+
|
3566 |
+
if (($errno = mysql_errno($dataBaseHandle)) != 0) {
|
3567 |
+
$result['message'] = '[ERROR] Mysql Query Error: ' . $errno . ', ' . mysql_error($dataBaseHandle);
|
3568 |
+
return $result;
|
3569 |
+
}
|
3570 |
+
|
3571 |
+
if (!is_resource($res)) {
|
3572 |
+
$result['result'] = $res;
|
3573 |
+
return $result;
|
3574 |
+
}
|
3575 |
+
|
3576 |
+
$fetchedFields = array();
|
3577 |
+
while (($field = mysql_fetch_field($res)) !== false) {
|
3578 |
+
$fetchedFields[] = $field;
|
3579 |
+
}
|
3580 |
+
|
3581 |
+
$rows = array();
|
3582 |
+
while (($row = mysql_fetch_array($res, $fetchMode)) !== false) {
|
3583 |
+
$rows[] = $row;
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
if (isset($_GET['disable_checks'])) {
|
3587 |
+
$this->localQuery("SET SQL_MODE=IFNULL(@OLD_SQL_MODE,'')");
|
3588 |
+
$this->localQuery("SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS,0)");
|
3589 |
+
}
|
3590 |
+
|
3591 |
+
$result['result'] = $rows;
|
3592 |
+
$result['fetchedFields'] = $fetchedFields;
|
3593 |
+
|
3594 |
+
mysql_free_result($res);
|
3595 |
+
return $result;
|
3596 |
+
}
|
3597 |
+
|
3598 |
+
/**
|
3599 |
+
* @return int
|
3600 |
+
*/
|
3601 |
+
function getLastInsertId()
|
3602 |
+
{
|
3603 |
+
return mysql_insert_id($this->dataBaseHandle);
|
3604 |
+
}
|
3605 |
+
|
3606 |
+
/**
|
3607 |
+
* @return int
|
3608 |
+
*/
|
3609 |
+
function getAffectedRows()
|
3610 |
+
{
|
3611 |
+
return mysql_affected_rows($this->dataBaseHandle);
|
3612 |
+
}
|
3613 |
+
|
3614 |
+
/**
|
3615 |
+
* @return void
|
3616 |
+
*/
|
3617 |
+
function __destruct()
|
3618 |
+
{
|
3619 |
+
if ($this->dataBaseHandle) {
|
3620 |
+
mysql_close($this->dataBaseHandle);
|
3621 |
+
}
|
3622 |
+
|
3623 |
+
$this->dataBaseHandle = null;
|
3624 |
+
}
|
3625 |
+
}
|
3626 |
+
|
3627 |
+
|
3628 |
+
|
3629 |
+
class M1_Bridge
|
3630 |
+
{
|
3631 |
+
var $_link = null; //mysql connection link
|
3632 |
+
var $config = null; //config adapter
|
3633 |
+
|
3634 |
+
/**
|
3635 |
+
* Bridge constructor
|
3636 |
+
*
|
3637 |
+
* @param M1_Config_Adapter $config
|
3638 |
+
* @return M1_Bridge
|
3639 |
+
*/
|
3640 |
+
function M1_Bridge($config)
|
3641 |
+
{
|
3642 |
+
$this->config = $config;
|
3643 |
+
|
3644 |
+
if ($this->getAction() != "savefile" && $this->getAction() != "update") {
|
3645 |
+
$this->_link = $this->config->connect();
|
3646 |
+
}
|
3647 |
+
}
|
3648 |
+
|
3649 |
+
function getTablesPrefix()
|
3650 |
+
{
|
3651 |
+
return $this->config->TblPrefix;
|
3652 |
+
}
|
3653 |
+
|
3654 |
+
function getLink()
|
3655 |
+
{
|
3656 |
+
return $this->_link;
|
3657 |
+
}
|
3658 |
+
|
3659 |
+
function query($sql, $fetchMode)
|
3660 |
+
{
|
3661 |
+
return $this->_link->query($sql, $fetchMode);
|
3662 |
+
}
|
3663 |
+
|
3664 |
+
function getAction()
|
3665 |
+
{
|
3666 |
+
if (isset($_GET['action'])) {
|
3667 |
+
return str_replace('.', '', $_GET['action']);
|
3668 |
+
}
|
3669 |
+
|
3670 |
+
return '';
|
3671 |
+
}
|
3672 |
+
|
3673 |
+
function run()
|
3674 |
+
{
|
3675 |
+
$action = $this->getAction();
|
3676 |
+
|
3677 |
+
if ($action != "update") {
|
3678 |
+
$this->_selfTest();
|
3679 |
+
}
|
3680 |
+
|
3681 |
+
if ($action == "checkbridge") {
|
3682 |
+
echo "BRIDGE_OK";
|
3683 |
+
return;
|
3684 |
+
}
|
3685 |
+
|
3686 |
+
if ($action == "update") {
|
3687 |
+
$this->_checkPossibilityUpdate();
|
3688 |
+
}
|
3689 |
+
|
3690 |
+
$className = "M1_Bridge_Action_" . ucfirst($action);
|
3691 |
+
if (!class_exists($className)) {
|
3692 |
+
echo 'ACTION_DO_NOT EXIST' . PHP_EOL;
|
3693 |
+
die;
|
3694 |
+
}
|
3695 |
+
|
3696 |
+
$actionObj = new $className();
|
3697 |
+
@$actionObj->cartType = @$this->config->cartType;
|
3698 |
+
$actionObj->perform($this);
|
3699 |
+
$this->_destroy();
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
function isWritable($dir)
|
3703 |
+
{
|
3704 |
+
if (!@is_dir($dir)) {
|
3705 |
+
return false;
|
3706 |
+
}
|
3707 |
+
|
3708 |
+
$dh = @opendir($dir);
|
3709 |
+
|
3710 |
+
if ($dh === false) {
|
3711 |
+
return false;
|
3712 |
+
}
|
3713 |
+
|
3714 |
+
while (($entry = readdir($dh)) !== false) {
|
3715 |
+
if ($entry == "." || $entry == ".." || !@is_dir($dir . DIRECTORY_SEPARATOR . $entry)) {
|
3716 |
+
continue;
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
if (!$this->isWritable($dir . DIRECTORY_SEPARATOR . $entry)) {
|
3720 |
+
return false;
|
3721 |
+
}
|
3722 |
+
}
|
3723 |
+
|
3724 |
+
if (!is_writable($dir)) {
|
3725 |
+
return false;
|
3726 |
+
}
|
3727 |
+
|
3728 |
+
return true;
|
3729 |
+
}
|
3730 |
+
|
3731 |
+
function _destroy()
|
3732 |
+
{
|
3733 |
+
$this->_link = null;
|
3734 |
+
}
|
3735 |
+
|
3736 |
+
function _checkPossibilityUpdate()
|
3737 |
+
{
|
3738 |
+
if (!is_writable(M1_STORE_BASE_DIR . "/" . M1_BRIDGE_DIRECTORY_NAME . "/")) {
|
3739 |
+
die("ERROR_TRIED_TO_PERMISSION" . M1_STORE_BASE_DIR . "/" . M1_BRIDGE_DIRECTORY_NAME . "/");
|
3740 |
+
}
|
3741 |
+
|
3742 |
+
if (!is_writable(M1_STORE_BASE_DIR . "/". M1_BRIDGE_DIRECTORY_NAME . "/bridge.php")) {
|
3743 |
+
die("ERROR_TRIED_TO_PERMISSION_BRIDGE_FILE" . M1_STORE_BASE_DIR . "/" . M1_BRIDGE_DIRECTORY_NAME . "/bridge.php");
|
3744 |
+
}
|
3745 |
+
}
|
3746 |
+
|
3747 |
+
function _selfTest()
|
3748 |
+
{
|
3749 |
+
if (!isset($_GET['ver']) || $_GET['ver'] != M1_BRIDGE_VERSION) {
|
3750 |
+
die ('ERROR_BRIDGE_VERSION_NOT_SUPPORTED');
|
3751 |
+
}
|
3752 |
+
|
3753 |
+
|
3754 |
+
|
3755 |
+
define("M1_TOKEN", "ciao");
|
3756 |
+
// good :)
|
3757 |
+
} else {
|
3758 |
+
die('ERROR_INVALID_TOKEN');
|
3759 |
+
}
|
3760 |
+
|
3761 |
+
if ((!isset($_GET['storetype']) || $_GET['storetype'] == 'target') && $this->getAction() == 'checkbridge') {
|
3762 |
+
|
3763 |
+
if (trim($this->config->imagesDir) != "") {
|
3764 |
+
if (!file_exists(M1_STORE_BASE_DIR . $this->config->imagesDir) && is_writable(M1_STORE_BASE_DIR)) {
|
3765 |
+
if (!@mkdir(M1_STORE_BASE_DIR . $this->config->imagesDir, 0777, true)) {
|
3766 |
+
die('ERROR_TRIED_TO_CREATE_IMAGE_DIR' . M1_STORE_BASE_DIR . $this->config->imagesDir);
|
3767 |
+
}
|
3768 |
+
}
|
3769 |
+
|
3770 |
+
if (!$this->isWritable(M1_STORE_BASE_DIR . $this->config->imagesDir)) {
|
3771 |
+
die('ERROR_NO_IMAGES_DIR '.M1_STORE_BASE_DIR . $this->config->imagesDir);
|
3772 |
+
}
|
3773 |
+
}
|
3774 |
+
|
3775 |
+
if (trim($this->config->categoriesImagesDir) != "") {
|
3776 |
+
if (!file_exists(M1_STORE_BASE_DIR . $this->config->categoriesImagesDir) && is_writable(M1_STORE_BASE_DIR)) {
|
3777 |
+
if (!@mkdir(M1_STORE_BASE_DIR . $this->config->categoriesImagesDir, 0777, true)) {
|
3778 |
+
die('ERROR_TRIED_TO_CREATE_IMAGE_DIR' . M1_STORE_BASE_DIR . $this->config->categoriesImagesDir);
|
3779 |
+
}
|
3780 |
+
}
|
3781 |
+
|
3782 |
+
if (!$this->isWritable(M1_STORE_BASE_DIR . $this->config->categoriesImagesDir)) {
|
3783 |
+
die('ERROR_NO_IMAGES_DIR '.M1_STORE_BASE_DIR . $this->config->categoriesImagesDir);
|
3784 |
+
}
|
3785 |
+
}
|
3786 |
+
|
3787 |
+
if (trim($this->config->productsImagesDir) != "") {
|
3788 |
+
if (!file_exists(M1_STORE_BASE_DIR . $this->config->productsImagesDir) && is_writable(M1_STORE_BASE_DIR)) {
|
3789 |
+
if (!@mkdir(M1_STORE_BASE_DIR . $this->config->productsImagesDir, 0777, true)) {
|
3790 |
+
die('ERROR_TRIED_TO_CREATE_IMAGE_DIR' . M1_STORE_BASE_DIR . $this->config->productsImagesDir);
|
3791 |
+
}
|
3792 |
+
}
|
3793 |
+
|
3794 |
+
if (!$this->isWritable(M1_STORE_BASE_DIR . $this->config->productsImagesDir)) {
|
3795 |
+
die('ERROR_NO_IMAGES_DIR '.M1_STORE_BASE_DIR . $this->config->productsImagesDir);
|
3796 |
+
}
|
3797 |
+
}
|
3798 |
+
|
3799 |
+
if (trim($this->config->manufacturersImagesDir) != "") {
|
3800 |
+
if (!file_exists(M1_STORE_BASE_DIR . $this->config->manufacturersImagesDir) && is_writable(M1_STORE_BASE_DIR)) {
|
3801 |
+
if (!@mkdir(M1_STORE_BASE_DIR . $this->config->manufacturersImagesDir, 0777, true)) {
|
3802 |
+
die('ERROR_TRIED_TO_CREATE_IMAGE_DIR' . M1_STORE_BASE_DIR . $this->config->manufacturersImagesDir);
|
3803 |
+
}
|
3804 |
+
}
|
3805 |
+
|
3806 |
+
if (!$this->isWritable(M1_STORE_BASE_DIR . $this->config->manufacturersImagesDir)) {
|
3807 |
+
die('ERROR_NO_IMAGES_DIR '.M1_STORE_BASE_DIR . $this->config->manufacturersImagesDir);
|
3808 |
+
}
|
3809 |
+
}
|
3810 |
+
}
|
3811 |
+
}
|
3812 |
+
}
|
3813 |
+
|
3814 |
+
|
3815 |
+
|
3816 |
+
define('M1_BRIDGE_VERSION', '21');
|
3817 |
+
|
3818 |
+
define('M1_BRIDGE_DIRECTORY_NAME', basename(getcwd()));
|
3819 |
+
|
3820 |
+
ini_set('display_errors', 1);
|
3821 |
+
if (substr(phpversion(), 0, 1) == 5) {
|
3822 |
+
error_reporting(E_ALL & ~E_STRICT);
|
3823 |
+
} else {
|
3824 |
+
error_reporting(E_ALL);
|
3825 |
+
}
|
3826 |
+
|
3827 |
+
|
3828 |
+
|
3829 |
+
define("M1_TOKEN", "ciao");
|
3830 |
+
|
3831 |
+
function stripslashes_array($array) {
|
3832 |
+
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
|
3833 |
+
}
|
3834 |
+
|
3835 |
+
function getPHPExecutable() {
|
3836 |
+
$paths = explode(PATH_SEPARATOR, getenv('PATH'));
|
3837 |
+
$paths[] = PHP_BINDIR;
|
3838 |
+
foreach ($paths as $path) {
|
3839 |
+
// we need this for XAMPP (Windows)
|
3840 |
+
if (isset($_SERVER["WINDIR"]) && strstr($path, 'php.exe') && file_exists($path) && is_file($path)) {
|
3841 |
+
return $path;
|
3842 |
+
} else {
|
3843 |
+
$phpExecutable = $path . DIRECTORY_SEPARATOR . "php" . (isset($_SERVER["WINDIR"]) ? ".exe" : "");
|
3844 |
+
if (file_exists($phpExecutable) && is_file($phpExecutable)) {
|
3845 |
+
return $phpExecutable;
|
3846 |
+
}
|
3847 |
+
}
|
3848 |
+
}
|
3849 |
+
return false;
|
3850 |
+
}
|
3851 |
+
|
3852 |
+
if (!isset($_SERVER))
|
3853 |
+
{
|
3854 |
+
$_GET = &$HTTP_GET_VARS;
|
3855 |
+
$_POST = &$HTTP_POST_VARS;
|
3856 |
+
$_ENV = &$HTTP_ENV_VARS;
|
3857 |
+
$_SERVER = &$HTTP_SERVER_VARS;
|
3858 |
+
$_COOKIE = &$HTTP_COOKIE_VARS;
|
3859 |
+
$_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
|
3860 |
+
}
|
3861 |
+
|
3862 |
+
if (get_magic_quotes_gpc()) {
|
3863 |
+
$_COOKIE = stripslashes_array($_COOKIE);
|
3864 |
+
$_FILES = stripslashes_array($_FILES);
|
3865 |
+
$_GET = stripslashes_array($_GET);
|
3866 |
+
$_POST = stripslashes_array($_POST);
|
3867 |
+
$_REQUEST = stripslashes_array($_REQUEST);
|
3868 |
+
}
|
3869 |
+
|
3870 |
+
if (isset($_SERVER['SCRIPT_FILENAME'])) {
|
3871 |
+
$scriptPath = $_SERVER['SCRIPT_FILENAME'];
|
3872 |
+
if ( isset($_SERVER['PATH_TRANSLATED']) && $_SERVER['PATH_TRANSLATED'] != "" ) {
|
3873 |
+
$scriptPath = $_SERVER['PATH_TRANSLATED'];
|
3874 |
+
}
|
3875 |
+
define("M1_STORE_BASE_DIR", preg_replace('/[^\/\\\]*[\/\\\][^\/\\\]*$/', '', $scriptPath));
|
3876 |
+
} else {
|
3877 |
+
//Windows IIS
|
3878 |
+
define("M1_STORE_BASE_DIR", preg_replace('/[^\/\\\]*[\/\\\][^\/\\\]*$/', '', realpath(dirname(__FILE__) . "/../")));
|
3879 |
+
}
|
3880 |
+
$adapter = new M1_Config_Adapter();
|
3881 |
+
$bridge = new M1_Bridge($adapter->create());
|
3882 |
+
|
3883 |
+
if (!$bridge->getLink()) {
|
3884 |
+
die ('ERROR_BRIDGE_CANT_CONNECT_DB');
|
3885 |
+
}
|
3886 |
+
|
3887 |
+
$bridge->run();
|
3888 |
+
?>
|
bridge2cart/index.html
ADDED
File without changes
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Zikkio</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Zikkio module is the connector between your Magento and Zikkio service.</summary>
|
10 |
+
<description>Zikkio module is the connector between your Magento and Zikkio service. With Zikkio module active you can import/export orders and products to Zikkio.</description>
|
11 |
+
<notes>First stable release.</notes>
|
12 |
+
<authors><author><name>Paolo Morello</name><user>Zikkio</user><email>account@zikkio.com</email></author></authors>
|
13 |
+
<date>2016-03-31</date>
|
14 |
+
<time>08:55:58</time>
|
15 |
+
<contents><target name="magelocal"><dir><dir name="HPO"><dir name="ZikkioAdminController"><dir name="Model"><file name="Observer.php" hash="ee1c1193342460e490b70e7b74c57b56"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CustomController.php" hash="394222c6ca973beb16af93e18822f559"/></dir></dir><dir name="etc"><file name="config.xml" hash="8a092726d039eda632d0797679b9c92e"/><file name="system.xml" hash="256c0d51bb6fb236fbf9b314d0be6389"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="bridge2cart"><file name="bridge.php" hash="7bbfb93ce76daf59f1214c9ebdf5dac8"/><file name="index.html" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|