[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 downloads_manager.php

Zen Cart 源代码 downloads_manager.php




下载文件

文件名: downloads_manager.php
文件类型: PHP文件
文件大小: 16.04 KiB
MD5: 14a238a74397d805e0a6821a6998d897

downloads_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2010 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: downloads_manager.php 17534 2010-09-08 19:50:34Z wilt $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   require(DIR_WS_CLASSES . 'currencies.php');
  13.   $currencies = new currencies();
  14.  
  15.   $languages = zen_get_languages();
  16.  
  17.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  18.  
  19.   if (zen_not_null($action)) {
  20.     switch ($action) {
  21.       case 'insert':
  22.       case 'save':
  23.         $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_filename='" . zen_db_prepare_input($_POST['products_attributes_filename']) . "', products_attributes_maxdays='" . zen_db_prepare_input($_POST['products_attributes_maxdays']) . "', products_attributes_maxcount='" . zen_db_prepare_input($_POST['products_attributes_maxcount']) . "' where products_attributes_id='" . $_GET['padID'] . "'");
  24.         zen_redirect(zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . $_GET['padID'] . '&page=' . $_GET['page']));
  25.         break;
  26.     }
  27.   }
  28.  
  29. ?>
  30. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  31. <html <?php echo HTML_PARAMS; ?>>
  32. <head>
  33. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  34. <title><?php echo TITLE; ?></title>
  35. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  36. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  37. <script language="javascript" src="includes/menu.js"></script>
  38. <script language="javascript" src="includes/general.js"></script>
  39. <script language="javascript"><!--
  40. function go_option() {
  41.   if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
  42.     location = "<?php echo zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'option_page=' . ($_GET['option_page'] ? $_GET['option_page'] : 1)); ?>&option_order_by="+document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value;
  43.   }
  44. }
  45. //--></script>
  46. <script type="text/javascript">
  47.   <!--
  48.   function init()
  49.   {
  50.     cssjsmenu('navbar');
  51.     if (document.getElementById)
  52.     {
  53.       var kill = document.getElementById('hoverJS');
  54.       kill.disabled = true;
  55.     }
  56.   }
  57.   // -->
  58. </script>
  59. </head>
  60. <!-- <body onload="init()"> -->
  61. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
  62. <!-- header //-->
  63. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  64. <!-- header_eof //-->
  65.  
  66. <!-- body //-->
  67. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  68.   <tr>
  69. <!-- body_text //-->
  70.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  71.       <tr>
  72.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  73.          <tr><?php echo zen_draw_form('search', FILENAME_DOWNLOADS_MANAGER, '', 'get'); ?>
  74.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  75.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
  76.             <td class="smallText" align="right">
  77. <?php
  78. // show reset search
  79.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  80.     echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
  81.   }
  82.   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
  83.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  84.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  85.     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  86.   }
  87. ?>
  88.             </td>
  89.           </form></tr>
  90.         </table></td>
  91.       </tr>
  92.  
  93.       <tr>
  94.         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  95.           <tr>
  96.             <td class="smallText" align="center">
  97.               <?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif') . TEXT_INFO_FILENAME_MISSING; ?> &nbsp;&nbsp;&nbsp;<?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . TEXT_INFO_FILENAME_GOOD; ?>
  98.             </td>
  99.           </tr>
  100.         </table></td>
  101.       </tr>
  102.  
  103. <!-- downloads by product_name//-->
  104.       <tr>
  105.         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  106.           <tr>
  107.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  108.  
  109.               <tr class="dataTableHeadingRow">
  110.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ATTRIBUTES_ID; ?></td>
  111.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_ID; ?></td>
  112.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT; ?></td>
  113.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODEL; ?></td>
  114.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_OPT_NAME; ?></td>
  115.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_OPT_VALUE; ?></td>
  116.                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_FILENAME; ?></td>
  117.                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
  118.                 <td class="dataTableHeadingContent"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
  119.                 <td class="dataTableHeadingContent">&nbsp;</td>
  120.               </tr>
  121.  
  122. <?php
  123. // create search filter
  124.   $search = '';
  125.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  126.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  127.     $search = " and pd.products_name like '%" . $keywords . "%' or pad.products_attributes_filename like '%" . $keywords . "%' or pd.products_description like '%" . $keywords . "%' or p.products_model like '%" . $keywords . "%'";
  128.   }
  129.  
  130. // order of display
  131.   $order_by = " order by pd.products_name ";
  132.  
  133. // create split page control
  134.   $products_downloads_query_raw = ("select pad.*, pa.*, pd.*, p.* from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa on pad.products_attributes_id = pa.products_attributes_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id ='" . (int)$_SESSION['languages_id'] . "' left join " . TABLE_PRODUCTS . " p on p.products_id= pd.products_id " . " where pa.products_attributes_id = pad.products_attributes_id" . $search . $order_by);
  135.   $products_downloads_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, $products_downloads_query_raw, $products_downloads_query_numrows);
  136.   $products_downloads_query = $db->Execute($products_downloads_query_raw);
  137.  
  138.   while (!$products_downloads_query->EOF) {
  139.  
  140.     if ((!isset($_GET['padID']) || (isset($_GET['padID']) && ($_GET['padID'] == $products_downloads_query->fields['products_attributes_id']))) && !isset($padInfo)) {
  141.       $padInfo_array = $products_downloads_query->fields;
  142.       $padInfo = new objectInfo($padInfo_array);
  143.     }
  144.  
  145. // Moved to /admin/includes/configure.php
  146.   if (!defined('DIR_FS_DOWNLOAD')) define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  147.  
  148.   $filename_is_missing='';
  149.   if ( !file_exists(DIR_FS_DOWNLOAD . $products_downloads_query->fields['products_attributes_filename']) ) {
  150.     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
  151.   } else {
  152.     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
  153.   }
  154. ?>
  155. <?php
  156.       if (isset($padInfo) && is_object($padInfo) && ($products_downloads_query->fields['products_attributes_id'] == $padInfo->products_attributes_id)) {
  157.         echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&action=edit' . '&page=' . $_GET['page']) . '\'">' . "\n";
  158.       } else {
  159.         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID')) . 'padID=' . $products_downloads_query->fields['products_attributes_id'] . '&page=' . $_GET['page']) . '\'">' . "\n";
  160.       }
  161. ?>
  162.  
  163.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_id']; ?></td>
  164.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_id']; ?></td>
  165.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_name']; ?></td>
  166.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_model']; ?></td>
  167.                 <td class="smallText"><?php echo zen_options_name($products_downloads_query->fields['options_id']); ?></td>
  168.                 <td class="smallText"><?php echo zen_values_name($products_downloads_query->fields['options_values_id']); ?></td>
  169.                 <td class="smallText"><?php echo $filename_is_missing . '&nbsp;' . $products_downloads_query->fields['products_attributes_filename']; ?></td>
  170.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_maxdays']; ?></td>
  171.                 <td class="smallText"><?php echo $products_downloads_query->fields['products_attributes_maxcount']; ?></td>
  172.                 <td class="dataTableContent" align="right"><?php if (isset($padInfo) && is_object($padInfo) && ($products_downloads_query->fields['products_attributes_id'] == $padInfo->products_attributes_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID')) . 'padID=' . $products_downloads_query->fields['products_attributes_id'] . '&page=' . $_GET['page']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  173.               </tr>
  174. <?php
  175.   $products_downloads_query->MoveNext();
  176.   }
  177. ?>
  178. <?php
  179. // bof: split page control and search filter
  180. ?>
  181.               <tr>
  182.                 <td colspan="10"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  183.                   <tr>
  184.                     <td class="smallText" valign="top"><?php echo $products_downloads_split->display_count($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_DOWNLOADS_MANAGER); ?></td>
  185. <!--
  186.                     <td class="smallText" align="right"><?php echo $products_downloads_split->display_links($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
  187. -->
  188.                     <td class="smallText" align="right"><?php echo $products_downloads_split->display_links($products_downloads_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_DOWNLOADS_MANAGER, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  189.  
  190.  
  191.                   </tr>
  192. <?php
  193.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  194. ?>
  195.                   <tr>
  196.                     <td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
  197.                   </tr>
  198. <?php
  199.   }
  200. ?>
  201.                 </table></td>
  202.               </tr>
  203. <?php
  204. // eof: split page control
  205. ?>
  206.             </table></td>
  207.  
  208. <?php
  209.   $heading = array();
  210.   $contents = array();
  211.  
  212.   switch ($action) {
  213. /*
  214.     case 'confirm':
  215.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_PRODUCTS_DOWNLOAD . '</b>');
  216.  
  217.       $contents = array('form' => zen_draw_form('products_downloads_delete', FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&action=deleteconfirm' . '&page=' . $_GET['page']));
  218.       $contents[] = array('text' => TEXT_DELETE_INTRO . '<br /><br /><b>' . $padInfo->products_name . ' - ' . $padInfo->products_attributes_filename . '</b>');
  219.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id) . '&page=' . $_GET['page'] . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  220.       break;
  221. */
  222.     case 'edit':
  223.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_PRODUCTS_DOWNLOAD . '</b>');
  224.  
  225.       $contents = array('form' => zen_draw_form('products_downloads_edit', FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&action=save' . '&page=' . $_GET['page']));
  226.       $contents[] = array('text' => '<b>' . TEXT_PRODUCTS_NAME . $padInfo->products_name . '<br />' . TEXT_PRODUCTS_MODEL . $padInfo->products_model . '</b>');
  227.       $contents[] = array('text' => '<br />' . TEXT_INFO_EDIT_INTRO);
  228.       $contents[] = array('text' => '<br />' . TEXT_INFO_FILENAME . '<br />' . zen_draw_input_field('products_attributes_filename', $padInfo->products_attributes_filename));
  229.       $contents[] = array('text' => '<br />' . TEXT_INFO_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $padInfo->products_attributes_maxdays));
  230.       $contents[] = array('text' => '<br />' . TEXT_INFO_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $padInfo->products_attributes_maxcount));
  231.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . $padInfo->products_attributes_id) . '&page=' . $_GET['page'] . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  232.       break;
  233.     default:
  234.       if (isset($padInfo) && is_object($padInfo)) {
  235.         $heading[] = array('text' => '<b>' . $padInfo->products_attributes_id . ' ' . $padInfo->products_attributes_filename . '</b>');
  236.  
  237.         $contents[] = array('align' => 'center', 'text' =>
  238.           '<a href="' . zen_href_link(FILENAME_DOWNLOADS_MANAGER, zen_get_all_get_params(array('padID', 'action')) . 'padID=' . $padInfo->products_attributes_id . '&page=' . $_GET['page'].'&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>' .
  239.           '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $padInfo->products_id . '&current_categories_id=' . $padInfo->master_categories_id) . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '</a>'
  240.           );
  241.         $contents[] = array('text' => '<br />' . TEXT_PRODUCTS_NAME . $padInfo->products_name);
  242.         $contents[] = array('text' => TEXT_PRODUCTS_MODEL . $padInfo->products_model);
  243.         $contents[] = array('text' => TEXT_INFO_FILENAME . $padInfo->products_attributes_filename);
  244.         $contents[] = array('text' => TEXT_INFO_MAX_DAYS . $padInfo->products_attributes_maxdays);
  245.         $contents[] = array('text' => TEXT_INFO_MAX_COUNT . $padInfo->products_attributes_maxcount);
  246.  
  247.       }
  248.       break;
  249.   }
  250.  
  251.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  252.     echo '            <td width="25%" valign="top">' . "\n";
  253.  
  254.     $box = new box;
  255.     echo $box->infoBox($heading, $contents);
  256.  
  257.     echo '            </td>' . "\n";
  258.   }
  259. ?>
  260.           </tr>
  261.         </td></table>
  262.       </tr>
  263.  
  264.     </table></td>
  265. <!-- downloads by product_name_eof //-->
  266.   </tr>
  267. </table>
  268. <!-- body_text_eof //-->
  269. <!-- footer //-->
  270. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  271. <!-- footer_eof //-->
  272. </body>
  273. </html>
  274. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  275.  


cron