[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文件
文件大小: 15.28 KiB
MD5: bc23dea85641a1c1bfee5a102e7f1260

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