Skip to content

Commit

Permalink
Merge pull request #2 from php-schubser/master
Browse files Browse the repository at this point in the history
fix: timeout error
  • Loading branch information
php-schubser authored Jan 24, 2022
2 parents 5cf3cd5 + d556408 commit 93cf6c0
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions new_files/interface/fs_cleverreach_interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
require '../includes/application_top_export.php';
require '../inc/xtc_not_null.inc.php';
require '../inc/xtc_get_country_name.inc.php';
require '../inc/xtc_href_link.inc.php';
session_start();

if (!isset($_SESSION['cleacerreach_interface_counter'])) {
$_SESSION['cleacerreach_interface_counter'] = 1;
}

if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_STATUS') || MODULE_FS_CLEVERREACH_INTERFACE_STATUS != 'true')
{
Expand Down Expand Up @@ -43,6 +49,15 @@

$receivers = array();

$where_limit = '';
$where_offset = '';
if (isset($_SESSION['cleacerreach_interface_counter'])) {
$where_limit .= ' LIMIT 100 ';
if ($_SESSION['cleacerreach_interface_counter'] > 1) {
$where_offset .= ' OFFSET ' . ($_SESSION['cleacerreach_interface_counter'] - 1) * 100 . ' ';
}
}

if (MODULE_FS_CLEVERREACH_INTERFACE_IMPORT_SUBSCRIBERS == 'true') {


Expand All @@ -52,7 +67,7 @@
date_added as registered,
customers_firstname as firstname,
customers_lastname as lastname
FROM " . TABLE_NEWSLETTER_RECIPIENTS . " WHERE mail_status = '1' ");
FROM " . TABLE_NEWSLETTER_RECIPIENTS . " WHERE mail_status = '1' " . $where_limit . $where_offset);

while ($customer = xtc_db_fetch_array($manual_registered_customers)) {
$orders = array();
Expand Down Expand Up @@ -99,7 +114,7 @@
if (isset($_GET['export_filter_amazon']) && $_GET['export_filter_amazon'] == 1) {
$where_clause .= " AND customers_email_address NOT LIKE '%@marketplace.amazon.de%'";
}
$order_rows = xtc_db_query("SELECT DISTINCT o.orders_id, o.customers_id, o.customers_email_address as email, o.customers_firstname as firstname, o.customers_lastname as lastname, o.customers_gender as gender, o.customers_street_address as street, o.customers_city as city, o.customers_postcode as zip, o.customers_country as country, o.date_purchased, op.products_id, op.products_name, op.products_price, op.products_quantity from " . TABLE_ORDERS . " o JOIN " . TABLE_ORDERS_PRODUCTS . " op ON o.orders_id = op.orders_id GROUP BY o.customers_id ORDER BY o.date_purchased ");
$order_rows = xtc_db_query("SELECT DISTINCT o.orders_id, o.customers_id, o.customers_email_address as email, o.customers_firstname as firstname, o.customers_lastname as lastname, o.customers_gender as gender, o.customers_street_address as street, o.customers_city as city, o.customers_postcode as zip, o.customers_country as country, o.date_purchased, op.products_id, op.products_name, op.products_price, op.products_quantity from " . TABLE_ORDERS . " o JOIN " . TABLE_ORDERS_PRODUCTS . " op ON o.orders_id = op.orders_id GROUP BY o.customers_id ORDER BY o.date_purchased " . $where_limit . $where_offset);
while ($order_row = xtc_db_fetch_array($order_rows)) {

$orders = array();
Expand Down Expand Up @@ -153,7 +168,15 @@
} else {
die('Keine neuen Daten gefunden');
}

if (count($receivers) == 100) {
$_SESSION['cleacerreach_interface_counter'] = $_SESSION['cleacerreach_interface_counter'] + 1;
header("Refresh:1;");
exit;
}

$receivers = array();

header('Location: ' . preg_replace("/[\r\n]+(.*)$/i", "", html_entity_decode($_SERVER['HTTP_REFERER'])));
unset($_SESSION['cleacerreach_interface_counter']);
header('Location: ' . xtc_href_link_admin((defined('DIR_ADMIN') ? DIR_ADMIN : 'admin/').'module_export.php', 'set=system&module=fs_cleverreach_interface&action=edit', 'NONSSL'));
exit();

0 comments on commit 93cf6c0

Please sign in to comment.