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

Zen Cart 源代码 music_genre.php




下载文件

文件名: music_genre.php
文件类型: PHP文件
文件大小: 14.74 KiB
MD5: e59d66812f932b5067c0780c2bee46f5

music_genre.php - 关闭高亮
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // |zen-cart Open Source E-commerce                                       |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 2004 The zen-cart developers                           |
  7. // |                                                                      |
  8. // | http://www.zen-cart.com/index.php                                    |
  9. // |                                                                      |
  10. // | Portions Copyright (c) 2003 osCommerce                               |
  11. // +----------------------------------------------------------------------+
  12. // | This source file is subject to version 2.0 of the GPL license,       |
  13. // | that is bundled with this package in the file LICENSE, and is        |
  14. // | available through the world-wide-web at the following url:           |
  15. // | http://www.zen-cart.com/license/2_0.txt.                             |
  16. // | If you did not receive a copy of the zen-cart license and are unable |
  17. // | to obtain it through the world-wide-web, please send a note to       |
  18. // | license@zen-cart.com so we can mail you a copy immediately.          |
  19. // +----------------------------------------------------------------------+
  20. //  $Id: music_genre.php 2331 2005-11-10 07:58:16Z drbyte $
  21. //
  22.  
  23.   require('includes/application_top.php');
  24.  
  25.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  26.  
  27.   if (zen_not_null($action)) {
  28.     switch ($action) {
  29.       case 'insert':
  30.       case 'save':
  31.         if (isset($_GET['mID'])) $music_genre_id = zen_db_prepare_input($_GET['mID']);
  32.         $music_genre_name = zen_db_prepare_input($_POST['music_genre_name']);
  33.  
  34.         $sql_data_array = array('music_genre_name' => $music_genre_name);
  35.  
  36.         if ($action == 'insert') {
  37.           $insert_sql_data = array('date_added' => 'now()');
  38.  
  39.           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  40.  
  41.           zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array);
  42.           $music_genre_id = zen_db_insert_id();
  43.         } elseif ($action == 'save') {
  44.           $update_sql_data = array('last_modified' => 'now()');
  45.  
  46.           $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  47.  
  48.           zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array, 'update', "music_genre_id = '" . (int)$music_genre_id . "'");
  49.         }
  50.  
  51.         zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $music_genre_id));
  52.         break;
  53.       case 'deleteconfirm':
  54.         // demo active test
  55.         if (zen_admin_demo()) {
  56.           $_GET['action']= '';
  57.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  58.           zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page']));
  59.         }
  60.         $music_genre_id = zen_db_prepare_input($_GET['mID']);
  61.  
  62. /* There are no images associated with Music Genres, so this section is commented out:
  63.         if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) {
  64.           $music_genre = $db->Execute("select music_genre_image
  65.                                         from " . TABLE_MUSIC_GENRE . "
  66.                                         where music_genre_id = '" . (int)$music_genre_id . "'");
  67.  
  68.           $image_location = DIR_FS_CATALOG_IMAGES . $music_genre->fields['music_genre_image'];
  69.  
  70.           if (file_exists($image_location)) @unlink($image_location);
  71.         }
  72. */
  73.         $db->Execute("delete from " . TABLE_MUSIC_GENRE . "
  74.                      where music_genre_id = '" . (int)$music_genre_id . "'");
  75. //        $db->Execute("delete from " . TABLE_MUSIC_GENRE_INFO . "
  76. //                      where music_genre_id = '" . (int)$music_genre_id . "'");
  77.  
  78.         if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) {
  79.           $products = $db->Execute("select products_id
  80.                                    from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  81.                                    where music_genre_id = '" . (int)$music_genre_id . "'");
  82.  
  83.           while (!$products->EOF) {
  84.             zen_remove_product($products->fields['products_id']);
  85.             $products->MoveNext();
  86.           }
  87.         } else {
  88.           $db->Execute("update " . TABLE_PRODUCT_MUSIC_EXTRA . "
  89.                        set music_genre_id = ''
  90.                        where music_genre_id = '" . (int)$music_genre_id . "'");
  91.         }
  92.  
  93.         zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page']));
  94.         break;
  95.     }
  96.   }
  97. ?>
  98. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  99. <html <?php echo HTML_PARAMS; ?>>
  100. <head>
  101. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  102. <title><?php echo TITLE; ?></title>
  103. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  104. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  105. <script language="javascript" src="includes/menu.js"></script>
  106. <script language="javascript" src="includes/general.js"></script>
  107. <script type="text/javascript">
  108.   <!--
  109.   function init()
  110.   {
  111.     cssjsmenu('navbar');
  112.     if (document.getElementById)
  113.     {
  114.       var kill = document.getElementById('hoverJS');
  115.       kill.disabled = true;
  116.     }
  117.   }
  118.   // -->
  119. </script>
  120. </head>
  121. <body onload="init()">
  122. <!-- header //-->
  123. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  124. <!-- header_eof //-->
  125.  
  126. <!-- body //-->
  127. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  128.   <tr>
  129. <!-- body_text //-->
  130.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  131.       <tr>
  132.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  133.           <tr>
  134.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  135.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  136.           </tr>
  137.         </table></td>
  138.       </tr>
  139.       <tr>
  140.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  141.           <tr>
  142.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  143.               <tr class="dataTableHeadingRow">
  144.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MUSIC_GENRE; ?></td>
  145.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  146.               </tr>
  147. <?php
  148.   $music_genre_query_raw = "select * from " . TABLE_MUSIC_GENRE . " order by music_genre_name";
  149.   $music_genre_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $music_genre_query_raw, $music_genre_query_numrows);
  150.   $music_genre = $db->Execute($music_genre_query_raw);
  151.  
  152.   while (!$music_genre->EOF) {
  153.  
  154.     if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $music_genre->fields['music_genre_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) {
  155.       $music_genre_products = $db->Execute("select count(*) as products_count
  156.                                             from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  157.                                             where music_genre_id = '" . (int)$music_genre->fields['music_genre_id'] . "'");
  158.  
  159.       $aInfo_array = array_merge($music_genre->fields, $music_genre_products->fields);
  160.       $aInfo = new objectInfo($aInfo_array);
  161.     }
  162.  
  163.     if (isset($aInfo) && is_object($aInfo) && ($music_genre->fields['music_genre_id'] == $aInfo->music_genre_id)) {
  164.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '\'">' . "\n";
  165.     } else {
  166.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '\'">' . "\n";
  167.     }
  168. ?>
  169.                 <td class="dataTableContent"><?php echo $music_genre->fields['music_genre_name']; ?></td>
  170.                 <td class="dataTableContent" align="right">
  171.                   <?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
  172.                   <?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
  173.                   <?php if (isset($aInfo) && is_object($aInfo) && ($music_genre->fields['music_genre_id'] == $aInfo->music_genre_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, zen_get_all_get_params(array('mID')) . 'mID=' . $music_genre->fields['music_genre_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  174.                 </td>
  175.               </tr>
  176. <?php
  177.     $music_genre->MoveNext();
  178.   }
  179. ?>
  180.               <tr>
  181.                 <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  182.                   <tr>
  183.                     <td class="smallText" valign="top"><?php echo $music_genre_split->display_count($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MUSIC_GENRES); ?></td>
  184.                     <td class="smallText" align="right"><?php echo $music_genre_split->display_links($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  185.                   </tr>
  186.                 </table></td>
  187.               </tr>
  188. <?php
  189.   if (empty($action)) {
  190. ?>
  191.               <tr>
  192.                 <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>
  193.               </tr>
  194. <?php
  195.   }
  196. ?>
  197.             </table></td>
  198. <?php
  199.   $heading = array();
  200.   $contents = array();
  201.  
  202.   switch ($action) {
  203.     case 'new':
  204.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MUSIC_GENRE . '</b>');
  205.  
  206.       $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  207.       $contents[] = array('text' => TEXT_NEW_INTRO);
  208.       $contents[] = array('text' => '<br>' . TEXT_MUSIC_GENRE_NAME . '<br>' . zen_draw_input_field('music_genre_name', '', zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name')));
  209.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  210.       break;
  211.     case 'edit':
  212.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MUSIC_GENRE . '</b>');
  213.  
  214.       $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  215.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  216.       $contents[] = array('text' => '<br />' . TEXT_MUSIC_GENRE_NAME . '<br>' . zen_draw_input_field('music_genre_name', $aInfo->music_genre_name, zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name')));
  217.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  218.       break;
  219.     case 'delete':
  220.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MUSIC_GENRE . '</b>');
  221.  
  222.       $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=deleteconfirm'));
  223.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  224.       $contents[] = array('text' => '<br><b>' . $aInfo->music_genre_name . '</b>');
  225. //      $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);
  226.  
  227.       if ($aInfo->products_count > 0) {
  228.         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
  229.         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count));
  230.       }
  231.  
  232.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  233.       break;
  234.     default:
  235.       if (isset($aInfo) && is_object($aInfo)) {
  236.         $heading[] = array('text' => '<b>' . $aInfo->music_genre_name . '</b>');
  237.  
  238.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  239.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added));
  240.         if (zen_not_null($aInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified));
  241.         $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $aInfo->products_count);
  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.         </table></td>
  257.       </tr>
  258.     </table></td>
  259. <!-- body_text_eof //-->
  260.   </tr>
  261. </table>
  262. <!-- body_eof //-->
  263.  
  264. <!-- footer //-->
  265. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  266. <!-- footer_eof //-->
  267. <br>
  268. </body>
  269. </html>
  270. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  271.  


cron