[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 源代码 media_types.php

Zen Cart 源代码 media_types.php




下载文件

文件名: media_types.php
文件类型: PHP文件
文件大小: 11.65 KiB
MD5: a14ce09c4a1825ef41f63cdd63df0580

media_types.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: media_types.php 19294 2011-07-28 18:15:46Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  13.  
  14.   if (zen_not_null($action)) {
  15.     switch ($action) {
  16.       case 'insert':
  17.       case 'save':
  18.         if (isset($_GET['mID'])) $type_id = zen_db_prepare_input($_GET['mID']);
  19.         if (isset($_POST['type_ext'])) $type_ext = zen_db_prepare_input($_POST['type_ext']);
  20.         if (isset($_POST['type_name'])) $type_name = zen_db_prepare_input($_POST['type_name']);
  21.         $sql_data_array = array('type_ext' => $type_ext);
  22.  
  23.         if ($action == 'insert') {
  24.           $insert_data_array = array('type_name' => $type_name);
  25.  
  26.           $sql_data_array = array_merge($sql_data_array, $insert_data_array);
  27.  
  28.           zen_db_perform(TABLE_MEDIA_TYPES, $sql_data_array);
  29.           $type_id = zen_db_insert_id();
  30.  
  31.         } elseif ($action == 'save') {
  32.           $insert_data_array = array('type_name' => $type_name);
  33.           $sql_data_array = array_merge($sql_data_array, $insert_data_array);
  34.  
  35.           zen_db_perform(TABLE_MEDIA_TYPES, $sql_data_array, 'update', "type_id = '" . (int)$type_id . "'");
  36.         }
  37.  
  38.         zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $type_id));
  39.         break;
  40.       case 'deleteconfirm':
  41.         // demo active test
  42.         if (zen_admin_demo()) {
  43.           $_GET['action']= '';
  44.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  45.           zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page']));
  46.         }
  47.         $type_id = zen_db_prepare_input($_POST['mID']);
  48.  
  49.         $db->Execute("delete from " . TABLE_MEDIA_TYPES . "
  50.                      where type_id = '" . (int)$type_id . "'");
  51.  
  52.  
  53.         zen_redirect(zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page']));
  54.         break;
  55.     }
  56.   }
  57. ?>
  58. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  59. <html <?php echo HTML_PARAMS; ?>>
  60. <head>
  61. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  62. <title><?php echo TITLE; ?></title>
  63. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  64. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  65. <script language="javascript" src="includes/menu.js"></script>
  66. <script language="javascript" src="includes/general.js"></script>
  67. <script type="text/javascript">
  68.   <!--
  69.   function init()
  70.   {
  71.     cssjsmenu('navbar');
  72.     if (document.getElementById)
  73.     {
  74.       var kill = document.getElementById('hoverJS');
  75.       kill.disabled = true;
  76.     }
  77.   }
  78.   // -->
  79. </script>
  80. </head>
  81. <body onload="init()">
  82. <!-- header //-->
  83. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  84. <!-- header_eof //-->
  85.  
  86. <!-- body //-->
  87. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  88.   <tr>
  89. <!-- body_text //-->
  90.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  91.       <tr>
  92.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  93.           <tr>
  94.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  95.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  96.           </tr>
  97.         </table></td>
  98.       </tr>
  99.       <tr>
  100.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  101.           <tr>
  102.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  103.               <tr class="dataTableHeadingRow">
  104.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MEDIA_TYPE; ?></td>
  105.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MEDIA_TYPE_EXT; ?></td>
  106.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  107.               </tr>
  108. <?php
  109.   $media_type_query_raw = "select * from " . TABLE_MEDIA_TYPES . " order by type_name";
  110.   $media_type_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $media_type_query_raw, $media_type_query_numrows);
  111.   $media_type = $db->Execute($media_type_query_raw);
  112.   while (!$media_type->EOF) {
  113.     if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $media_type->fields['type_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) {
  114.       $mInfo = new objectInfo($media_type->fields);
  115.     }
  116.  
  117.     if (isset($mInfo) && is_object($mInfo) && ($media_type->fields['type_id'] == $mInfo->type_id)) {
  118.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '\'">' . "\n";
  119.     } else {
  120.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '\'">' . "\n";
  121.     }
  122. ?>
  123.                 <td class="dataTableContent"><?php echo $media_type->fields['type_name']; ?></td>
  124.                 <td class="dataTableContent"><?php echo $media_type->fields['type_ext']; ?></td>
  125.                 <td class="dataTableContent" align="right">
  126.                   <?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
  127.                   <?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $media_type->fields['type_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
  128.                   <?php if (isset($mInfo) && is_object($mInfo) && ($media_type->fields['type_id'] == $mInfo->type_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, zen_get_all_get_params(array('mID')) . 'mID=' . $media_type->fields['type_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  129.                 </td>
  130.               </tr>
  131. <?php
  132.     $media_type->MoveNext();
  133.   }
  134. ?>
  135.               <tr>
  136.                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  137.                   <tr>
  138.                     <td class="smallText" valign="top"><?php echo $media_type_split->display_count($media_type_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MEDIA_TYPES); ?></td>
  139.                     <td class="smallText" align="right"><?php echo $media_type_split->display_links($media_type_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  140.                   </tr>
  141.                 </table></td>
  142.               </tr>
  143. <?php
  144.   if (empty($action)) {
  145. ?>
  146.               <tr>
  147.                 <td align="right" colspan="3" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  148.               </tr>
  149. <?php
  150.   }
  151. ?>
  152.             </table></td>
  153. <?php
  154.   $heading = array();
  155.   $contents = array();
  156.  
  157.   switch ($action) {
  158.     case 'new':
  159.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MEDIA_TYPE . '</b>');
  160.  
  161.       $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  162.       $contents[] = array('text' => TEXT_NEW_INTRO);
  163.       $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_NAME . '<br>' . zen_draw_input_field('type_name', '', zen_set_field_length(TABLE_MEDIA_TYPES, 'type_name')));
  164.       $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_EXT . '<br>' . zen_draw_input_field('type_ext', '', zen_set_field_length(TABLE_MEDIA_TYPES, 'type_ext')));
  165.  
  166.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  167.       break;
  168.     case 'edit':
  169.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MEDIA_TYPE . '</b>');
  170.  
  171.       $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  172.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  173.  
  174.       $contents[] = array('text' => '<br>' . TEXT_MEDIA_TYPE_NAME . '<br>' . zen_draw_input_field('type_name', $mInfo->type_name, zen_set_field_length(TABLE_MEDIA_TYPES, 'type_name')));
  175.  
  176.       $contents[] = array('text' => '<br />' . TEXT_MEDIA_TYPE_EXT . '<br>' . zen_draw_input_field('type_ext', $mInfo->type_ext, zen_set_field_length(TABLE_MEDIA_TYPES, 'type_ext')));
  177.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  178.       break;
  179.     case 'delete':
  180.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MEDIA_TYPES . '</b>');
  181.  
  182.       $contents = array('form' => zen_draw_form('media_type', FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('mID', $mInfo->type_id));
  183.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  184.       $contents[] = array('text' => '<br><b>' . $mInfo->type_name . '</b>');
  185.  
  186.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  187.       break;
  188.     default:
  189.       if (isset($mInfo) && is_object($mInfo)) {
  190.         $heading[] = array('text' => '<b>' . $mInfo->type_name . '</b>');
  191.  
  192.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_MEDIA_TYPES, 'page=' . $_GET['page'] . '&mID=' . $mInfo->type_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  193.         $contents[] = array('text' => '<br>' . TEXT_EXTENSION . ' ' . $mInfo->type_ext);
  194.       }
  195.       break;
  196.   }
  197.  
  198.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  199.     echo '            <td width="25%" valign="top">' . "\n";
  200.  
  201.     $box = new box;
  202.     echo $box->infoBox($heading, $contents);
  203.  
  204.     echo '            </td>' . "\n";
  205.   }
  206. ?>
  207.           </tr>
  208.         </table></td>
  209.       </tr>
  210.     </table></td>
  211. <!-- body_text_eof //-->
  212.   </tr>
  213. </table>
  214. <!-- body_eof //-->
  215.  
  216. <!-- footer //-->
  217. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  218. <!-- footer_eof //-->
  219. <br>
  220. </body>
  221. </html>
  222. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  223.  


cron