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

music_genre.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: music_genre.php 19330 2011-08-07 06:32:56Z 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'])) $music_genre_id = zen_db_prepare_input($_GET['mID']);
  19.         $music_genre_name = zen_db_prepare_input($_POST['music_genre_name']);
  20.  
  21.         $sql_data_array = array('music_genre_name' => $music_genre_name);
  22.  
  23.         if ($action == 'insert') {
  24.           $insert_sql_data = array('date_added' => 'now()');
  25.  
  26.           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  27.  
  28.           zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array);
  29.           $music_genre_id = zen_db_insert_id();
  30.         } elseif ($action == 'save') {
  31.           $update_sql_data = array('last_modified' => 'now()');
  32.  
  33.           $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  34.  
  35.           zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array, 'update', "music_genre_id = '" . (int)$music_genre_id . "'");
  36.         }
  37.  
  38.         zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $music_genre_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_MUSIC_GENRE, 'page=' . $_GET['page']));
  46.         }
  47.         $music_genre_id = zen_db_prepare_input($_POST['mID']);
  48.  
  49.         $db->Execute("delete from " . TABLE_MUSIC_GENRE . "
  50.                      where music_genre_id = '" . (int)$music_genre_id . "'");
  51.  
  52.         if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) {
  53.           $products = $db->Execute("select products_id
  54.                                    from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  55.                                    where music_genre_id = '" . (int)$music_genre_id . "'");
  56.  
  57.           while (!$products->EOF) {
  58.             zen_remove_product($products->fields['products_id']);
  59.             $products->MoveNext();
  60.           }
  61.         } else {
  62.           $db->Execute("update " . TABLE_PRODUCT_MUSIC_EXTRA . "
  63.                        set music_genre_id = ''
  64.                        where music_genre_id = '" . (int)$music_genre_id . "'");
  65.         }
  66.  
  67.         zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page']));
  68.         break;
  69.     }
  70.   }
  71. ?>
  72. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  73. <html <?php echo HTML_PARAMS; ?>>
  74. <head>
  75. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  76. <title><?php echo TITLE; ?></title>
  77. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  78. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  79. <script language="javascript" src="includes/menu.js"></script>
  80. <script language="javascript" src="includes/general.js"></script>
  81. <script type="text/javascript">
  82.   <!--
  83.   function init()
  84.   {
  85.     cssjsmenu('navbar');
  86.     if (document.getElementById)
  87.     {
  88.       var kill = document.getElementById('hoverJS');
  89.       kill.disabled = true;
  90.     }
  91.   }
  92.   // -->
  93. </script>
  94. </head>
  95. <body onload="init()">
  96. <!-- header //-->
  97. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  98. <!-- header_eof //-->
  99.  
  100. <!-- body //-->
  101. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  102.   <tr>
  103. <!-- body_text //-->
  104.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  105.       <tr>
  106.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  107.           <tr>
  108.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  109.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  110.           </tr>
  111.         </table></td>
  112.       </tr>
  113.       <tr>
  114.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  115.           <tr>
  116.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  117.               <tr class="dataTableHeadingRow">
  118.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MUSIC_GENRE; ?></td>
  119.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  120.               </tr>
  121. <?php
  122.   $music_genre_query_raw = "select * from " . TABLE_MUSIC_GENRE . " order by music_genre_name";
  123.   $music_genre_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $music_genre_query_raw, $music_genre_query_numrows);
  124.   $music_genre = $db->Execute($music_genre_query_raw);
  125.  
  126.   while (!$music_genre->EOF) {
  127.  
  128.     if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $music_genre->fields['music_genre_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) {
  129.       $music_genre_products = $db->Execute("select count(*) as products_count
  130.                                             from " . TABLE_PRODUCT_MUSIC_EXTRA . "
  131.                                             where music_genre_id = '" . (int)$music_genre->fields['music_genre_id'] . "'");
  132.  
  133.       $aInfo_array = array_merge($music_genre->fields, $music_genre_products->fields);
  134.       $aInfo = new objectInfo($aInfo_array);
  135.     }
  136.  
  137.     if (isset($aInfo) && is_object($aInfo) && ($music_genre->fields['music_genre_id'] == $aInfo->music_genre_id)) {
  138.       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";
  139.     } else {
  140.       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";
  141.     }
  142. ?>
  143.                 <td class="dataTableContent"><?php echo $music_genre->fields['music_genre_name']; ?></td>
  144.                 <td class="dataTableContent" align="right">
  145.                   <?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>'; ?>
  146.                   <?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>'; ?>
  147.                   <?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>'; } ?>
  148.                 </td>
  149.               </tr>
  150. <?php
  151.     $music_genre->MoveNext();
  152.   }
  153. ?>
  154.               <tr>
  155.                 <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  156.                   <tr>
  157.                     <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>
  158.                     <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>
  159.                   </tr>
  160.                 </table></td>
  161.               </tr>
  162. <?php
  163.   if (empty($action)) {
  164. ?>
  165.               <tr>
  166.                 <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>
  167.               </tr>
  168. <?php
  169.   }
  170. ?>
  171.             </table></td>
  172. <?php
  173.   $heading = array();
  174.   $contents = array();
  175.  
  176.   switch ($action) {
  177.     case 'new':
  178.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MUSIC_GENRE . '</b>');
  179.  
  180.       $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  181.       $contents[] = array('text' => TEXT_NEW_INTRO);
  182.       $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')));
  183.       $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>');
  184.       break;
  185.     case 'edit':
  186.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MUSIC_GENRE . '</b>');
  187.  
  188.       $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"'));
  189.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  190.       $contents[] = array('text' => '<br />' . TEXT_MUSIC_GENRE_NAME . '<br>' . zen_draw_input_field('music_genre_name', htmlspecialchars($aInfo->music_genre_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name')));
  191.       $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>');
  192.       break;
  193.     case 'delete':
  194.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MUSIC_GENRE . '</b>');
  195.  
  196.       $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('mID', $aInfo->music_genre_id));
  197.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  198.       $contents[] = array('text' => '<br><b>' . $aInfo->music_genre_name . '</b>');
  199.  
  200.       if ($aInfo->products_count > 0) {
  201.         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
  202.         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count));
  203.       }
  204.  
  205.       $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>');
  206.       break;
  207.     default:
  208.       if (isset($aInfo) && is_object($aInfo)) {
  209.         $heading[] = array('text' => '<b>' . $aInfo->music_genre_name . '</b>');
  210.  
  211.         $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>');
  212.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added));
  213.         if (zen_not_null($aInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified));
  214.         $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $aInfo->products_count);
  215.       }
  216.       break;
  217.   }
  218.  
  219.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  220.     echo '            <td width="25%" valign="top">' . "\n";
  221.  
  222.     $box = new box;
  223.     echo $box->infoBox($heading, $contents);
  224.  
  225.     echo '            </td>' . "\n";
  226.   }
  227. ?>
  228.           </tr>
  229.         </table></td>
  230.       </tr>
  231.     </table></td>
  232. <!-- body_text_eof //-->
  233.   </tr>
  234. </table>
  235. <!-- body_eof //-->
  236.  
  237. <!-- footer //-->
  238. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  239. <!-- footer_eof //-->
  240. <br>
  241. </body>
  242. </html>
  243. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  244.  


cron