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

Zen Cart 源代码 zones.php




下载文件

文件名: zones.php
文件类型: PHP文件
文件大小: 12.99 KiB
MD5: 092404e7a257dbd4de5fc3868966ed7a

zones.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: zones.php 1969 2005-09-13 06:57:21Z 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.         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  30.         $zone_code = zen_db_prepare_input($_POST['zone_code']);
  31.         $zone_name = zen_db_prepare_input($_POST['zone_name']);
  32.  
  33.         $db->Execute("insert into " . TABLE_ZONES . "
  34.                    (zone_country_id, zone_code, zone_name)
  35.                    values ('" . (int)$zone_country_id . "',
  36.                            '" . zen_db_input($zone_code) . "',
  37.                            '" . zen_db_input($zone_name) . "')");
  38.  
  39.         zen_redirect(zen_href_link(FILENAME_ZONES));
  40.         break;
  41.       case 'save':
  42.         $zone_id = zen_db_prepare_input($_GET['cID']);
  43.         $zone_country_id = zen_db_prepare_input($_POST['zone_country_id']);
  44.         $zone_code = zen_db_prepare_input($_POST['zone_code']);
  45.         $zone_name = zen_db_prepare_input($_POST['zone_name']);
  46.  
  47.         $db->Execute("update " . TABLE_ZONES . "
  48.                      set zone_country_id = '" . (int)$zone_country_id . "',
  49.                          zone_code = '" . zen_db_input($zone_code) . "',
  50.                          zone_name = '" . zen_db_input($zone_name) . "'
  51.                      where zone_id = '" . (int)$zone_id . "'");
  52.  
  53.         zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zone_id));
  54.         break;
  55.       case 'deleteconfirm':
  56.         // demo active test
  57.         if (zen_admin_demo()) {
  58.           $_GET['action']= '';
  59.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  60.           zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page']));
  61.         }
  62.         $zone_id = zen_db_prepare_input($_GET['cID']);
  63.  
  64.         $db->Execute("delete from " . TABLE_ZONES . " where zone_id = '" . (int)$zone_id . "'");
  65.  
  66.         zen_redirect(zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page']));
  67.         break;
  68.     }
  69.   }
  70. ?>
  71. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  72. <html <?php echo HTML_PARAMS; ?>>
  73. <head>
  74. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  75. <title><?php echo TITLE; ?></title>
  76. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  77. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  78. <script language="javascript" src="includes/menu.js"></script>
  79. <script language="javascript" src="includes/general.js"></script>
  80. <script type="text/javascript">
  81.   <!--
  82.   function init()
  83.   {
  84.     cssjsmenu('navbar');
  85.     if (document.getElementById)
  86.     {
  87.       var kill = document.getElementById('hoverJS');
  88.       kill.disabled = true;
  89.     }
  90.   }
  91.   // -->
  92. </script>
  93. </head>
  94. <body onload="init()">
  95. <!-- header //-->
  96. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  97. <!-- header_eof //-->
  98. <!-- body //-->
  99. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  100.   <tr>
  101.     <!-- body_text //-->
  102.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  103.         <tr>
  104.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  105.               <tr>
  106.                 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  107.                 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  108.               </tr>
  109.             </table></td>
  110.         </tr>
  111.         <tr>
  112.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  113.               <tr>
  114.                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  115.                     <tr class="dataTableHeadingRow">
  116.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_NAME; ?></td>
  117.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ZONE_NAME; ?></td>
  118.                       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ZONE_CODE; ?></td>
  119.                       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  120.                     </tr>
  121.                     <?php
  122.   $zones_query_raw = "select z.zone_id, c.countries_id, c.countries_name, z.zone_name, z.zone_code, z.zone_country_id from " . TABLE_ZONES . " z, " . TABLE_COUNTRIES . " c where z.zone_country_id = c.countries_id order by c.countries_name, z.zone_name";
  123.   $zones_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $zones_query_raw, $zones_query_numrows);
  124.   $zones = $db->Execute($zones_query_raw);
  125.   while (!$zones->EOF) {
  126.     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $zones->fields['zone_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  127.       $cInfo = new objectInfo($zones->fields);
  128.     }
  129.  
  130.     if (isset($cInfo) && is_object($cInfo) && ($zones->fields['zone_id'] == $cInfo->zone_id)) {
  131.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit') . '\'">' . "\n";
  132.     } else {
  133.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zones->fields['zone_id']) . '\'">' . "\n";
  134.     }
  135. ?>
  136.                     <td class="dataTableContent"><?php echo $zones->fields['countries_name']; ?></td>
  137.                     <td class="dataTableContent"><?php echo $zones->fields['zone_name']; ?></td>
  138.                     <td class="dataTableContent" align="center"><?php echo $zones->fields['zone_code']; ?></td>
  139.                     <td class="dataTableContent" align="right">
  140.                       <?php if (isset($cInfo) && is_object($cInfo) && ($zones->fields['zone_id'] == $cInfo->zone_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $zones->fields['zone_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  141.                       &nbsp;</td>
  142.                     </tr>
  143. <?php
  144.     $zones->MoveNext();
  145.   }
  146. ?>
  147.                     <tr>
  148.                       <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  149.                           <tr>
  150.                             <td class="smallText" valign="top"><?php echo $zones_split->display_count($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_ZONES); ?></td>
  151.                             <td class="smallText" align="right"><?php echo $zones_split->display_links($zones_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  152.                           </tr>
  153.                           <?php
  154.   if (empty($action)) {
  155. ?>
  156.                           <tr>
  157.                             <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_zone.gif', IMAGE_NEW_ZONE) . '</a>'; ?></td>
  158.                           </tr>
  159.                           <?php
  160.   }
  161. ?>
  162.                         </table></td>
  163.                     </tr>
  164.                   </table></td>
  165.                 <?php
  166.   $heading = array();
  167.   $contents = array();
  168.  
  169.   switch ($action) {
  170.     case 'new':
  171.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ZONE . '</b>');
  172.  
  173.       $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&action=insert'));
  174.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  175.       $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name'));
  176.       $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code'));
  177.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries()));
  178.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  179.       break;
  180.     case 'edit':
  181.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ZONE . '</b>');
  182.  
  183.       $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=save'));
  184.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  185.       $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . zen_draw_input_field('zone_name', $cInfo->zone_name));
  186.       $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_CODE . '<br>' . zen_draw_input_field('zone_code', $cInfo->zone_code));
  187.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_pull_down_menu('zone_country_id', zen_get_countries(), $cInfo->countries_id));
  188.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  189.       break;
  190.     case 'delete':
  191.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ZONE . '</b>');
  192.  
  193.       $contents = array('form' => zen_draw_form('zones', FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=deleteconfirm'));
  194.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  195.       $contents[] = array('text' => '<br><b>' . $cInfo->zone_name . '</b>');
  196.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  197.       break;
  198.     default:
  199.       if (isset($cInfo) && is_object($cInfo)) {
  200.         $heading[] = array('text' => '<b>' . $cInfo->zone_name . '</b>');
  201.  
  202.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ZONES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->zone_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  203.         $contents[] = array('text' => '<br>' . TEXT_INFO_ZONES_NAME . '<br>' . $cInfo->zone_name . ' (' . $cInfo->zone_code . ')');
  204.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . ' ' . $cInfo->countries_name);
  205.       }
  206.       break;
  207.   }
  208.  
  209.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  210.     echo '            <td width="25%" valign="top">' . "\n";
  211.  
  212.     $box = new box;
  213.     echo $box->infoBox($heading, $contents);
  214.  
  215.     echo '            </td>' . "\n";
  216.   }
  217. ?>
  218.               </tr>
  219.             </table></td>
  220.         </tr>
  221.       </table></td>
  222.     <!-- body_text_eof //-->
  223.   </tr>
  224. </table>
  225. <!-- body_eof //-->
  226. <!-- footer //-->
  227. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  228. <!-- footer_eof //-->
  229. <br>
  230. </body>
  231. </html>
  232. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  233.  


cron