[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> articles_config.php (source)

   1  <?php
   2  /*

   3  $Id: articles_config.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    // Set configuration ID

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


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