[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.45 KiB
MD5: 06a8deeba0d53f5a08c707863ba802cc

countries.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: countries.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.         $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($_POST['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 class="smallText" align="center" width="350" valign="top"><?php echo ISO_COUNTRY_CODES_LINK; ?></td>
  113.       </tr>
  114.       <tr>
  115.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  116.           <tr>
  117.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  118.               <tr class="dataTableHeadingRow">
  119.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_COUNTRY_NAME; ?></td>
  120.                 <td class="dataTableHeadingContent" align="center" colspan="2"><?php echo TABLE_HEADING_COUNTRY_CODES; ?></td>
  121.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  122.               </tr>
  123. <?php
  124.   $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";
  125.   $countries_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $countries_query_raw, $countries_query_numrows);
  126.   $countries = $db->Execute($countries_query_raw);
  127.   while (!$countries->EOF) {
  128.     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $countries->fields['countries_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  129.       $cInfo = new objectInfo($countries->fields);
  130.     }
  131.  
  132.     if (isset($cInfo) && is_object($cInfo) && ($countries->fields['countries_id'] == $cInfo->countries_id)) {
  133.       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";
  134.     } else {
  135.       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";
  136.     }
  137. ?>
  138.                 <td class="dataTableContent"><?php echo $countries->fields['countries_name']; ?></td>
  139.                 <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_2']; ?></td>
  140.                 <td class="dataTableContent" align="center" width="40"><?php echo $countries->fields['countries_iso_code_3']; ?></td>
  141.                 <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>
  142.               </tr>
  143. <?php
  144.     $countries->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 $countries_split->display_count($countries_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_COUNTRIES); ?></td>
  151.                     <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>
  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_COUNTRIES, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_country.gif', IMAGE_NEW_COUNTRY) . '</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_COUNTRY . '</b>');
  172.  
  173.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=insert'));
  174.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  175.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name'));
  176.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2'));
  177.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3'));
  178.       $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . '<br>' . zen_draw_pull_down_menu('address_format_id', zen_get_address_formats()));
  179.       $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>');
  180.       break;
  181.     case 'edit':
  182.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_COUNTRY . '</b>');
  183.  
  184.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $cInfo->countries_id . '&action=save'));
  185.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  186.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . zen_draw_input_field('countries_name', htmlspecialchars($cInfo->countries_name, ENT_COMPAT, CHARSET, TRUE)));
  187.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . '<br>' . zen_draw_input_field('countries_iso_code_2', $cInfo->countries_iso_code_2));
  188.       $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . '<br>' . zen_draw_input_field('countries_iso_code_3', $cInfo->countries_iso_code_3));
  189.       $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));
  190.       $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>');
  191.       break;
  192.     case 'delete':
  193.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_COUNTRY . '</b>');
  194.  
  195.       $contents = array('form' => zen_draw_form('countries', FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('cID', $cInfo->countries_id));
  196.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  197.       $contents[] = array('text' => '<br><b>' . $cInfo->countries_name . '</b>');
  198.       $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>');
  199.       break;
  200.     default:
  201.       if (is_object($cInfo)) {
  202.         $heading[] = array('text' => '<b>' . $cInfo->countries_name . '</b>');
  203.  
  204.         $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>');
  205.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_NAME . '<br>' . $cInfo->countries_name);
  206.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_2 . ' ' . $cInfo->countries_iso_code_2);
  207.         $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY_CODE_3 . ' ' . $cInfo->countries_iso_code_3);
  208.         $contents[] = array('text' => '<br>' . TEXT_INFO_ADDRESS_FORMAT . ' ' . $cInfo->address_format_id);
  209.       }
  210.       break;
  211.   }
  212.  
  213.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  214.     echo '            <td width="25%" valign="top">' . "\n";
  215.  
  216.     $box = new box;
  217.     echo $box->infoBox($heading, $contents);
  218.  
  219.     echo '            </td>' . "\n";
  220.   }
  221. ?>
  222.           </tr>
  223.         </table></td>
  224.       </tr>
  225.     </table></td>
  226. <!-- body_text_eof //-->
  227.   </tr>
  228. </table>
  229. <!-- body_eof //-->
  230.  
  231. <!-- footer //-->
  232. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  233. <!-- footer_eof //-->
  234. <br>
  235. </body>
  236. </html>
  237. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron