[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文件
文件大小: 13.56 KiB
MD5: 8f4ad88041296ea8344d0be131e4ec34

tax_classes.php - 关闭高亮
  1. <?php
  2. //
  3. // +----------------------------------------------------------------------+
  4. // |zen-cart Open Source E-commerce                                       |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 2003 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: tax_classes.php 7167 2007-10-03 23:02:17Z drbyte $
  21. //
  22.   require('includes/application_top.php');
  23.  
  24.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  25.  
  26.   if (zen_not_null($action)) {
  27.     switch ($action) {
  28.       case 'insert':
  29.         $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']);
  30.         $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']);
  31.  
  32.         $db->Execute("insert into " . TABLE_TAX_CLASS . "
  33.                    (tax_class_title, tax_class_description, date_added)
  34.                    values ('" . zen_db_input($tax_class_title) . "',
  35.                            '" . zen_db_input($tax_class_description) . "',
  36.                            now())");
  37.  
  38.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES));
  39.         break;
  40.       case 'save':
  41.         $tax_class_id = zen_db_prepare_input($_GET['tID']);
  42.         $tax_class_title = zen_db_prepare_input($_POST['tax_class_title']);
  43.         $tax_class_description = zen_db_prepare_input($_POST['tax_class_description']);
  44.  
  45.         $db->Execute("update " . TABLE_TAX_CLASS . "
  46.                      set tax_class_id = '" . (int)$tax_class_id . "',
  47.                          tax_class_title = '" . zen_db_input($tax_class_title) . "',
  48.                          tax_class_description = '" . zen_db_input($tax_class_description) . "',
  49.                          last_modified = now()
  50.                      where tax_class_id = '" . (int)$tax_class_id . "'");
  51.  
  52.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tax_class_id));
  53.         break;
  54.       case 'deleteconfirm':
  55.         // demo active test
  56.         if (zen_admin_demo()) {
  57.           $_GET['action']= '';
  58.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  59.           zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']));
  60.         }
  61.         $tax_class_id = zen_db_prepare_input($_GET['tID']);
  62.  
  63.         $sql = "select tax_class_id from " . TABLE_TAX_RATES . " where tax_class_id='" . $tax_class_id . "'";
  64.         $result = $db->Execute($sql);
  65.         if ($result->RecordCount() > 0) {
  66.           $_GET['action']= '';
  67.           $messageStack->add_session(ERROR_TAX_RATE_EXISTS_FOR_CLASS, 'error');
  68.         }
  69.         $sql = "select count(*) as count from " . TABLE_PRODUCTS . " where products_tax_class_id='" . $tax_class_id . "'";
  70.         $result = $db->Execute($sql);
  71.         if ($result->fields['count'] > 0) {
  72.           $_GET['action']= '';
  73.           $messageStack->add_session(sprintf(ERROR_TAX_RATE_EXISTS_FOR_PRODUCTS, $result->fields['count']), 'error');
  74.         }
  75.         if ($_GET['action'] == 'deleteconfirm') {
  76.           $db->Execute("delete from " . TABLE_TAX_CLASS . "
  77.                        where tax_class_id = '" . (int)$tax_class_id . "'");
  78.         }
  79.         zen_redirect(zen_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']));
  80.         break;
  81.     }
  82.   }
  83. ?>
  84. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  85. <html <?php echo HTML_PARAMS; ?>>
  86. <head>
  87. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  88. <title><?php echo TITLE; ?></title>
  89. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  90. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  91. <script language="javascript" src="includes/menu.js"></script>
  92. <script language="javascript" src="includes/general.js"></script>
  93. <script type="text/javascript">
  94.   <!--
  95.   function init()
  96.   {
  97.     cssjsmenu('navbar');
  98.     if (document.getElementById)
  99.     {
  100.       var kill = document.getElementById('hoverJS');
  101.       kill.disabled = true;
  102.     }
  103.   }
  104.   // -->
  105. </script>
  106. </head>
  107. <body onLoad="init()">
  108. <!-- header //-->
  109. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  110. <!-- header_eof //-->
  111.  
  112. <!-- body //-->
  113. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  114.   <tr>
  115. <!-- body_text //-->
  116.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  117.       <tr>
  118.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  119.           <tr>
  120.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  121.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  122.           </tr>
  123.         </table></td>
  124.       </tr>
  125.       <tr>
  126.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  127.           <tr>
  128.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  129.               <tr class="dataTableHeadingRow">
  130.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASS_ID; ?></td>
  131.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_TAX_CLASSES; ?></td>
  132.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  133.               </tr>
  134. <?php
  135.   $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";
  136.   $classes_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $classes_query_raw, $classes_query_numrows);
  137.   $classes = $db->Execute($classes_query_raw);
  138.   while (!$classes->EOF) {
  139.     if ((!isset($_GET['tID']) || (isset($_GET['tID']) && ($_GET['tID'] == $classes->fields['tax_class_id']))) && !isset($tcInfo) && (substr($action, 0, 3) != 'new')) {
  140.       $tcInfo = new objectInfo($classes->fields);
  141.     }
  142.  
  143.     if (isset($tcInfo) && is_object($tcInfo) && ($classes->fields['tax_class_id'] == $tcInfo->tax_class_id)) {
  144.       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";
  145.     } else {
  146.       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";
  147.     }
  148. ?>
  149.                 <td class="dataTableContent"><?php echo $classes->fields['tax_class_id']; ?></td>
  150.                 <td class="dataTableContent"><?php echo $classes->fields['tax_class_title']; ?></td>
  151.                 <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>
  152.               </tr>
  153. <?php
  154.     $classes->MoveNext();
  155.   }
  156. ?>
  157.               <tr>
  158.                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  159.                   <tr>
  160.                     <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>
  161.                     <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>
  162.                   </tr>
  163. <?php
  164.   if (empty($action)) {
  165. ?>
  166.                   <tr>
  167.                     <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>
  168.                   </tr>
  169. <?php
  170.   }
  171. ?>
  172.                 </table></td>
  173.               </tr>
  174.             </table></td>
  175. <?php
  176.   $heading = array();
  177.   $contents = array();
  178.  
  179.   switch ($action) {
  180.     case 'new':
  181.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TAX_CLASS . '</b>');
  182.  
  183.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&action=insert'));
  184.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  185.       $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')));
  186.       $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')));
  187.       $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>');
  188.       break;
  189.     case 'edit':
  190.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TAX_CLASS . '</b>');
  191.  
  192.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=save'));
  193.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  194.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_TITLE . '<br>' . zen_draw_input_field('tax_class_title', $tcInfo->tax_class_title, zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_title')));
  195.       $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . zen_draw_input_field('tax_class_description', $tcInfo->tax_class_description, zen_set_field_length(TABLE_TAX_CLASS, 'tax_class_description')));
  196.       $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>');
  197.       break;
  198.     case 'delete':
  199.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TAX_CLASS . '</b>');
  200.  
  201.       $contents = array('form' => zen_draw_form('classes', FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tcInfo->tax_class_id . '&action=deleteconfirm'));
  202.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  203.       $contents[] = array('text' => '<br><b>' . $tcInfo->tax_class_title . '</b>');
  204.       $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>');
  205.       break;
  206.     default:
  207.       if (isset($tcInfo) && is_object($tcInfo)) {
  208.         $heading[] = array('text' => '<b>' . $tcInfo->tax_class_title . '</b>');
  209.  
  210.         $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>');
  211.         $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($tcInfo->date_added));
  212.         $contents[] = array('text' => '' . TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($tcInfo->last_modified));
  213.         $contents[] = array('text' => '<br>' . TEXT_INFO_CLASS_DESCRIPTION . '<br>' . $tcInfo->tax_class_description);
  214.       }
  215.       break;
  216.   }
  217.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  218.     echo '            <td width="25%" valign="top">' . "\n";
  219.  
  220.     $box = new box;
  221.     echo $box->infoBox($heading, $contents);
  222.  
  223.     echo '            </td>' . "\n";
  224.   }
  225. ?>
  226.           </tr>
  227.         </table></td>
  228.       </tr>
  229.     </table></td>
  230. <!-- body_text_eof //-->
  231.   </tr>
  232. </table>
  233. <!-- body_eof //-->
  234.  
  235. <!-- footer //-->
  236. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  237. <!-- footer_eof //-->
  238. <br>
  239. </body>
  240. </html>
  241. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron