1
|
<?php
|
2
|
/*******************************************************************************************
|
3
|
* *
|
4
|
* CAO-Faktura für Windows Version 1.4 (http://www.cao-faktura.de) *
|
5
|
* Copyright (C) 2009 Jan Pokrandt / Jan@JP-SOFT.de *
|
6
|
* *
|
7
|
* This program is free software; you can redistribute it and/or *
|
8
|
* modify it under the terms of the GNU General Public License *
|
9
|
* as published by the Free Software Foundation; either version 2 *
|
10
|
* of the License, or any later version. *
|
11
|
* *
|
12
|
* This program is distributed in the hope that it will be useful, *
|
13
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
14
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
15
|
* GNU General Public License for more details. *
|
16
|
* *
|
17
|
* You should have received a copy of the GNU General Public License *
|
18
|
* along with this program; if not, write to the Free Software *
|
19
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
20
|
* *
|
21
|
* ******* This Scripts comes with ABSOLUTELY NO WARRANTY *************** *
|
22
|
* *
|
23
|
********************************************************************************************
|
24
|
* *
|
25
|
* Eine Entfernung oder Veraenderung dieses Dateiheaders ist nicht zulaessig !!! *
|
26
|
* Wenn Sie diese Datei veraendern dann fuegen Sie ihre eigenen Copyrightmeldungen *
|
27
|
* am Ende diese Headers an *
|
28
|
* *
|
29
|
********************************************************************************************
|
30
|
* *
|
31
|
* Programm : CAO-Faktura *
|
32
|
* Modul : cao_xtc.php *
|
33
|
* Stand : 26.08.2009 *
|
34
|
* Version : 1.56 *
|
35
|
* Beschreibung : Script zum Datenaustausch CAO-Faktura <--> xtCommerce-Shop *
|
36
|
* *
|
37
|
* based on: *
|
38
|
* (c) 2000 - 2001 The Exchange Project *
|
39
|
* (c) 2001 - 2003 osCommerce, Open Source E-Commerce Solutions *
|
40
|
* (c) 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers *
|
41
|
* (c) 2003 JP-Soft, Jan Pokrandt *
|
42
|
* (c) 2003 IN-Solution, Henri Schmidhuber *
|
43
|
* (c) 2003 www.websl.de, Karl Langmann *
|
44
|
* (c) 2003 RV-Design Raphael Vullriede *
|
45
|
* (c) 2004 XT-Commerce *
|
46
|
* *
|
47
|
* Released under the GNU General Public License *
|
48
|
* *
|
49
|
* History : *
|
50
|
* *
|
51
|
* - 25.06.2003 JP Version 0.1 released *
|
52
|
* - 26.06.2003 HS beim Orderexport orderstatus und comment hinzugefuegt *
|
53
|
* - 29.06.2003 JP order_update entfernt und in die Datei cao_update.php verschoben *
|
54
|
* - 17.07.2003 tep_array_merge durch array_merge ersetzt *
|
55
|
* - 18.07.2003 Code fuer Image_Upload hinzugefuegt *
|
56
|
* - 20.07.2003 HS Shipping und Paymentklassen aufgenommen *
|
57
|
* - 02.08.2003 KL MANUFACTURERS_DESCRIPTION language_id geändert in languages_id *
|
58
|
* - 09.08.2003 JP fuer das Modul Banktransfer werden jetzt die daten bei der Bestll- *
|
59
|
* uebermittlung mit ausgegeben *
|
60
|
* - 10.08.2003 JP Geburtsdatum wird jetzt in den Bestellungen mit uebergeben *
|
61
|
* - 18.08.2003 JP Bug bei Products/URL beseitigt *
|
62
|
* - 18.08.2003 HS Bankdaten werden nur bei Banktransfer ausgelesen *
|
63
|
* - 23.08.2003 Code fuer Hersteller-Update hinzugefuegt *
|
64
|
* - 25.10.2003 RV Kunden-Export hinzugefügt *
|
65
|
* - 24.11.2003 HS Fix Kunden-Export - Newsletterexport hinzugefügt *
|
66
|
* - 01.12.2003 RV Code für 3 Produktbilder-Erweiterung hinzugefügt. *
|
67
|
* - 31.01.2004 JP Resourcenverbrauch minimiert *
|
68
|
* tep_set_time_limit ist jetzt per DEFINE zu- und abschaltbar *
|
69
|
* - 06.06.2004 JP per DEFINE kann jetzt die Option "3 Produktbilder" geschaltet werden *
|
70
|
* - 09.10.2004 RV automatisch Erkennung von 3 Bilder Contrib laut readme *
|
71
|
* - 09.10.2004 RV vereinheitlicher Adress-Export bei Bestellungen und Kunden *
|
72
|
* - 09.10.2004 RV Kunden Vor- und Nachname bei Bestellungen getrennt exportieren *
|
73
|
* - 09.10.2004 RV SQL-Cleanup *
|
74
|
* - 09.10.2004 RV CODE-Cleanup *
|
75
|
* - 14.10.2004 RV Länder bei Bestellungen als ISO-Code *
|
76
|
* - 25.10.2003 Kunden-Update hinzugefügt *
|
77
|
* - 01.11.2003 Statusänderung werden wenn möglich in der Bestellsprache ausgeführt *
|
78
|
* Copyright (c) 2004 XT-Commerce *
|
79
|
* 1.1 switching POST/GET vars for CAO imageUpload *
|
80
|
* 1.2 mulitlang inserts for Categories *
|
81
|
* 1.3 xt:C v3.0 update *
|
82
|
* - 03.12.2003 JP Bugfix beim Kunden-Export (Fehlende Felder) *
|
83
|
* XTC 1.1 fixed bug with attributes and products qty > 1 *
|
84
|
* XTC 1.2 Updates for xt:C 3.0 *
|
85
|
* - 10.12.2004 JP Anpassungen fuer CAO 1.2.6.x (customers_export, orders_export) *
|
86
|
* - 10.12.2004 JP Anpassungen an CAO-Faktura 1.2.6.1 *
|
87
|
* - 01.06.2005 JP Bugfix MWST-Switch
|
88
|
* - 01.06.2005 KL/JP Anpassungen für IMAGE_MANIPULATOR (XTC 2.x und 3.x) *
|
89
|
* - 19.08.2005 JP Bugfix beim Aktualisieren von Kunden (PW wurde neu gesetzt) *
|
90
|
* - 24.08.2005 TKI Bugfix MWST-Switch *
|
91
|
* products_tax_class_id statt $products['products_tax_class_id'] *
|
92
|
* - 04.10.2005 JP/KL Version 1.44 released, Scripte komplett ueberarbeitet *
|
93
|
* - 06.10.2005 KL/JP Bugfix bei xtc_set_time_limit *
|
94
|
* - 17.10.2005 JP Bugfixes fuer XTC 304 *
|
95
|
* - 21.10.2005 JP Bugfix bei Passwortuebergabe wenn das Passwort als erstes ein *
|
96
|
* numerisches Zeichen enthielt *
|
97
|
* - 02.11.2005 JP Fehler bei doppelter Funktion xtDBquery gefixt *
|
98
|
* - 15.09.2006 xsell_update / erase durch Wolfgang eingebaut *
|
99
|
* siehe : http://www.cao-faktura.de/index.php?option=com_forum& *
|
100
|
* Itemid=44&page=viewtopic&p=52192#52192 *
|
101
|
*******************************************************************************************/
|
102
|
|
103
|
|
104
|
define('SET_TIME_LIMIT',1); // use set_time_limit(0);
|
105
|
//define('CHARSET','iso-8859-1');
|
106
|
define('CHARSET','UTF-8');
|
107
|
|
108
|
$version_nr = '1.56';
|
109
|
$version_datum = '2009.08.26';
|
110
|
|
111
|
// falls die MWST vom shop vertauscht wird, hier true setzen.
|
112
|
define('SWITCH_MWST',true);
|
113
|
|
114
|
define ('LOGGER',false); // Um das Loggen einzuschalten false durch true ersetzen.
|
115
|
|
116
|
define('USE_3IMAGES',false);
|
117
|
define('USE_VPE',false);
|
118
|
|
119
|
// Emails beim Kundenanlegen versenden ?
|
120
|
define('SEND_ACCOUNT_MAIL',false);
|
121
|
|
122
|
// Default-Sprache
|
123
|
$LangID = 2;
|
124
|
$Lang_folder = 'german';
|
125
|
|
126
|
// Steuer Einstellungen für CAO-Faktura
|
127
|
|
128
|
$order_total_class['ot_cod_fee']['prefix'] = '+';
|
129
|
$order_total_class['ot_cod_fee']['tax'] = '19';
|
130
|
|
131
|
$order_total_class['ot_customer_discount']['prefix'] = '-';
|
132
|
$order_total_class['ot_customer_discount']['tax'] = '19';
|
133
|
|
134
|
$order_total_class['ot_gv']['prefix'] = '-';
|
135
|
$order_total_class['ot_gv']['tax'] = '0';
|
136
|
|
137
|
$order_total_class['ot_loworderfee']['prefix'] = '+';
|
138
|
$order_total_class['ot_loworderfee']['tax'] = '19';
|
139
|
|
140
|
$order_total_class['ot_shipping']['prefix'] = '+';
|
141
|
$order_total_class['ot_shipping']['tax'] = '19';
|
142
|
|
143
|
|
144
|
define ('_VALID_XTC',false);
|
145
|
|
146
|
require('../includes/application_top_export.php');
|
147
|
|
148
|
// Kundengruppen ID für Neukunden (default "neue Kunden einstellungen in XTC")
|
149
|
define('STANDARD_GROUP',DEFAULT_CUSTOMERS_STATUS_ID);
|
150
|
|
151
|
//KL02062005
|
152
|
if (file_exists(DIR_FS_DOCUMENT_ROOT.'admin/includes/classes/image_manipulator.php'))
|
153
|
{
|
154
|
// für XTC 2.x
|
155
|
include(DIR_FS_DOCUMENT_ROOT.'admin/includes/classes/image_manipulator.php');
|
156
|
} else {
|
157
|
// für XTC ab 3.x
|
158
|
include(DIR_FS_DOCUMENT_ROOT.'admin/includes/classes/'.IMAGE_MANIPULATOR);
|
159
|
} //KL02062005_ENDE
|
160
|
|
161
|
if ((isset($_POST['user']))and(isset($_POST['password'])))
|
162
|
{
|
163
|
$user=$_POST['user'];
|
164
|
$password=$_POST['password'];
|
165
|
}
|
166
|
else
|
167
|
{
|
168
|
$user=$_GET['user'];
|
169
|
$password=$_GET['password'];
|
170
|
}
|
171
|
|
172
|
if ($user=='' or $password=='')
|
173
|
{
|
174
|
?>
|
175
|
<html><head><title></title></head><body>
|
176
|
<h3><a href="http://www.cao-faktura.de">CAO-Faktura - xt:Commerce Shopanbindung</a></h3>
|
177
|
<h4>Mehr dazu im <a href="http://www.cao-faktura.de/index.php?option=com_forum&Itemid=44">Forum</a></h4>
|
178
|
<h4>Version <?php echo $version_nr; ?> Stand : <?php echo $version_datum; ?></h4>
|
179
|
<br><br>
|
180
|
Aufruf des Scriptes mit <br><b><?php echo $PHP_SELF; ?>?user=<font color="red">ADMIN-EMAIL</font>&password=<font color="red">ADMIN-PASSWORD-IM-KLARTEXT</font>
|
181
|
</b>
|
182
|
</body></html>
|
183
|
<?php
|
184
|
exit;
|
185
|
}
|
186
|
else
|
187
|
{
|
188
|
require ('cao_xtc_functions.php');
|
189
|
|
190
|
// security 1.check if admin user with this mailadress exits, and got access to xml-export
|
191
|
// 2.check if pasword = true
|
192
|
if (column_exists ('admin_access','xml_export')==false)
|
193
|
{
|
194
|
xtc_db_query('ALTER TABLE admin_access ADD xml_export INT(1) DEFAULT "0";');
|
195
|
xtc_db_query('UPDATE admin_access SET xml_export= 1 WHERE customers_id=\'1\';');
|
196
|
}
|
197
|
|
198
|
$check_customer_query=xtc_db_query("select customers_id,
|
199
|
customers_status,
|
200
|
customers_password
|
201
|
from " . TABLE_CUSTOMERS . " where
|
202
|
customers_email_address = '" . $user . "'");
|
203
|
|
204
|
if (!xtc_db_num_rows($check_customer_query))
|
205
|
{
|
206
|
SendXMLHeader ();
|
207
|
print_xml_status (105, $_POST['action'], 'WRONG LOGIN', '', '', '');
|
208
|
exit;
|
209
|
}
|
210
|
else
|
211
|
{
|
212
|
$check_customer = xtc_db_fetch_array($check_customer_query);
|
213
|
// check if customer is Admin
|
214
|
if ($check_customer['customers_status']!='0')
|
215
|
{
|
216
|
SendXMLHeader ();
|
217
|
print_xml_status (106, $_POST['action'], 'WRONG LOGIN', '', '', '');
|
218
|
exit;
|
219
|
}
|
220
|
|
221
|
// check if Admin is allowed to access xml_export
|
222
|
$access_query=xtc_db_query("SELECT
|
223
|
xml_export
|
224
|
from admin_access
|
225
|
WHERE customers_id='".$check_customer['customers_id']."'");
|
226
|
$access_data = xtc_db_fetch_array($access_query);
|
227
|
if ($access_data['xml_export']!=1)
|
228
|
{
|
229
|
SendXMLHeader ();
|
230
|
print_xml_status (107, $_POST['action'], 'WRONG LOGIN', '', '', '');
|
231
|
exit;
|
232
|
}
|
233
|
|
234
|
if (!( ($check_customer['customers_password'] == $password) or
|
235
|
($check_customer['customers_password'] == md5($password)) or
|
236
|
($check_customer['customers_password'] == md5(substr($password,2,40)))
|
237
|
))
|
238
|
{
|
239
|
SendXMLHeader ();
|
240
|
print_xml_status (108, $_POST['action'], 'WRONG PASSWORD', '', '', '');
|
241
|
exit;
|
242
|
}
|
243
|
}
|
244
|
}
|
245
|
|
246
|
|
247
|
if ($_SERVER['REQUEST_METHOD']=='GET')
|
248
|
{
|
249
|
switch ($_GET['action'])
|
250
|
{
|
251
|
case 'version': // Ausgabe Scriptversion
|
252
|
|
253
|
SendXMLHeader ();
|
254
|
SendScriptVersion ();
|
255
|
exit;
|
256
|
|
257
|
case 'categories_export':
|
258
|
|
259
|
SendXMLHeader ();
|
260
|
SendCategories ();
|
261
|
exit;
|
262
|
|
263
|
case 'manufacturers_export':
|
264
|
|
265
|
SendXMLHeader ();
|
266
|
SendManufacturers ();
|
267
|
exit;
|
268
|
|
269
|
case 'orders_export':
|
270
|
|
271
|
SendXMLHeader ();
|
272
|
SendOrders ();
|
273
|
exit;
|
274
|
|
275
|
case 'products_export':
|
276
|
|
277
|
SendXMLHeader ();
|
278
|
SendProducts ();
|
279
|
exit;
|
280
|
|
281
|
case 'customers_export':
|
282
|
|
283
|
SendXMLHeader ();
|
284
|
SendCustomers ();
|
285
|
exit;
|
286
|
|
287
|
case 'customers_newsletter_export':
|
288
|
|
289
|
SendXMLHeader ();
|
290
|
SendCustomersNewsletter ();
|
291
|
exit;
|
292
|
|
293
|
case 'config_export':
|
294
|
|
295
|
SendXMLHeader ();
|
296
|
SendShopConfig ();
|
297
|
exit;
|
298
|
|
299
|
case 'update_tables':
|
300
|
|
301
|
UpdateTables ();
|
302
|
exit;
|
303
|
|
304
|
case 'send_log':
|
305
|
|
306
|
SendLog ();
|
307
|
exit;
|
308
|
|
309
|
default :
|
310
|
|
311
|
ShowHTMLMenu ();
|
312
|
exit;
|
313
|
|
314
|
} // End Case
|
315
|
} // End Method POST
|
316
|
else
|
317
|
{
|
318
|
if ($_SERVER['REQUEST_METHOD']=='POST')
|
319
|
{
|
320
|
switch ($_POST['action'])
|
321
|
{
|
322
|
case 'manufacturers_image_upload':
|
323
|
|
324
|
SendXMLHeader ();
|
325
|
ManufacturersImageUpload ();
|
326
|
exit;
|
327
|
|
328
|
case 'categories_image_upload':
|
329
|
|
330
|
SendXMLHeader ();
|
331
|
CategoriesImageUpload ();
|
332
|
exit;
|
333
|
|
334
|
case 'products_image_upload':
|
335
|
|
336
|
SendXMLHeader ();
|
337
|
ProductsImageUpload ();
|
338
|
exit;
|
339
|
|
340
|
case 'products_image_upload_med':
|
341
|
|
342
|
SendXMLHeader ();
|
343
|
ProductsImageUploadMed ();
|
344
|
exit;
|
345
|
|
346
|
case 'products_image_upload_large':
|
347
|
|
348
|
SendXMLHeader ();
|
349
|
ProductsImageUploadLarge ();
|
350
|
exit;
|
351
|
|
352
|
case 'manufacturers_update':
|
353
|
|
354
|
SendXMLHeader ();
|
355
|
ManufacturersUpdate ();
|
356
|
exit;
|
357
|
|
358
|
case 'manufacturers_erase':
|
359
|
|
360
|
SendXMLHeader ();
|
361
|
ManufacturersErase ();
|
362
|
exit;
|
363
|
|
364
|
case 'products_update':
|
365
|
|
366
|
SendXMLHeader ();
|
367
|
ProductsUpdate ();
|
368
|
exit;
|
369
|
|
370
|
case 'products_erase':
|
371
|
|
372
|
SendXMLHeader ();
|
373
|
ProductsErase ();
|
374
|
exit;
|
375
|
|
376
|
case 'products_specialprice_update':
|
377
|
|
378
|
SendXMLHeader ();
|
379
|
ProductsSpecialPriceUpdate ();
|
380
|
exit;
|
381
|
|
382
|
case 'products_specialprice_erase':
|
383
|
|
384
|
SendXMLHeader ();
|
385
|
ProductsSpecialPriceErase ();
|
386
|
exit;
|
387
|
|
388
|
case 'categories_update':
|
389
|
|
390
|
SendXMLHeader ();
|
391
|
CategoriesUpdate ();
|
392
|
exit;
|
393
|
|
394
|
case 'categories_erase':
|
395
|
|
396
|
SendXMLHeader ();
|
397
|
CategoriesErase ();
|
398
|
exit;
|
399
|
|
400
|
case 'prod2cat_update':
|
401
|
|
402
|
SendXMLHeader ();
|
403
|
Prod2CatUpdate ();
|
404
|
exit;
|
405
|
|
406
|
case 'prod2cat_erase':
|
407
|
|
408
|
SendXMLHeader ();
|
409
|
Prod2CatErase ();
|
410
|
exit;
|
411
|
|
412
|
case 'order_update':
|
413
|
|
414
|
SendXMLHeader ();
|
415
|
OrderUpdate ();
|
416
|
exit;
|
417
|
|
418
|
case 'customers_update':
|
419
|
|
420
|
SendXMLHeader ();
|
421
|
CustomersUpdate ();
|
422
|
exit;
|
423
|
|
424
|
case 'customers_erase':
|
425
|
|
426
|
SendXMLHeader ();
|
427
|
CustomersErase ();
|
428
|
exit;
|
429
|
|
430
|
case 'xsell_update':
|
431
|
|
432
|
SendXMLHeader ();
|
433
|
XsellUpdate ();
|
434
|
exit;
|
435
|
|
436
|
case 'xsell_erase':
|
437
|
|
438
|
SendXMLHeader ();
|
439
|
XsellErase ();
|
440
|
exit;
|
441
|
|
442
|
} // End Case
|
443
|
} // End Method POST
|
444
|
}
|
445
|
|
446
|
?>
|