[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/ -> configuration.php (source)

   1  <?php
   2  //

   3  // +----------------------------------------------------------------------+

   4  // |zen-cart Open Source E-commerce                                       |

   5  // +----------------------------------------------------------------------+

   6  // | Copyright (c) 2003 The zen-cart developers                           |

   7  // |                                                                      |

   8  // | http://www.zen-cart.com/index.php                                    |

   9  // |                                                                      |

  10  // | Portions Copyright (c) 2003 osCommerce                               |

  11  // +----------------------------------------------------------------------+

  12  // | This source file is subject to version 2.0 of the GPL license,       |

  13  // | that is bundled with this package in the file LICENSE, and is        |

  14  // | available through the world-wide-web at the following url:           |

  15  // | http://www.zen-cart.com/license/2_0.txt.                             |

  16  // | If you did not receive a copy of the zen-cart license and are unable |

  17  // | to obtain it through the world-wide-web, please send a note to       |

  18  // | license@zen-cart.com so we can mail you a copy immediately.          |

  19  // +----------------------------------------------------------------------+

  20  //  $Id: configuration.php 3993 2006-07-20 21:46:55Z drbyte $

  21  //

  22  
  23  
  24    require ('includes/application_top.php');
  25  
  26    $action = (isset($_GET['action']) ? $_GET['action'] : '');
  27  
  28    if (zen_not_null($action)) {
  29      switch ($action) {
  30        case 'save':
  31          // demo active test

  32          if (zen_admin_demo()) {
  33            $_GET['action']= '';
  34            $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  35            zen_redirect(zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
  36          }
  37          $configuration_value = zen_db_prepare_input($_POST['configuration_value']);
  38          $cID = zen_db_prepare_input($_GET['cID']);
  39  
  40          $db->Execute("update " . TABLE_CONFIGURATION . "
  41                        set configuration_value = '" . zen_db_input($configuration_value) . "',
  42                            last_modified = now() where configuration_id = '" . (int)$cID . "'");
  43          $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  44                            from ' . TABLE_CONFIGURATION;
  45  
  46          $configuration = $db->Execute($configuration_query);
  47  
  48          // set the WARN_BEFORE_DOWN_FOR_MAINTENANCE to false if DOWN_FOR_MAINTENANCE = true

  49          if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'true') ) {
  50          $db->Execute("update " . TABLE_CONFIGURATION . "
  51                        set configuration_value = 'false', last_modified = '" . NOW . "'
  52                        where configuration_key = 'WARN_BEFORE_DOWN_FOR_MAINTENANCE'"); }
  53  
  54          $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  55                            from ' . TABLE_CONFIGURATION;
  56  
  57          $configuration = $db->Execute($configuration_query);
  58  
  59          zen_redirect(zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
  60          break;
  61      }
  62    }
  63  
  64    $gID = (isset($_GET['gID'])) ? $_GET['gID'] : 1;
  65    $_GET['gID'] = $gID;
  66    $cfg_group = $db->Execute("select configuration_group_title
  67                               from " . TABLE_CONFIGURATION_GROUP . "
  68                               where configuration_group_id = '" . (int)$gID . "'");
  69  
  70  if ($gID == 7) {
  71          $shipping_errors = '';
  72          if (zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == 'NONE' or zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == '') {
  73            $shipping_errors .= '<br />' . ERROR_SHIPPING_ORIGIN_ZIP;
  74          }
  75          if (zen_get_configuration_key_value('ORDER_WEIGHT_ZERO_STATUS') == '1' and !defined('MODULE_SHIPPING_FREESHIPPER_STATUS')) {
  76            $shipping_errors .= '<br />' . ERROR_ORDER_WEIGHT_ZERO_STATUS;
  77          }
  78          if (defined('MODULE_SHIPPING_USPS_STATUS') and (MODULE_SHIPPING_USPS_USERID=='NONE' or MODULE_SHIPPING_USPS_SERVER == 'test')) {
  79            $shipping_errors .= '<br />' . ERROR_USPS_STATUS;
  80          }
  81          if ($shipping_errors != '') {
  82            $messageStack->add(ERROR_SHIPPING_CONFIGURATION . $shipping_errors, 'caution');
  83          }
  84  }
  85  
  86  ?>
  87  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  88  <html <?php echo HTML_PARAMS; ?>>
  89  <head>
  90  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  91  <title><?php echo TITLE; ?></title>
  92  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  93  <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  94  <script language="javascript" src="includes/menu.js"></script>
  95  <script language="javascript" src="includes/general.js"></script>
  96  <script type="text/javascript">
  97    <!--
  98    function init()
  99    {
 100      cssjsmenu('navbar');
 101      if (document.getElementById)
 102      {
 103        var kill = document.getElementById('hoverJS');
 104        kill.disabled = true;
 105      }
 106    }
 107    // -->

 108  </script>
 109  </head>
 110  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="init()">
 111  <!-- header //-->
 112  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
 113  <!-- header_eof //-->
 114  
 115  <!-- body //-->
 116  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 117    <tr>
 118  <!-- body_text //-->
 119      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 120        <tr>
 121          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 122            <tr>
 123              <td class="pageHeading"><?php echo $cfg_group->fields['configuration_group_title']; ?></td>
 124              <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 125            </tr>
 126          </table></td>
 127        </tr>
 128        <tr>
 129          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 130            <tr>
 131              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 132                <tr class="dataTableHeadingRow">
 133                  <td class="dataTableHeadingContent" width="55%"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
 134                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
 135                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 136                </tr>
 137  <?php
 138    $configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
 139                                          use_function from " . TABLE_CONFIGURATION . "
 140                                          where configuration_group_id = '" . (int)$gID . "'
 141                                          order by sort_order");
 142    while (!$configuration->EOF) {
 143      if (zen_not_null($configuration->fields['use_function'])) {
 144        $use_function = $configuration->fields['use_function'];
 145        if (ereg('->', $use_function)) {
 146          $class_method = explode('->', $use_function);
 147          if (!is_object(${$class_method[0]})) {
 148            include(DIR_WS_CLASSES . $class_method[0] . '.php');
 149            ${$class_method[0]} = new $class_method[0]();
 150          }
 151          $cfgValue = zen_call_function($class_method[1], $configuration->fields['configuration_value'], ${$class_method[0]});
 152        } else {
 153          $cfgValue = zen_call_function($use_function, $configuration->fields['configuration_value']);
 154        }
 155      } else {
 156        $cfgValue = $configuration->fields['configuration_value'];
 157      }
 158  
 159      if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $configuration->fields['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
 160        $cfg_extra = $db->Execute("select configuration_key, configuration_description, date_added,
 161                                          last_modified, use_function, set_function
 162                                   from " . TABLE_CONFIGURATION . "
 163                                   where configuration_id = '" . (int)$configuration->fields['configuration_id'] . "'");
 164        $cInfo_array = array_merge($configuration->fields, $cfg_extra->fields);
 165        $cInfo = new objectInfo($cInfo_array);
 166      }
 167  
 168      if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) {
 169        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";
 170      } else {
 171        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";
 172      }
 173  ?>
 174                  <td class="dataTableContent"><?php echo $configuration->fields['configuration_title']; ?></td>
 175                  <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
 176                  <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']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 177                </tr>
 178  <?php
 179      $configuration->MoveNext();
 180    }
 181  ?>
 182              </table></td>
 183  <?php
 184    $heading = array();
 185    $contents = array();
 186  
 187    switch ($action) {
 188      case 'edit':
 189        $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
 190  
 191        if ($cInfo->set_function) {
 192          eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
 193        } else {
 194          $value_field = zen_draw_input_field('configuration_value', $cInfo->configuration_value, 'size="60"');
 195        }
 196  
 197        $contents = array('form' => zen_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));
 198        if (ADMIN_CONFIGURATION_KEY_ON == 1) {
 199          $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
 200        }
 201        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
 202        $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
 203        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 204        break;
 205      default:
 206        if (isset($cInfo) && is_object($cInfo)) {
 207          $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
 208          if (ADMIN_CONFIGURATION_KEY_ON == 1) {
 209            $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
 210          }
 211  
 212          $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>');
 213          $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
 214          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . zen_date_short($cInfo->date_added));
 215          if (zen_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . zen_date_short($cInfo->last_modified));
 216        }
 217        break;
 218    }
 219  
 220    if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
 221      echo '            <td width="25%" valign="top">' . "\n";
 222  
 223      $box = new box;
 224      echo $box->infoBox($heading, $contents);
 225  
 226      echo '            </td>' . "\n";
 227    }
 228  ?>
 229            </tr>
 230          </table></td>
 231        </tr>
 232      </table></td>
 233  <!-- body_text_eof //-->
 234    </tr>
 235  </table>
 236  <!-- body_eof //-->
 237  
 238  <!-- footer //-->
 239  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 240  <!-- footer_eof //-->
 241  <br>
 242  </body>
 243  </html>
 244  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics