%PDF- %PDF-
Direktori : /proc/309157/root/home/waritko/import-presta/import/ |
Current File : //proc/309157/root/home/waritko/import-presta/import/heureka_stara.php |
<?php //include "dibi.phar"; include "dibi.min.php"; dibi::connect(array( 'driver' => 'mysqli', 'host' => 'localhost', 'username' => 'knih_monami', 'password' => '3rXPmAgcqFPK', 'database' => 'knih_monami', 'charset' => 'utf8', )); $result = dibi::query("SELECT [identif], [nazev], [autor], [anotace], [obrazek], [cena], [ean], [isbn], [id_ktg] FROM [katalog] WHERE [jazyk]='CZE' AND [zobraz]='Y' AND [cena]>80"); function dejMiZkurvenouAnotaci($a) { if(strripos($a, ".aspx?") === FALSE) { return $a; } else { $redis = new Redis(); $redis->pconnect('127.0.0.1'); $redis->select(2); $i = 0; $retezec = $redis->get($a); while(!$retezec && $i++ < 3) { $zdroj = file("http://pemic-books.cz/ASPX/".$a); $retezec = join("", $zdroj); $redis->setEx($a, 3600 * 24 * 365, $retezec); } return $retezec; } } function fuckingImage($i) { if(substr($i, 0, 4) === "http") { return "https://www.knihkupectvi-monami.cz/imgGen.php?href=".urlencode($i)."&size=orig"; } return "http://img.pemic.cz/sortimg/".$i; } function category($c) { switch ($c) { case 15: return 'Filmy, knihy, hry | Mapy a průvodci'; case 14: return 'Filmy, knihy, hry | Kalendáře'; case 16: return 'Filmy, knihy, hry | Hudba'; case 11: return 'Filmy, knihy, hry | Učebnice'; case 17: return 'Filmy, knihy, hry | Filmy'; default: return 'Filmy, knihy, hry | Knihy'; } } header("Content-Type: text/xml"); echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <SHOP> <?php foreach($result as $res) { ?><SHOPITEM> <ITEM_ID><?php echo md5($res->identif); ?></ITEM_ID> <PRODUCTNAME><?php echo htmlentities($res->nazev, ENT_XML1, 'UTF-8'); ?> | <?php echo htmlentities($res->autor, ENT_XML1, 'UTF-8'); ?></PRODUCTNAME> <PRODUCT><?php echo htmlentities($res->nazev, ENT_XML1, 'UTF-8'); ?> | <?php echo htmlentities($res->autor, ENT_XML1, 'UTF-8'); ?></PRODUCT> <DESCRIPTION><?php echo htmlentities(dejMiZkurvenouAnotaci($res->anotace), ENT_XML1, 'UTF-8'); ?></DESCRIPTION> <URL>https://www.knihkupectvi-monami.cz/detail-zbozi/<?php echo htmlentities($res->identif, ENT_XML1, 'UTF-8'); ?>/</URL> <IMGURL><?php echo fuckingImage($res->obrazek); ?></IMGURL> <PRICE_VAT><?php echo $res->cena; ?></PRICE_VAT> <CATEGORYTEXT><?php echo category($res->id_ktg); ?></CATEGORYTEXT> <EAN><?php echo $res->ean; ?></EAN> <ISBN><?php echo $res->isbn; ?></ISBN> <DELIVERY_DATE>6</DELIVERY_DATE> <DELIVERY> <DELIVERY_ID>CESKA_POSTA</DELIVERY_ID> <DELIVERY_PRICE>120</DELIVERY_PRICE> <DELIVERY_PRICE_COD>120</DELIVERY_PRICE_COD> </DELIVERY> <ITEMGROUP_ID><?php echo md5($res->identif); ?></ITEMGROUP_ID> </SHOPITEM> <?php } ?> </SHOP>