<?php
/* 
	osCommerce, Open Source E-Commerce Solutions 
	http://www.oscommerce.com 
	
	Copyright (c) 2003 osCommerce 
	
	osCommRes, Services Oline 
	http://www.oscommres.com 
	Copyright (c) 2005 osCommRes 
	
	Freeway eCommerce 
	http://www.zac-ware.com/freeway 
	Copyright (c) 2007 ZacWare 
	
	Released under the GNU General Public License 
*/ 
  //$cookie_path = substr(dirname(getenv('SCRIPT_NAME')), 0, -7);
  $script_filename = getenv('PATH_TRANSLATED');
  if (empty($script_filename)) $script_filename = getenv('SCRIPT_FILENAME');
  if (empty($script_filename)) $script_filename = $_SERVER["SCRIPT_FILENAME"];
  
  $script_filename = str_replace('\\', '/', $script_filename);
  $script_filename = str_replace('//', '/', $script_filename);
  
  $script_name=$_SERVER['PHP_SELF'];   
    
  $cookie_path = substr(dirname($script_name), 0, -7);
  
  $www_location = 'http://' . $_SERVER['HTTP_HOST'] . $script_name;  
  $www_location = substr($www_location, 0, strpos($www_location, '/install')) ."/";
  
   
  $dir_fs_www_root_array = explode('/', dirname($script_filename));
  $dir_fs_www_root = array();
  for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++)
  	$dir_fs_www_root[] = $dir_fs_www_root_array[$i];
  $dir_fs_www_root = implode('/', $dir_fs_www_root) . '/';  
  $current_step="config";
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<form name="install" action="install.php?step=5" method="post">
	<tr>
		<td>
		<?php echo osc_draw_box_start();?>
		<table width="100%" border="0" cellpadding="5" class="formPage">
			<tr>
				<td><?php echo osc_title_bar('Please enter the web server information:');?></td>
			</tr>
			<tr>
				<td style="padding-left:10px">
				<table width="100%" border="0" cellpadding="2" class="formPage">
				  <tr>
					<td width="30%" valign="top">WWW Address:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_input_field('HTTP_WWW_ADDRESS', $www_location,'','size=50'); ?>
					  <img src="images/layout/help_icon.gif" onClick="toggleBox('dbWWW');" align="absmiddle"><br>
					  <div id="dbWWWSD">The full website address to the online store</div>
					  <div id="dbWWW" class="longDescription">The web address to the online store, for example <i>http://www.my-server.com/catalog/</i></div>
					</td>
				  </tr>
				  <tr>
					<td width="30%" valign="top">Webserver Root Directory:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_input_field('DIR_FS_DOCUMENT_ROOT', $dir_fs_www_root,'','size=50'); ?>
					  <img src="images/layout/help_icon.gif"  onClick="toggleBox('dbRoot');" align="absmiddle"><br>
					  <div id="dbRootSD">The server path to the online store</div>
						<div id="dbRoot" class="longDescription">The directory where osCommRes 
						  is installed on the server, for example <i>/home/myname/public_html/osCommRes/</i></div>
					</td>
				  </tr>
				  <tr>
					<td width="30%" valign="top">HTTP Cookie Domain:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_input_field('HTTP_COOKIE_DOMAIN', $_SERVER['HTTP_HOST'],'','size=50'); ?>
					  <img src="images/layout/help_icon.gif" onClick="toggleBox('dbCookieD');"  align="absmiddle"><br>
					  <div id="dbCookieDSD">The domain to store cookies in</div>
					  <div id="dbCookieD" class="longDescription">The full or top-level domain to store the cookies in, for example <i>.my-server.com</i></div>
					</td>
				  </tr>
				  <tr>
					<td width="30%" valign="top">HTTP Cookie Path:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_input_field('HTTP_COOKIE_PATH', $cookie_path,'','size=50'); ?>
					  <img src="images/layout/help_icon.gif" onClick="toggleBox('dbCookieP');"  align="absmiddle"><br>
					  <div id="dbCookiePSD">The path to store cookies under</div>
					  <div id="dbCookieP" class="longDescription">The web address to limit the cookie to, for example <i>/catalog/</i></div>
					</td>
				  </tr>
				<tr>
					 <td width="30%" valign="top">Home Page Link:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_input_field('HTTP_HOME_URL',$www_location,'','size=50'); ?>
					   <img src="images/layout/help_icon.gif" onClick="toggleBox('homeurl');"  align="absmiddle"><br>
					  <div id="homeurlSD">Home Link</div>
					  <div id="homeurl" class="longDescription">The home url path, for example  <i>http://www.yoursite.com</i></div>
					</td>
				</td>
				  </tr>
				  <tr>
					<td width="30%" valign="top">Enable SSL Connections:</td>
					<td width="70%" class="smallDesc">
					  <?php echo osc_draw_checkbox_field('ENABLE_SSL', 'true'); ?>
					  <img src="images/layout/help_icon.gif" onClick="toggleBox('dbSSL');"  align="absmiddle"><br>
					  <div id="dbSSLSD"></div>
					  <div id="dbSSL" class="longDescription">Enable secure SSL/HTTPS connections (requires a secure certificate installed on the web server)</div>
					</td>
				  </tr>
				</table>
				<td>
			</tr>
		</table>
		<?php echo osc_draw_box_end();?>
		</td>
	</tr>
	<tr>
		<td>
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
			<td align="right"><input type="image" src="images/button_continue.gif" border="0" alt="Continue" class="imageButton"></td>
		  </tr>
		</table>
<?php
  reset($HTTP_POST_VARS);
  while (list($key, $value) = each($HTTP_POST_VARS)) {
    if (($key != 'x') && ($key != 'y')) {
      if (is_array($value)) {
        for ($i=0; $i<sizeof($value); $i++) {
          echo osc_draw_hidden_field($key . '[]', $value[$i]);
        }
      } else {
        echo osc_draw_hidden_field($key, $value);
      }
    }
  }
  echo osc_draw_hidden_field('install[]', 'configure');
?>
	</td>
  </tr>
</form>
</table>