[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.41 KiB
MD5: cef4f59f8f94c14782076cf96395ea6e

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


cron