private function sendFailedRequests() { $communication = new Communication($this->login); $sql = "SELECT * FROM `" . IDEALO_REQUEST_ERROR_TABLE . "`;"; $error_requests = xtc_db_query($sql); while ($error_request = xtc_db_fetch_array($error_requests)) { $this->send_failed_request = true; @$communication->sendRequest($error_request['xml'], false, $error_request['id']); } }
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; } }