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

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