| 1 |
lars |
1 |
<?
|
|
|
2 |
/*--------*/
|
|
|
3 |
/* PREFIX */
|
|
|
4 |
/*--------*/
|
|
|
5 |
|
|
|
6 |
// forget about any script timeouts
|
|
|
7 |
set_time_limit(0);
|
|
|
8 |
|
|
|
9 |
define ("ITEMTYPES_AUCTION", 1);
|
|
|
10 |
define ("CURRENCYENUM_USDOLLAR", 1);
|
|
|
11 |
define ("CURRENCYENUM_EURO", 7);
|
|
|
12 |
define ("SHIPPINGRANGEENUM_SITEONLY", '0');
|
|
|
13 |
|
|
|
14 |
require_once "/web/apache/content-management/ebayphpat/Ebay_ItemSellerQuery.php";
|
|
|
15 |
require_once "/web/apache/content-management/Online-Shop/eBay/system/loadConf.php";
|
|
|
16 |
|
|
|
17 |
/*------------------*/
|
|
|
18 |
/* Function AddItem */
|
|
|
19 |
/*------------------*/
|
|
|
20 |
|
|
|
21 |
global $theItem;
|
|
|
22 |
$theItem = null;
|
|
|
23 |
|
|
|
24 |
function AddItem($session,$ItemData)
|
|
|
25 |
{
|
|
|
26 |
global $theItem;
|
|
|
27 |
$theItem = new Ebay_Item($session);
|
|
|
28 |
|
|
|
29 |
if
|
|
|
30 |
(
|
|
|
31 |
($ItemData[StartPrice] == 0)
|
|
|
32 |
&&
|
|
|
33 |
($ItemData[BuyItNowPrice] > 0)
|
|
|
34 |
)
|
|
|
35 |
{
|
|
|
36 |
$ItemData[StartPrice] = $ItemData[BuyItNowPrice];
|
|
|
37 |
$ItemData[BuyItNowPrice]='';
|
|
|
38 |
$theItem->setPropType(9);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
foreach(array_keys($ItemData) as $elem)
|
|
|
42 |
{
|
|
|
43 |
if ($ItemData[$elem])
|
|
|
44 |
{
|
|
|
45 |
$theItem->{"set".$elem}($ItemData[$elem]);
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
return $theItem->Add();
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
/*-----------------------------------------*/
|
|
|
52 |
/* Verbindung mit Datenbank(en) herstellen */
|
|
|
53 |
/* Alle im Array angegebenen Datenbanken */
|
|
|
54 |
/* abarbeiten */
|
|
|
55 |
/*-----------------------------------------*/
|
|
|
56 |
|
|
|
57 |
mysql_connect("localhost","content_managem","k-dp-u");
|
|
|
58 |
foreach
|
|
|
59 |
(
|
|
|
60 |
array
|
|
|
61 |
(
|
|
|
62 |
"mediaran_de",
|
|
|
63 |
"online_redaktionstool_de"
|
|
|
64 |
)
|
|
|
65 |
as $DB
|
|
|
66 |
)
|
|
|
67 |
{
|
|
|
68 |
mysql_query("use $DB");
|
|
|
69 |
|
|
|
70 |
/*------------------------------------------------*/
|
|
|
71 |
/* Settings aus der Datenbank.eBay_settings laden */
|
|
|
72 |
/* Settings in $settings, conf-Einträge in $conf */
|
|
|
73 |
/* speichern. */
|
|
|
74 |
/*------------------------------------------------*/
|
|
|
75 |
|
|
|
76 |
$query=
|
|
|
77 |
"
|
|
|
78 |
select
|
|
|
79 |
Name,
|
|
|
80 |
Inhalt,
|
|
|
81 |
Typ
|
|
|
82 |
from
|
|
|
83 |
eBay_settings
|
|
|
84 |
where
|
|
|
85 |
Name = 'pictureURLpfad'
|
|
|
86 |
or Name = 'pictureURLfeld'
|
|
|
87 |
or Typ = 'confDatei'
|
|
|
88 |
";
|
|
|
89 |
$result=mysql_query($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
|
|
|
90 |
$settings=array();
|
|
|
91 |
while ($zeile=mysql_fetch_assoc($result))
|
|
|
92 |
{
|
|
|
93 |
if ($zeile[Typ] == "confDatei")
|
|
|
94 |
{
|
|
|
95 |
$conf[$zeile[Name]]=$zeile[Inhalt];
|
|
|
96 |
}
|
|
|
97 |
else
|
|
|
98 |
{
|
|
|
99 |
$settings[$zeile[Name]]=$zeile[Inhalt];
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
/*----------------------------------------------------*/
|
|
|
104 |
/* In den Settings stehen alle möglichen conf-Dateien */
|
|
|
105 |
/* Für jede conf-Einstellung eine Session erstellen. */
|
|
|
106 |
/*----------------------------------------------------*/
|
|
|
107 |
|
|
|
108 |
foreach(array_keys($conf) as $Name)
|
|
|
109 |
{
|
|
|
110 |
$Sessions[$Name] = new Ebay_Session();
|
|
|
111 |
$Sessions[$Name]->InitFromConfig($conf[$Name]);
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
/*---------------------*/
|
|
|
115 |
/* Auktionsdaten laden */
|
|
|
116 |
/*---------------------*/
|
|
|
117 |
|
|
|
118 |
$query=
|
|
|
119 |
"
|
|
|
120 |
select
|
|
|
121 |
eBay_Auktionen.ID,
|
|
|
122 |
eBay_Auktionen.Title as Title,
|
|
|
123 |
eBay_Auktionen.Description as Description,
|
|
|
124 |
eBay_Auktionen.Category as CategoryId,
|
|
|
125 |
eBay_Auktionen.Quantity as Quantity,
|
|
|
126 |
eBay_Auktionen.MinimumBid as StartPrice,
|
|
|
127 |
if (eBay_Auktionen.BuyItNowPrice > 0,eBay_Auktionen.BuyItNowPrice,'') as BuyItNowPrice,
|
|
|
128 |
eBay_Auktionen.SubtitleText as SubtitleText,
|
|
|
129 |
eBay_Auktionen.Category2 as Category2Id,
|
|
|
130 |
eBay_Auktionen.Duration as Duration,
|
|
|
131 |
eBay_Auktionen.Private as PropPrivate,
|
|
|
132 |
'true' as PaymentTermsSeeDescription,
|
|
|
133 |
if (eBay_Auktionen.Gallery = '','','true') as PropGallery,
|
|
|
134 |
if (eBay_Auktionen.Featured = '','','true') as PropFeatured,
|
|
|
135 |
if (eBay_Auktionen.BoldTitle = '','','true') as PropBoldTitle,
|
|
|
136 |
if (eBay_Auktionen.HighLight = '','','true') as PropHighLight,
|
|
|
137 |
eBay_Auktionen.Gallery as GalleryURL,
|
|
|
138 |
concat('".$settings[pictureURLpfad]."',".$settings[pictureURLfeld].") as PictureURL,
|
|
|
139 |
|
|
|
140 |
confDatei
|
|
|
141 |
from
|
|
|
142 |
eBay_Auktionen,artikel
|
|
|
143 |
where
|
|
|
144 |
eBay_Auktionen.artikel_ID = artikel.ID
|
|
|
145 |
and
|
|
|
146 |
artikel.Language='DE'
|
|
|
147 |
and
|
|
|
148 |
eBay_Id = 0
|
|
|
149 |
and
|
|
|
150 |
eBay_error = ''
|
|
|
151 |
and
|
|
|
152 |
ListingStartDay <= NOW()
|
|
|
153 |
and
|
|
|
154 |
ListingStartTime <= NOW()
|
|
|
155 |
";
|
|
|
156 |
|
|
|
157 |
$result=mysql_query($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");
|
|
|
158 |
|
|
|
159 |
while ($AuktionsData=mysql_fetch_assoc($result))
|
|
|
160 |
{
|
|
|
161 |
$zeile=array_merge(loadConf($conf[$AuktionsData[confDatei]]),$settings,$AuktionsData);
|
|
|
162 |
|
|
|
163 |
unset($zeile[ID]);
|
|
|
164 |
unset($zeile[pictureURLpfad]);
|
|
|
165 |
unset($zeile[pictureURLfeld]);
|
|
|
166 |
|
|
|
167 |
$mySession=$Sessions[$zeile[confDatei]];
|
|
|
168 |
unset($zeile[confDatei]);
|
|
|
169 |
|
|
|
170 |
$eBayRes=AddItem($mySession,$zeile);
|
|
|
171 |
|
|
|
172 |
if ($eBayRes->isGood())
|
|
|
173 |
{
|
|
|
174 |
$names=array();
|
|
|
175 |
$values=array();
|
|
|
176 |
foreach($eBayRes->_xmlValues as $elem)
|
|
|
177 |
{
|
|
|
178 |
if ($elem[type] == "complete")
|
|
|
179 |
{
|
|
|
180 |
$names[]=$elem[tag];
|
|
|
181 |
$values[]=$elem[value];
|
|
|
182 |
}
|
|
|
183 |
}
|
|
|
184 |
mysql_query("insert into eBay_AuktionsDaten (".implode(",",$names).") values ('".implode("','",$values)."')") or mail("lautsch@weban.de","eBay runQueue: Fehler bei insert into insert into eBay_AuktionsDaten",mysql_errno().": ".mysql_error(),"from: runQueue");
|
|
|
185 |
}
|
|
|
186 |
mysql_query ("update eBay_Auktionen set eBay_Id=".$theItem->getId()." where ID = ".$AuktionsData[ID]);
|
|
|
187 |
mysql_query ("update eBay_Auktionen set eBay_error='".serialize($eBayRes->_errors)."' where ID = ".$AuktionsData[ID]);
|
|
|
188 |
}
|
|
|
189 |
}
|
|
|
190 |
?>
|