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

Zen Cart 源代码 configuration.php




下载文件

文件名: configuration.php
文件类型: PHP文件
文件大小: 11.79 KiB
MD5: f2372e71d02deb60b8f752edf517ce6a

configuration.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2012 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 GIT: $Id: Author: Ian Wilson  Thu Aug 16 12:36:12 2012 +0100 Modified in v1.5.1 $
  8.  */
  9.  
  10.  
  11.   require('includes/application_top.php');
  12.  
  13.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  14.  
  15.   if (zen_not_null($action)) {
  16.     switch ($action) {
  17.       case 'save':
  18.         // demo active test
  19.         if (zen_admin_demo()) {
  20.           $_GET['action']= '';
  21.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  22.           zen_redirect(zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
  23.         }
  24.         $configuration_value = zen_db_prepare_input($_POST['configuration_value']);
  25.         $cID = zen_db_prepare_input($_GET['cID']);
  26.  
  27.         $db->Execute("update " . TABLE_CONFIGURATION . "
  28.                      set configuration_value = '" . zen_db_input($configuration_value) . "',
  29.                          last_modified = now() where configuration_id = '" . (int)$cID . "'");
  30.         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  31.                          from ' . TABLE_CONFIGURATION;
  32.  
  33.         $configuration = $db->Execute($configuration_query);
  34.  
  35.         // set the WARN_BEFORE_DOWN_FOR_MAINTENANCE to false if DOWN_FOR_MAINTENANCE = true
  36.         if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'true') ) {
  37.         $db->Execute("update " . TABLE_CONFIGURATION . "
  38.                      set configuration_value = 'false', last_modified = '" . NOW . "'
  39.                      where configuration_key = 'WARN_BEFORE_DOWN_FOR_MAINTENANCE'"); }
  40.  
  41.         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  42.                          from ' . TABLE_CONFIGURATION;
  43.  
  44.         $configuration = $db->Execute($configuration_query);
  45.  
  46.         zen_redirect(zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
  47.         break;
  48.     }
  49.   }
  50.  
  51.   $gID = (isset($_GET['gID'])) ? $_GET['gID'] : 1;
  52.   $_GET['gID'] = $gID;
  53.   $cfg_group = $db->Execute("select configuration_group_title
  54.                             from " . TABLE_CONFIGURATION_GROUP . "
  55.                             where configuration_group_id = '" . (int)$gID . "'");
  56.  
  57. if ($gID == 7) {
  58.         $shipping_errors = '';
  59.         if (zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == 'NONE' or zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == '') {
  60.           $shipping_errors .= '<br />' . ERROR_SHIPPING_ORIGIN_ZIP;
  61.         }
  62.         if (zen_get_configuration_key_value('ORDER_WEIGHT_ZERO_STATUS') == '1' and !defined('MODULE_SHIPPING_FREESHIPPER_STATUS')) {
  63.           $shipping_errors .= '<br />' . ERROR_ORDER_WEIGHT_ZERO_STATUS;
  64.         }
  65.         if (defined('MODULE_SHIPPING_USPS_STATUS') and (MODULE_SHIPPING_USPS_USERID=='NONE' or MODULE_SHIPPING_USPS_SERVER == 'test')) {
  66.           $shipping_errors .= '<br />' . ERROR_USPS_STATUS;
  67.         }
  68.         if ($shipping_errors != '') {
  69.           $messageStack->add(ERROR_SHIPPING_CONFIGURATION . $shipping_errors, 'caution');
  70.         }
  71. }
  72.  
  73. ?>
  74. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  75. <html <?php echo HTML_PARAMS; ?>>
  76. <head>
  77. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  78. <title><?php echo TITLE; ?></title>
  79. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  80. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  81. <script language="javascript" src="includes/menu.js"></script>
  82. <script language="javascript" src="includes/general.js"></script>
  83. <script type="text/javascript">
  84.   <!--
  85.   function init()
  86.   {
  87.     cssjsmenu('navbar');
  88.     if (document.getElementById)
  89.     {
  90.       var kill = document.getElementById('hoverJS');
  91.       kill.disabled = true;
  92.     }
  93.   }
  94.   // -->
  95. </script>
  96. </head>
  97. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="init()">
  98. <!-- header //-->
  99. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  100. <!-- header_eof //-->
  101.  
  102. <!-- body //-->
  103. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  104.   <tr>
  105. <!-- body_text //-->
  106.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  107.       <tr>
  108.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  109.           <tr>
  110.             <td class="pageHeading"><?php echo $cfg_group->fields['configuration_group_title']; ?></td>
  111.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  112.           </tr>
  113.         </table></td>
  114.       </tr>
  115.       <tr>
  116.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  117.           <tr>
  118.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  119.               <tr class="dataTableHeadingRow">
  120.                 <td class="dataTableHeadingContent" width="55%"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
  121.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
  122.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  123.               </tr>
  124. <?php
  125.   $configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
  126.                                        use_function from " . TABLE_CONFIGURATION . "
  127.                                        where configuration_group_id = '" . (int)$gID . "'
  128.                                        order by sort_order");
  129.   while (!$configuration->EOF) {
  130.     if (zen_not_null($configuration->fields['use_function'])) {
  131.       $use_function = $configuration->fields['use_function'];
  132.       if (preg_match('/->/', $use_function)) {
  133.         $class_method = explode('->', $use_function);
  134.         if (!is_object(${$class_method[0]})) {
  135.           include(DIR_WS_CLASSES . $class_method[0] . '.php');
  136.           ${$class_method[0]} = new $class_method[0]();
  137.         }
  138.         $cfgValue = zen_call_function($class_method[1], $configuration->fields['configuration_value'], ${$class_method[0]});
  139.       } else {
  140.         $cfgValue = zen_call_function($use_function, $configuration->fields['configuration_value']);
  141.       }
  142.     } else {
  143.       $cfgValue = $configuration->fields['configuration_value'];
  144.     }
  145.  
  146.     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $configuration->fields['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  147.       $cfg_extra = $db->Execute("select configuration_key, configuration_description, date_added,
  148.                                        last_modified, use_function, set_function
  149.                                 from " . TABLE_CONFIGURATION . "
  150.                                 where configuration_id = '" . (int)$configuration->fields['configuration_id'] . "'");
  151.       $cInfo_array = array_merge($configuration->fields, $cfg_extra->fields);
  152.       $cInfo = new objectInfo($cInfo_array);
  153.     }
  154.  
  155.     if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) {
  156.       echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '\'">' . "\n";
  157.     } else {
  158.       echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $configuration->fields['configuration_id'] . '&action=edit') . '\'">' . "\n";
  159.     }
  160. ?>
  161.                 <td class="dataTableContent"><?php echo $configuration->fields['configuration_title']; ?></td>
  162.                 <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue, ENT_COMPAT, CHARSET, TRUE); ?></td>
  163.                 <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $configuration->fields['configuration_id']) . '" name="link_' . $configuration->fields['configuration_key'] . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  164.               </tr>
  165. <?php
  166.     $configuration->MoveNext();
  167.   }
  168. ?>
  169.             </table></td>
  170. <?php
  171.   $heading = array();
  172.   $contents = array();
  173.  
  174.   switch ($action) {
  175.     case 'edit':
  176.       $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
  177.  
  178.       if ($cInfo->set_function) {
  179.         eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value, ENT_COMPAT, CHARSET, TRUE) . '");');
  180.       } else {
  181.         $value_field = zen_draw_input_field('configuration_value', htmlspecialchars($cInfo->configuration_value, ENT_COMPAT, CHARSET, TRUE), 'size="60"');
  182.       }
  183.  
  184.       $contents = array('form' => zen_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));
  185.       if (ADMIN_CONFIGURATION_KEY_ON == 1) {
  186.         $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
  187.       }
  188.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  189.       $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
  190.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE, 'name="submit' . $cInfo->configuration_key . '"') . '&nbsp;<a href="' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  191.       break;
  192.     default:
  193.       if (isset($cInfo) && is_object($cInfo)) {
  194.         $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
  195.         if (ADMIN_CONFIGURATION_KEY_ON == 1) {
  196.           $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
  197.         }
  198.  
  199.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
  200.         $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
  201.         $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($cInfo->date_added));
  202.         if (zen_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($cInfo->last_modified));
  203.       }
  204.       break;
  205.   }
  206.  
  207.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  208.     echo '            <td width="25%" valign="top">' . "\n";
  209.  
  210.     $box = new box;
  211.     echo $box->infoBox($heading, $contents);
  212.  
  213.     echo '            </td>' . "\n";
  214.   }
  215. ?>
  216.           </tr>
  217.         </table></td>
  218.       </tr>
  219.     </table></td>
  220. <!-- body_text_eof //-->
  221.   </tr>
  222. </table>
  223. <!-- body_eof //-->
  224.  
  225. <!-- footer //-->
  226. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  227. <!-- footer_eof //-->
  228. <br>
  229. </body>
  230. </html>
  231. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron