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

Zen Cart 源代码 tax_classes.php




下载文件

文件名: tax_classes.php
文件类型: PHP文件
文件大小: 12.6 KiB
MD5: b3830a19124df9a43edc448b49e408b0

tax_classes.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: tax_classes.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.         $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']);
  18.         $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']);
  19.  
  20.         $db->Execute("insert into " . TABLE_TAX_CLASS . "
  21.                    (tax_class_title, tax_class_description, date_added)
  22.                    values ('" . zen_db_input($tax_class_title) . "',
  23.                            '" . zen_db_input($tax_class_description) . "',
  24.                            now())");
  25.  
  26.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES));
  27.         break;
  28.       case 'save':
  29.         $tax_class_id = zen_db_prepare_input($_GET['tID']);
  30.         $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']);
  31.         $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']);
  32.  
  33.         $db->Execute("update " . TABLE_TAX_CLASS . "
  34.                      set tax_class_id = '" . (int)$tax_class_id . "',
  35.                          tax_class_title = '" . zen_db_input($tax_class_title) . "',
  36.                          tax_class_description = '" . zen_db_input($tax_class_description) . "',
  37.                          last_modified = now()
  38.                      where tax_class_id = '" . (int)$tax_class_id . "'");
  39.  
  40.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tax_class_id));
  41.         break;
  42.       case 'deleteconfirm':
  43.         // demo active test
  44.         if (zen_admin_demo()) {
  45.           $_GET['action']= '';
  46.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  47.           zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']));
  48.         }
  49.         $tax_class_id = zen_db_prepare_input($_POST['tID']);
  50.  
  51.         $sql = "select tax_class_id from " . TABLE_TAX_RATES . " where tax_class_id='" . $tax_class_id . "'";
  52.         $result = $db->Execute($sql);
  53.         if ($result->RecordCount() > 0) {
  54.           $_GET['action']= '';
  55.           $messageStack->add_session(ERROR_TAX_RATE_EXISTS_FOR_CLASS, 'error');
  56.         }
  57.         $sql = "select count(*) as count from " . TABLE_PRODUCTS . " where products_tax_class_id='" . $tax_class_id . "'";
  58.         $result = $db->Execute($sql);
  59.         if ($result->fields['count'] > 0) {
  60.           $_GET['action']= '';
  61.           $messageStack->add_session(sprintf(ERROR_TAX_RATE_EXISTS_FOR_PRODUCTS, $result->fields['count']), 'error');
  62.         }
  63.         if ($_GET['action'] == 'deleteconfirm') {
  64.           $db->Execute("delete from " . TABLE_TAX_CLASS . "
  65.                        where tax_class_id = '" . (int)$tax_class_id . "'");
  66.         }
  67.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, '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><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_TAX_CLASS_ID; ?></td>
  119.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASSES; ?></td>
  120.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  121.               </tr>
  122. <?php
  123.   $classes_query_raw = "select tax_class_id, tax_class_title, tax_class_description, last_modified, date_added from " . TABLE_TAX_CLASS . " order by tax_class_title";
  124.   $classes_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows);
  125.   $classes = $db->Execute($classes_query_raw);
  126.   while (!$classes->EOF) {
  127.     if ((!isset($_GET['tID']) || (isset($_GET['tID']) && ($_GET['tID'] == $classes->fields['tax_class_id']))) && !isset($tcInfo) && (substr($action, 0, 3) != 'new')) {
  128.       $tcInfo = new objectInfo($classes->fields);
  129.     }
  130.  
  131.     if (isset($tcInfo) && is_object($tcInfo) && ($classes->fields['tax_class_id'] == $tcInfo->tax_class_id)) {
  132.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '\'">' . "\n";
  133.     } else {
  134.       echo'              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes->fields['tax_class_id']) . '\'">' . "\n";
  135.     }
  136. ?>
  137.                 <td class="dataTableContent"><?php echo $classes->fields['tax_class_id']; ?></td>
  138.                 <td class="dataTableContent"><?php echo $classes->fields['tax_class_title']; ?></td>
  139.                 <td class="dataTableContent" align="right"><?php if (isset($tcInfo) && is_object($tcInfo) && ($classes->fields['tax_class_id'] == $tcInfo->tax_class_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $classes->fields['tax_class_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  140.               </tr>
  141. <?php
  142.     $classes->MoveNext();
  143.   }
  144. ?>
  145.               <tr>
  146.                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  147.                   <tr>
  148.                     <td class="smallText" valign="top"><?php echo $classes_split->display_count($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_TAX_CLASSES); ?></td>
  149.                     <td class="smallText" align="right"><?php echo $classes_split->display_links($classes_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  150.                   </tr>
  151. <?php
  152.   if (empty($action)) {
  153. ?>
  154.                   <tr>
  155.                     <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_tax_class.gif', IMAGE_NEW_TAX_CLASS) . '</a>'; ?></td>
  156.                   </tr>
  157. <?php
  158.   }
  159. ?>
  160.                 </table></td>
  161.               </tr>
  162.             </table></td>
  163. <?php
  164.   $heading = array();
  165.   $contents = array();
  166.  
  167.   switch ($action) {
  168.     case 'new':
  169.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_CLASS . '</b>');
  170.  
  171.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=insert'));
  172.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  173.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . zen_draw_input_field('tax_class_title', '', zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_title')));
  174.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . zen_draw_input_field('tax_class_description', '', zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_description')));
  175.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  176.       break;
  177.     case 'edit':
  178.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_CLASS . '</b>');
  179.  
  180.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=save'));
  181.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  182.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . zen_draw_input_field('tax_class_title', htmlspecialchars($tcInfo->tax_class_title, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_title')));
  183.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . zen_draw_input_field('tax_class_description', htmlspecialchars($tcInfo->tax_class_description, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_description')));
  184.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  185.       break;
  186.     case 'delete':
  187.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_CLASS . '</b>');
  188.  
  189.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('tID', $tcInfo->tax_class_id));
  190.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  191.       $contents[] = array('text' => '<br><b>' . $tcInfo->tax_class_title . '</b>');
  192.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  193.       break;
  194.     default:
  195.       if (isset($tcInfo) && is_object($tcInfo)) {
  196.         $heading[] = array('text' => '<b>' . $tcInfo->tax_class_title . '</b>');
  197.  
  198.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  199.         $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($tcInfo->date_added));
  200.         $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($tcInfo->last_modified));
  201.         $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . $tcInfo->tax_class_description);
  202.       }
  203.       break;
  204.   }
  205.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  206.     echo '            <td width="25%" valign="top">' . "\n";
  207.  
  208.     $box = new box;
  209.     echo $box->infoBox($heading, $contents);
  210.  
  211.     echo '            </td>' . "\n";
  212.   }
  213. ?>
  214.           </tr>
  215.         </table></td>
  216.       </tr>
  217.     </table></td>
  218. <!-- body_text_eof //-->
  219.   </tr>
  220. </table>
  221. <!-- body_eof //-->
  222.  
  223. <!-- footer //-->
  224. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  225. <!-- footer_eof //-->
  226. <br>
  227. </body>
  228. </html>
  229. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>