<?php
/*

  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd 
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );
  require('includes/application_top.php');

  // #CP - local dir to the template directory where you are uploading the company logo
  tep_get_last_access_file();
  
  $gID=(isset($HTTP_GET_VARS['gID'])?$HTTP_GET_VARS['gID']:'');
  
  $cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$gID . "'");
  
  $cfg_group = tep_db_fetch_array($cfg_group_query);
  if(strtolower($cfg_group['configuration_group_title'])=='shop settings general')
  	$heading_title=HEADING_GENERAL_OPTIONS;
  else if (strtolower($cfg_group['configuration_group_title'])=='shop settings advanced')
  	$heading_title=HEADING_ADVANCED_OPTIONS;
	
  $upload_fs_dir = DIR_FS_TEMPLATES.$CURR_TEMPLATE.DIR_WS_IMAGES;
	
  $configuration_query=tep_db_query("select * from " . TABLE_CONFIGURATION ." where configuration_group_id='".$gID."' order by sort_order");
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr> 
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
		  <tr>
		  	<td colspan="2">
				<table cellpadding="10" cellspacing="10" border="0" width="100%">
		  <tr>
			<td colspan="2">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td class="dataTableHeadingContent"><?php echo $heading_title;?>
						</td>
					</tr>	
				</table>
			</td>
		  </tr>
		  <tr>
		  	<td>
				<table cellpadding="0" cellspacing="2" border="0" width="100%">
		  <?php while($configuration_result=tep_db_fetch_array($configuration_query)){ 
					  $directory_writeable = true;
					  if (!is_writeable($upload_fs_dir)) {
						$directory_writeable = false;
						$messageStack->add(sprintf(ERROR_DIRECTORY_NOT_WRITEABLE, $upload_fs_dir), 'error');
					  }
					 $config_key=$cInfo->configuration_key;
		  			 $cInfo = new objectInfo($configuration_result);
					 if($cInfo->configuration_key!='COMPANY_LOGO'){
						  if ($cInfo->set_function) {
							eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
						  } else {
							$value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
						  }
					 }  else{
					 		$value_field = tep_draw_file_field('file_name') ;
					 }
		  ?>
		  	<tr>
				<td class="main" colspan="2"><b><?php echo $cInfo->configuration_description;?></b>
				</td>
			</tr>	
			<!--<tr>
				<td colspan="2"><?php //echo tep_draw_separator("pixel_trans.gif",1,5);?></td>
			</tr>	-->
			<tr>	
				<td class="dataTableContent" colspan="2" valign="top"><?php echo $cInfo->configuration_title. tep_draw_separator("pixel_trans.gif",20,20) . $value_field;?></td>
				<!--<td class="main" valign="top">
				<?php	//echo $value_field;?></td>-->
			</tr>
			<tr>
				<td height="5"></td>
			</tr>	
			<tr>
				<td colspan="2" bgcolor="#d5d5d5" height="1" valign="bottom">	</td>
			</tr>
			<tr>
				<td colspan="2" height="10"></td>
			</tr>		
		  <?php } // while?>
		  </table>
		 </td> 
		  </tr>
		 </table>
		</td>
	</tr>	  
        </table></td>
      </tr>    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>