public function updateIdealo() { $tools = new tools(); $tools->AllNeeded(); $communication = new Communication($this->login); $count = count($this->update); $update = 0; $interval = $this->login['pagesize']; if ($count < $this->login['pagesize']) { $interval = $count; } while ($count > 0) { $tools->getXMLBegin($this->login['testmode']); for ($i = $update; $i < $update + $interval; $i++) { if ($this->update[$i]['event'] == 'DELETE') { $tools->deleteProductAtIdealo($this->update[$i]['product']); } else { $tools->getXML($this->update[$i]['product']); } } @$communication->sendRequest($tools->xml->saveXML()); $count = $count - $this->login['pagesize']; $update = $update + $this->login['pagesize']; } }
public function process($file) { if (isset($_POST['sendIdealoMail'])) { $this->sendMail(); } $tools = new tools(); $this->login = $tools->getLogin(); $communication = new Communication($this->login); if ($this->saveSetting()) { @xtc_set_time_limit(0); $tools->cleanTableIdealoRealtimeUpdate(); $tools->cleanTableIdealoRealtimeFailedRequest(); $tools->cleanTestFile(); $tools->AllNeeded(); $this->login = $tools->getLogin(); $xml = ''; try { if ($this->login['testmode'] != '1') { if (isset($_POST['hardReset'])) { if ($_POST['hardReset'] == 'on') { $communication->deleteAllFromIdealo(); } else { $this->cleanIdealo(); } } else { $this->cleanIdealo(); } } } catch (Exception $e) { } if ($this->login['status'] == 'True') { $xml = ''; $tools->newTimestamp(); $communication = new Communication($this->login); $artikel_start = 0; $article_count = xtc_db_query("SELECT count(*) FROM `products`;"); $article_count = xtc_db_fetch_array($article_count); $article_count = $article_count['count(*)']; $repetition = 0; if ($article_count > 0) { if ($article_count <= $this->login['pagesize']) { $repetition = 1; } else { $repetition = ceil($article_count / $this->login['pagesize']); } } for ($i = 1; $i <= $repetition; $i++) { $artikel = $this->getArtikelID($artikel_start, $this->login['pagesize']); $xml = $tools->getXMLBegin($this->login['testmode']); foreach ($artikel as $art) { $xml .= $tools->getXML($art); } $xml .= $tools->getXMLEnd(); if (strpos($xml, '<offer>') !== false) { @$communication->sendRequest($xml); } $artikel_start = $artikel_start + $this->login['pagesize']; } if ($this->login['testmode'] == '1') { $this->backToBackend(substr($_SERVER['PHP_SELF'], 0, -24)); die; } } } else { $this->backToBackendFailed(); die; } }