Blame | Letzte Änderung | Log anzeigen | RSS feed
<?/*--------*//* PREFIX *//*--------*/// forget about any script timeoutsset_time_limit(0);define ("ITEMTYPES_AUCTION", 1);define ("CURRENCYENUM_USDOLLAR", 1);define ("CURRENCYENUM_EURO", 7);define ("SHIPPINGRANGEENUM_SITEONLY", '0');require_once "/web/apache/content-management/ebayphpat/Ebay_ItemSellerQuery.php";require_once "/web/apache/content-management/Online-Shop/eBay/system/loadConf.php";/*------------------*//* Function AddItem *//*------------------*/global $theItem;$theItem = null;function AddItem($session,$ItemData){global $theItem;$theItem = new Ebay_Item($session);// Versandoptionen// müssen vor "Daten zusammenstellen" stehen!if ($ItemData[VersandCarrier] > 0){// Versandoptionen erlauben$theItem->setCheckoutSpecified(true);// Flat shipping rate$theItem->setCheckoutShippingType(1);// shippingOptions$shipOption = new Ebay_ShippingServiceOption();$shipOption->setCarrier($ItemData[VersandCarrier]);$shipOption->setPriority(1);$shipOption->setCost($ItemData[VersandCost]);//$shipOption->setAdditionalCost('');$theItem->setShippingServiceOption($shipOption);}unset($ItemData[VersandCarrier]);unset($ItemData[VersandCost]);// Fixed Price Korrekturif(($ItemData[StartPrice] == 0)&&($ItemData[BuyItNowPrice] > 0)){$ItemData[StartPrice] = $ItemData[BuyItNowPrice];$ItemData[BuyItNowPrice]='';$theItem->setPropType(9);}// Daten zusammenstellenforeach(array_keys($ItemData) as $elem){if ($ItemData[$elem]){$theItem->{"set".$elem}($ItemData[$elem]);}}// Daten abschicken und Ergebnis zurückliefernreturn $theItem->Add();}/*-----------------------------------------*//* Verbindung mit Datenbank(en) herstellen *//* Alle im Array angegebenen Datenbanken *//* abarbeiten *//*-----------------------------------------*/mysql_connect("127.0.0.1:3306","content_managem","k-dp-u");foreach(array("mediaran_de","online_redaktionstool_de")as $DB){mysql_query("use $DB");/*------------------------------------------------*//* Settings aus der Datenbank.eBay_settings laden *//* Settings in $settings, conf-Einträge in $conf *//* speichern. *//*------------------------------------------------*/$query="selectName,Inhalt,TypfromeBay_settingswhereName = 'pictureURLpfad'or Name = 'pictureURLfeld'or Typ = 'confDatei'";$result=mysql_query($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");$settings=array();while ($zeile=mysql_fetch_assoc($result)){if ($zeile[Typ] == "confDatei"){$conf[$zeile[Name]]=$zeile[Inhalt];}else{$settings[$zeile[Name]]=$zeile[Inhalt];}}/*----------------------------------------------------*//* In den Settings stehen alle möglichen conf-Dateien *//* Für jede conf-Einstellung eine Session erstellen. *//*----------------------------------------------------*/foreach(array_keys($conf) as $Name){$Sessions[$Name] = new Ebay_Session();$Sessions[$Name]->InitFromConfig($conf[$Name]);}/*---------------------*//* Auktionsdaten laden *//*---------------------*/$query="selecteBay_Auktionen.ID,eBay_Auktionen.Title as Title,eBay_Auktionen.Description as Description,eBay_Auktionen.Category as CategoryId,eBay_Auktionen.Quantity as Quantity,eBay_Auktionen.MinimumBid as StartPrice,if (eBay_Auktionen.BuyItNowPrice > 0,eBay_Auktionen.BuyItNowPrice,'') as BuyItNowPrice,eBay_Auktionen.SubtitleText as SubtitleText,eBay_Auktionen.Category2 as Category2Id,eBay_Auktionen.Duration as Duration,eBay_Auktionen.Private as PropPrivate,'true' as PaymentTermsSeeDescription,if (eBay_Auktionen.Gallery = '','','true') as PropGallery,if (eBay_Auktionen.Featured = '','','true') as PropFeatured,if (eBay_Auktionen.BoldTitle = '','','true') as PropBoldTitle,if (eBay_Auktionen.HighLight = '','','true') as PropHighLight,eBay_Auktionen.Gallery as GalleryURL,eBay_Auktionen.Gallery as PictureURL,0 as ReservePrice,confDatei,eBay_Auktionen.VersandCarrier,eBay_Auktionen.VersandCostfromeBay_Auktionen,artikelwhereeBay_Auktionen.artikel_ID = artikel.IDandartikel.Language='DE'andeBay_Id = 0andeBay_error = ''andListingStartDay <= NOW()andListingStartTime <= NOW()";$result=mysql_query($query) or die (mysql_errno().": ".mysql_error()."<hr>$query<hr>");while ($AuktionsData=mysql_fetch_assoc($result)){$zeile=array_merge(loadConf($conf[$AuktionsData[confDatei]]),$settings,$AuktionsData);unset($zeile[ID]);unset($zeile[pictureURLpfad]);unset($zeile[pictureURLfeld]);$mySession=$Sessions[$zeile[confDatei]];unset($zeile[confDatei]);$eBayRes=AddItem($mySession,$zeile);if ($eBayRes->isGood()){$names=array();$values=array();foreach($eBayRes->_xmlValues as $elem){if ($elem[type] == "complete"){if(in_array($elem[tag],array("Id","EBayTime","StartTime","EndTime","ListingFee","CurrencyId"))){$names[]=$elem[tag];$values[]=$elem[value];}}}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");}mysql_query ("update eBay_Auktionen set eBay_Id=".$theItem->getId()." where ID = ".$AuktionsData[ID]);mysql_query ("update eBay_Auktionen set eBay_error='".serialize($eBayRes->_errors)."' where ID = ".$AuktionsData[ID]);}}?>