include ADMINDIR . '/includes/query.php'; try { $feed = new feed(\query\main::get_option('feedserver_ID'), \query\main::get_option('feedserver_secret')); $ids = array(); foreach (\query\main::while_stores(array('max' => 0, 'show' => 'feed')) as $store) { $ids[] = $store->feedID; } $csuc = $cusuc = $cerr = $cuerr = 0; if (!empty($ids)) { $last_check = \query\main::get_option('lfeed_check'); /* UPDATE COUPONS */ if ((int) \query\main::get_option('feed_moddt') !== 0) { try { $coupons = $feed->coupons($options = array('store' => implode(',', array_values($ids)), 'update' => \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 (($couponi = admin_query::coupon_imported($coupon->ID)) && actions::edit_item2($couponi->ID, array('name' => $coupon->Title, 'link' => $coupon->URL, 'code' => $coupon->Code, 'description' => $coupon->Description, 'tags' => $coupon->Tags, 'start' => $coupon->Start_Date, 'end' => $coupon->End_Date))) { $cusuc++; } else { $cuerr++; } } usleep(500000); // let's put a break after every page, 500 000 microseconds. that means a half of a second }
echo '<a href="#" class="btn" onclick="window.history.go(-2)">' . $LANG['back'] . '</a>'; } } } break; /** LIST OF FEED COUPONS */ /** LIST OF FEED COUPONS */ case 'coupons': if (!ab_to(array('feed' => 'view'))) { die; } include 'includes/feed.php'; try { $feed = new feed(\query\main::get_option('feedserver_ID'), \query\main::get_option('feedserver_secret')); try { $coupons = $feed->coupons(array('page' => isset($_GET['page']) ? $_GET['page'] : 1, 'per_page' => 10, 'orderby' => isset($_GET['orderby']) ? $_GET['orderby'] : 'date desc', 'store' => isset($_GET['store']) ? $_GET['store'] : '', 'category' => isset($_GET['category']) ? $_GET['category'] : '', 'search' => isset($_GET['search']) ? $_GET['search'] : '')); echo '<div class="title"> <h2>' . $LANG['coupons_title'] . '</h2> <div style="float:right; margin: 0 2px 0 0;">'; if (ab_to(array('feed' => 'import'))) { echo '<a href="?route=feed.php&action=import" class="btn">' . $LANG['feed_icoupons'] . '</a>'; } echo '</div>'; if (!empty($LANG['feed_coupons_subtitle'])) { echo '<span>' . $LANG['feed_coupons_subtitle'] . '</span>'; } echo '</div>'; if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csrf']) && check_csrf($_POST['csrf'], 'pages_csrf')) { if (isset($_POST['delete'])) {