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

Zen Cart 源代码 countries.php




下载文件

文件名: countries.php
文件类型: PHP文件
文件大小: 13.24 KiB
MD5: fca707d0b25709533680783b7fc74d4e

countries.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2009 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: countries.php 14139 2009-08-10 13:46:02Z wilt $
  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.         $countries_name = zen_db_prepare_input($_POST['countries_name']);
  18.         $countries_iso_code_2 = zen_db_prepare_input($_POST['countries_iso_code_2']);
  19.         $countries_iso_code_3 = zen_db_prepare_input($_POST['countries_iso_code_3']);
  20.         $address_format_id = zen_db_prepare_input($_POST['address_format_id']);
  21.  
  22.         $db->Execute("insert into " . TABLE_COUNTRIES . "
  23.                    (countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id)
  24.                    values ('" . zen_db_input($countries_name) . "',
  25.                            '" . zen_db_input($countries_iso_code_2) . "',
  26.                            '" . zen_db_input($countries_iso_code_3) . "',
  27.                            '" . (int)$address_format_id . "')");
  28.  
  29.         zen_redirect(zen_href_link(FILENAME_COUNTRIES));
  30.         break;
  31.       case 'save':
  32.         $countries_id = zen_db_prepare_input($_GET['cID']);
  33.         $countries_name = zen_db_prepare_input($_POST['countries_name']);
  34.         $countries_iso_code_2 = zen_db_prepare_input($_POST['countries_iso_code_2']);
  35.         $countries_iso_code_3 = zen_db_prepare_input($_POST['countries_iso_code_3']);
  36.         $address_format_id = zen_db_prepare_input($_POST['address_format_id']);
  37.  
  38.         $db->Execute("update " . TABLE_COUNTRIES . "
  39.                      set countries_name = '" . zen_db_input($countries_name) . "',
  40.                          countries_iso_code_2 = '" . zen_db_input($countries_iso_code_2) . "',
  41.                          countries_iso_code_3 = '" . zen_db_input($countries_iso_code_3) . "',
  42.                          address_format_id = '" . (int)$address_format_id . "'
  43.                      where countries_id = '" . (int)$countries_id . "'");
  44.  
  45.         zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries_id));
  46.         break;
  47.       case 'deleteconfirm':
  48.         // demo active test
  49.         if (zen_admin_demo()) {
  50.           $_GET['action']= '';
  51.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  52.           zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']));
  53.         }
  54.         $countries_id = zen_db_prepare_input($_GET['cID']);
  55.         $sql = "select entry_country_id from " . TABLE_ADDRESS_BOOK . " where entry_country_id = :countryID: LIMIT 1";
  56.         $sql = $db->bindVars($sql, ':countryID:', $countries_id, 'integer');
  57.         $result = $db->Execute($sql);
  58.         if ($result->recordCount() == 0) {
  59.           $db->Execute("delete from " . TABLE_COUNTRIES . "
  60.                        where countries_id = '" . (int)$countries_id . "'");
  61.         } else {
  62.           $messageStack->add_session(ERROR_COUNTRY_IN_USE, 'error');
  63.         }
  64.  
  65.         zen_redirect(zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']));
  66.         break;
  67.     }
  68.   }
  69. ?>
  70. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  71. <html <?php echo HTML_PARAMS; ?>>
  72. <head>
  73. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  74. <title><?php echo TITLE; ?></title>
  75. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  76. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  77. <script language="javascript" src="includes/menu.js"></script>
  78. <script language="javascript" src="includes/general.js"></script>
  79. <script type="text/javascript">
  80.   <!--
  81.   function init()
  82.   {
  83.     cssjsmenu('navbar');
  84.     if (document.getElementById)
  85.     {
  86.       var kill = document.getElementById('hoverJS');
  87.       kill.disabled = true;
  88.     }
  89.   }
  90.   // -->
  91. </script>
  92. </head>
  93. <body onload="init()">
  94. <!-- header //-->
  95. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  96. <!-- header_eof //-->
  97.  
  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" align="center" colspan="2"><?php echo TABLE_HEADING_COUNTRY_CODES; ?></td>
  118.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  119.               </tr>
  120. <?php
  121.   $countries_query_raw = "select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id from " . TABLE_COUNTRIES . " order by countries_name";
  122.   $countries_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $countries_query_raw, $countries_query_numrows);
  123.   $countries = $db->Execute($countries_query_raw);
  124.   while (!$countries->EOF) {
  125.     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $countries->fields['countries_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  126.       $cInfo = new objectInfo($countries->fields);
  127.     }
  128.  
  129.     if (isset($cInfo) && is_object($cInfo) && ($countries->fields['countries_id'] == $cInfo->countries_id)) {
  130.       echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '\'">' . "\n";
  131.     } else {
  132.       echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries->fields['countries_id']) . '\'">' . "\n";
  133.     }
  134. ?>
  135.                 <td class="dataTableContent"><?php echo $countries->fields['countries_name']; ?></td>
  136.                 <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_2']; ?></td>
  137.                 <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_3']; ?></td>
  138.                 <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($countries->fields['countries_id'] == $cInfo->countries_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries->fields['countries_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  139.               </tr>
  140. <?php
  141.     $countries->MoveNext();
  142.   }
  143. ?>
  144.               <tr>
  145.                 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  146.                   <tr>
  147.                     <td class="smallText" valign="top"><?php echo $countries_split->display_count($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?></td>
  148.                     <td class="smallText" align="right"><?php echo $countries_split->display_links($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  149.                   </tr>
  150. <?php
  151.   if (empty($action)) {
  152. ?>
  153.                   <tr>
  154.                     <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_country.gif', IMAGE_NEW_COUNTRY) . '</a>'; ?></td>
  155.                   </tr>
  156. <?php
  157.   }
  158. ?>
  159.                 </table></td>
  160.               </tr>
  161.             </table></td>
  162. <?php
  163.   $heading = array();
  164.   $contents = array();
  165.  
  166.   switch ($action) {
  167.     case 'new':
  168.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_COUNTRY . '</b>');
  169.  
  170.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=insert'));
  171.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  172.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name'));
  173.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2'));
  174.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3'));
  175.       $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . zen_draw_pull_down_menu('address_format_id', zen_get_address_formats()));
  176.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  177.       break;
  178.     case 'edit':
  179.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_COUNTRY . '</b>');
  180.  
  181.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=save'));
  182.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  183.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name', $cInfo->countries_name));
  184.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2', $cInfo->countries_iso_code_2));
  185.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3', $cInfo->countries_iso_code_3));
  186.       $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . zen_draw_pull_down_menu('address_format_id', zen_get_address_formats(), $cInfo->address_format_id));
  187.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  188.       break;
  189.     case 'delete':
  190.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_COUNTRY . '</b>');
  191.  
  192.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=deleteconfirm'));
  193.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  194.       $contents[] = array('text' => '<br><b>' . $cInfo->countries_name . '</b>');
  195.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  196.       break;
  197.     default:
  198.       if (is_object($cInfo)) {
  199.         $heading[] = array('text' => '<b>' . $cInfo->countries_name . '</b>');
  200.  
  201.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  202.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . $cInfo->countries_name);
  203.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . ' ' . $cInfo->countries_iso_code_2);
  204.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . ' ' . $cInfo->countries_iso_code_3);
  205.         $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . ' ' . $cInfo->address_format_id);
  206.       }
  207.       break;
  208.   }
  209.  
  210.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  211.     echo '            <td width="25%" valign="top">' . "\n";
  212.  
  213.     $box = new box;
  214.     echo $box->infoBox($heading, $contents);
  215.  
  216.     echo '            </td>' . "\n";
  217.   }
  218. ?>
  219.           </tr>
  220.         </table></td>
  221.       </tr>
  222.     </table></td>
  223. <!-- body_text_eof //-->
  224.   </tr>
  225. </table>
  226. <!-- body_eof //-->
  227.  
  228. <!-- footer //-->
  229. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  230. <!-- footer_eof //-->
  231. <br>
  232. </body>
  233. </html>
  234. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron