[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/includes/modules/ -> downloads.php (source)

   1  <?php
   2  /*
   3    $Id: downloads.php,v 1.3 2003/06/09 22:49:58 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  ?>
  13  <!-- downloads //-->
  14  <?php
  15    if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
  16  // Get last order id for checkout_success
  17      $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by orders_id desc limit 1");
  18      $orders = tep_db_fetch_array($orders_query);
  19      $last_order = $orders['orders_id'];
  20    } else {
  21      $last_order = $HTTP_GET_VARS['order_id'];
  22    }
  23  
  24  // Now get all downloadable products in that order
  25    $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");
  26    if (tep_db_num_rows($downloads_query) > 0) {
  27  ?>
  28        <tr>
  29          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  30        </tr>
  31        <tr>
  32          <td class="main"><b><?php echo HEADING_DOWNLOAD; ?></b></td>
  33        </tr>
  34        <tr>
  35          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  36        </tr>
  37        <tr>
  38          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  39  <!-- list of products -->
  40  <?php
  41      while ($downloads = tep_db_fetch_array($downloads_query)) {
  42  // MySQL 3.22 does not have INTERVAL
  43        list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
  44        $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);
  45        $download_expiry = date('Y-m-d H:i:s', $download_timestamp);
  46  ?>
  47            <tr class="infoBoxContents">
  48  <!-- left box -->
  49  <?php
  50  // The link will appear only if:
  51  // - Download remaining count is > 0, AND
  52  // - The file is present in the DOWNLOAD directory, AND EITHER
  53  // - No expiry date is enforced (maxdays == 0), OR
  54  // - The expiry date is not reached
  55        if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
  56          echo '            <td class="main"><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "\n";
  57        } else {
  58          echo '            <td class="main">' . $downloads['products_name'] . '</td>' . "\n";
  59        }
  60  ?>
  61  <!-- right box -->
  62  <?php
  63        echo '            <td class="main">' . TABLE_HEADING_DOWNLOAD_DATE . tep_date_long($download_expiry) . '</td>' . "\n" .
  64             '            <td class="main" align="right">' . $downloads['download_count'] . TABLE_HEADING_DOWNLOAD_COUNT . '</td>' . "\n" .
  65             '          </tr>' . "\n";
  66      }
  67  ?>
  68            </tr>
  69          </table></td>
  70        </tr>
  71  <?php
  72      if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {
  73  ?>
  74        <tr>
  75          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  76        </tr>
  77        <tr>
  78          <td class="smalltext" colspan="4"><p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p></td>
  79        </tr>
  80  <?php
  81      }
  82    }
  83  ?>
  84  <!-- downloads_eof //-->


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics