[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> configuration.php (source)

   1  <?php
   2  /*

   3  $Id: configuration.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16  
  17    if (tep_not_null($action)) {
  18      switch ($action) {
  19        case 'save':
  20          $configuration_value = tep_db_prepare_input($HTTP_POST_VARS['configuration_value']);
  21          $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
  22  
  23          tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");
  24  // BOF: MOD - Down for Maintenance

  25          // set the WARN_BEFORE_DOWN_FOR_MAINTENANCE to false if DOWN_FOR_MAINTENANCE = true

  26          if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'true') ) {
  27          tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'false', last_modified = '" . NOW . "' where configuration_key = 'WARN_BEFORE_DOWN_FOR_MAINTENANCE'"); }
  28          // Insert these two lines to fix setting start time 

  29          // Requires adding a record to the MySQL Configuration Table 

  30          // I used 

  31          // configuration_id = 391 

  32          // configuration_title = when webmaster enabled maintenance 

  33          // configuration_key = TEXT_DATE_TIME 

  34          // configuration_value = (set by this code) 

  35          // configuration_desription = Display when webmaster has enabled maintenance 

  36          // configuration_group_id = 16 

  37          // sort_order = 14 

  38  
  39  // Set time of maintenance start 

  40          if ( $cID == 378 ) { 
  41          tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = now(), last_modified = now() where configuration_key = 'TEXT_DATE_TIME'"); } 
  42  //End of Set time of maintenance start 

  43  // EOF: MOD - Down for Maintenance

  44  
  45          tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
  46          break;
  47      }
  48    }
  49  
  50    $gID = (isset($HTTP_GET_VARS['gID'])) ? $HTTP_GET_VARS['gID'] : 1;
  51  
  52    $cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$gID . "'");
  53    $cfg_group = tep_db_fetch_array($cfg_group_query);
  54  ?>
  55  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  56  <html <?php echo HTML_PARAMS; ?>>
  57  <head>
  58  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  59  <title><?php echo TITLE; ?></title>
  60  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  61  <script language="javascript" src="includes/general.js"></script>
  62  </head>
  63  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
  64  <!-- header //-->
  65  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  66  <!-- header_eof //-->
  67  
  68  <!-- body //-->
  69  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  70    <tr>
  71      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  72  <!-- left_navigation //-->
  73  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  74  <!-- left_navigation_eof //-->
  75      </table></td>
  76  <!-- body_text //-->
  77      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  78        <tr>
  79          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  80            <tr>
  81              <td class="pageHeading"><?php echo $cfg_group['configuration_group_title']; ?></td>
  82              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  83            </tr>
  84          </table></td>
  85        </tr>
  86        <tr>
  87          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  88            <tr>
  89              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  90                <tr class="dataTableHeadingRow">
  91                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
  92                  <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
  93                  <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  94                </tr>
  95  <?php
  96    $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gID . "' order by sort_order");
  97    while ($configuration = tep_db_fetch_array($configuration_query)) {
  98      if (tep_not_null($configuration['use_function'])) {
  99        $use_function = $configuration['use_function'];
 100        if (ereg('->', $use_function)) {
 101          $class_method = explode('->', $use_function);
 102          if (!is_object(${$class_method[0]})) {
 103            include(DIR_WS_CLASSES . $class_method[0] . '.php');
 104            ${$class_method[0]} = new $class_method[0]();
 105          }
 106          $cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
 107        } else {
 108          $cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
 109        }
 110      } else {
 111        $cfgValue = $configuration['configuration_value'];
 112      }
 113  
 114      if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
 115        $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
 116        $cfg_extra = tep_db_fetch_array($cfg_extra_query);
 117  
 118        $cInfo_array = array_merge($configuration, $cfg_extra);
 119        $cInfo = new objectInfo($cInfo_array);
 120      }
 121  
 122      if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) {
 123        echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '\'">' . "\n";
 124      } else {
 125        echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '\'">' . "\n";
 126      }
 127  ?>
 128                  <td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>
 129                  <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
 130                  <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
 131                </tr>
 132  <?php
 133    }
 134  ?>
 135              </table></td>
 136  <?php
 137    $heading = array();
 138    $contents = array();
 139  
 140    switch ($action) {
 141      case 'edit':
 142        $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
 143  
 144        if ($cInfo->set_function) {
 145          eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
 146        } else {
 147          $value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
 148        }
 149  
 150        $contents = array('form' => tep_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));
 151        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
 152        $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
 153        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
 154        break;
 155      default:
 156        if (isset($cInfo) && is_object($cInfo)) {
 157          $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
 158  
 159          $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
 160          $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
 161          $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));
 162          if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));
 163        }
 164        break;
 165    }
 166  
 167    if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
 168      echo '            <td width="25%" valign="top">' . "\n";
 169  
 170      $box = new box;
 171      echo $box->infoBox($heading, $contents);
 172  
 173      echo '            </td>' . "\n";
 174    }
 175  ?>
 176            </tr>
 177          </table></td>
 178        </tr>
 179      </table></td>
 180  <!-- body_text_eof //-->
 181    </tr>
 182  </table>
 183  <!-- body_eof //-->
 184  
 185  <!-- footer //-->
 186  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 187  <!-- footer_eof //-->
 188  <br>
 189  </body>
 190  </html>
 191  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7