} } catch (Exception $e) { } } /* IMPORT COUPONS */ try { $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'view' => !isset($_GET['import_expired']) || $_GET['import_expired'] !== 'yes' ? 'active' : '', 'date' => \site\utils::timeconvert(date('Y-m-d, H:i:s', $last_check), $feed->timezone))); if (!empty($coupons['Count'])) { for ($cp = 1; $cp <= ceil($coupons['Count'] / 10); $cp++) { if ($cp != 1) { $coupons = $feed->coupons(array_merge(array('page' => $cp), $options)); } foreach ($coupons['List'] as $coupon) { if (!admin_query::coupon_imported($coupon->ID) && ($store = admin_query::store_imported($coupon->Store_ID)) && actions::add_item(array('feedID' => $coupon->ID, 'store' => $store->ID, 'category' => $store->catID, 'popular' => 0, 'exclusive' => 0, 'name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'cashback' => 0, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date, 'publish' => 1, 'meta_title' => '', 'meta_desc' => ''))) { $csuc++; } else { $cerr++; } } usleep(500000); // let's put a break after every page, 500 000 microseconds. that means a half of a second } } actions::set_option(array('lfeed_check' => time())); // update time for last feed check } catch (Exception $e) { } } // you can use $csuc, $cusuc, $cerr, $cuerr variables to create logs or something ...
<div class="options"> <a href="#" class="btn">' . $LANG['options'] . '</a> <ul> <li><a href="#" class="more_fields">' . $LANG['more'] . '</a></li> </ul> </div> <a href="?route=coupons.php&action=list" class="btn">' . $LANG['coupons_view'] . '</a> </div>'; if (!empty($LANG['coupons_add_subtitle'])) { echo '<span>' . $LANG['coupons_add_subtitle'] . '</span>'; } echo '</div>'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'coupons_csrf')) { if (isset($_POST['store']) && isset($_POST['category']) && isset($_POST['name']) && isset($_POST['code']) && isset($_POST['description']) && isset($_POST['tags']) && isset($_POST['reward_points']) && isset($_POST['start']) && isset($_POST['end']) && isset($_POST['meta_title']) && isset($_POST['meta_desc']) && isset($_POST['meta_title']) && isset($_POST['meta_desc'])) { if (actions::add_item(array('store' => $_POST['store'], 'category' => $_POST['category'], 'name' => $_POST['name'], 'link' => !isset($_POST['coupon_ownlink']) && isset($_POST['link']) && filter_var($_POST['link'], FILTER_VALIDATE_URL) ? $_POST['link'] : '', 'code' => $_POST['code'], 'description' => $_POST['description'], 'tags' => $_POST['tags'], 'cashback' => $_POST['reward_points'], 'start' => $_POST['start']['date'] . ', ' . $_POST['start']['hour'], 'end' => $_POST['end']['date'] . ', ' . $_POST['end']['hour'], 'popular' => isset($_POST['popular']) ? 1 : 0, 'exclusive' => isset($_POST['exclusive']) ? 1 : 0, 'publish' => isset($_POST['publish']) ? 1 : 0, 'meta_title' => $_POST['meta_title'], 'meta_desc' => $_POST['meta_desc']))) { echo '<div class="a-success">' . $LANG['msg_added'] . '</div>'; } else { echo '<div class="a-error">' . $LANG['msg_error'] . '</div>'; } } } $csrf = $_SESSION['coupons_csrf'] = \site\utils::str_random(10); echo '<div class="form-table"> <form action="#" method="POST" autocomplete="off"> <div class="row"><span>' . $LANG['form_store_id'] . ':</span><div data-search="store"><input type="text" name="store" value="' . (isset($_POST['store']) ? (int) $_POST['store'] : (!empty($_GET['store']) ? (int) $_GET['store'] : '')) . '" required /><a href="#">S</a></div></div> <div class="row"><span>' . $LANG['form_category'] . ':</span> <div><select name="category">