// End iDevAffiliate Tracking
    if (isset($_COOKIE['ap_id']) && $_COOKIE['ap_id']) {
        setcookie('ap_id', $referrer, time() - 3600, "/");
        unset($_COOKIE['ap_id']);
    }
    Cart66Session::drop('app_id');
}
if (isset($_GET['duid'])) {
    $duid = $_GET['duid'];
    $product = new Cart66Product();
    if ($product->loadByDuid($duid)) {
        $okToDownload = true;
        if ($product->download_limit > 0) {
            // Check if download limit has been exceeded
            $order_item_id = $product->loadItemIdByDuid($duid);
            if ($product->countDownloadsForDuid($duid, $order_item_id) >= $product->download_limit) {
                $okToDownload = false;
            }
        }
        if ($okToDownload) {
            $data = array('duid' => $duid, 'downloaded_on' => date('Y-m-d H:i:s'), 'ip' => $_SERVER['REMOTE_ADDR'], 'order_item_id' => $product->loadItemIdByDuid($duid));
            $downloadsTable = Cart66Common::getTableName('downloads');
            $wpdb->insert($downloadsTable, $data, array('%s', '%s', '%s', '%s'));
            $setting = new Cart66Setting();
            if (!empty($product->s3Bucket) && !empty($product->s3File)) {
                require_once CART66_PATH . '/models/Cart66AmazonS3.php';
                $link = Cart66AmazonS3::prepareS3Url($product->s3Bucket, $product->s3File, '1 minute');
                wp_redirect($link);
                exit;
            } else {
                $dir = Cart66Setting::getValue('product_folder');
Esempio n. 2
0
?>
          <?php 
if ($hasDigital) {
    ?>
      <tr>
        <td valign="top">
            <br /><?php 
    _e('Downloads', 'cart66');
    ?>
:<br />
            <?php 
    $product = new Cart66Product();
    foreach ($order->getItems() as $downloadItem) {
        if ($product->loadByDuid($downloadItem->duid) && $product->isDigital()) {
            $order_item_id = $product->loadItemIdByDuid($downloadItem->duid);
            $downloadTimes = $product->countDownloadsForDuid($downloadItem->duid, $order_item_id);
            ?>
                  <em><?php 
            echo $product->name;
            ?>
: <?php 
            echo $downloadTimes;
            ?>
 <?php 
            _e('out of', 'cart66');
            ?>
 <?php 
            echo $product->download_limit == 0 ? __('unlimited', 'cart66') : $product->download_limit;
            ?>
</em>
                  <form id="ResetDownloads" action="" method='post' class="remove_tracking">