[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.63 KiB
MD5: 418121a426c0968aff8b45171d9bce0c

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


cron