<?php


  $cookie_path = substr(dirname(getenv('SCRIPT_NAME')), 0, -6);
	if ($cookie_path == '') {
		$cookie_path = '/';
	}
  $www_location = 'http://' . getenv('HTTP_HOST') . getenv('SCRIPT_NAME');
  $www_location = substr($www_location, 0, strpos($www_location, 'setup'));

  $script_filename = getenv('PATH_TRANSLATED');
  if (empty($script_filename)) {
    $script_filename = getenv('SCRIPT_FILENAME');
  }

  $script_filename = str_replace('\\', '/', $script_filename);
  $script_filename = str_replace('//', '/', $script_filename);

  $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) . '/';
?>
<p><b>Konfiguration</b></p>

<form name="install" action="install.php?step=5" method="post">

<p><b>Bitte geben Sie hier die Serverinformationen ein:<br>Please enter the web server information:</b></p>

<table width="95%" border="0" cellpadding="2" class="formPage">
  <tr>
    <td width="30%" valign="top">WWW Address:<br>WWW Adresse:</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('HTTP_WWW_ADDRESS', $www_location); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbWWW');"><br>
      <div id="dbWWWSD">The full website address to the online store<br>Der vollständige Webadresse zum Shop:</div>
      <div id="dbWWW" class="longDescription">The web address to the online store, for example <i>http://www.my-server.de/</i><br>Die Webadresse zum Shop. Z.B. <i>http://www.mein-server.de/</i></div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">Webserver Root Directory:<br>Rootverzeichniss des Webservers:</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('FOLDER_ABSOLUT_DOCUMENT_ROOT', $dir_fs_www_root); ?>
      <img src="picture/layout/help_icon.gif"  onClick="toggleBox('dbRoot');"><br>
      <div id="dbRootSD">The server path to the online store<br>Der absolute Pfad des Onlineshops auf dem Server</div>
      <div id="dbRoot" class="longDescription">The directory where bigware is installed on the server, for example <i>/home/myname/public_html/bigware/</i><br>
      Das Verzeichniss in dem der Shop installiert ist. Z.B.: <i>/home/myname/public_html/bigware/</i></div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">HTTP Cookie Domain:</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('HTTP_COOKIE_DOMAIN', getenv('HTTP_HOST')); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbCookieD');"><br>
      <div id="dbCookieDSD">The domain to store cookies in<br>Die Domain der Shops-Cookies</div>
      <div id="dbCookieD" class="longDescription">The full or top-level domain to store the cookies in, for example <i>.my-server.com</i><br>
      Die volle Top-Level-Domain der Shop-Cookies, z.B. <i>.my-server.com</i></div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">HTTP Cookie Path:<br>HTTP Cookie Pfad</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('HTTP_COOKIE_PATH', $cookie_path); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbCookieP');"><br>
      <div id="dbCookiePSD">The path to store cookies under<br>Der Pfad unter dem die Shop-Cookies gespeichert werden</div>
      <div id="dbCookieP" class="longDescription">The web address to limit the cookie to, for example <i>/</i><br>
      Die Webadresse auf die die Cookies begrenzt sind, z.B. <i>/</i></div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">Enable SSL Connections:<br>SSL Verbindung anschalten</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_checkbox_field('ENABLE_SSL', 'true'); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbSSL');"><br>
      <div id="dbSSLSD"></div>
      <div id="dbSSL" class="longDescription">Enable secure SSL/HTTPS connections (requires a secure certificate installed on the web server)<br>
      Schalten Sie eine sichere SSL/HTTPS Verbindung an (Erfodert ein SSL Zertifikat, das installiert sein muss)</div>
    </td>
  </tr>
</table>

<p>&nbsp;</p>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><a href="index.php"><img src="picture/button_cancel.gif" border="0" alt="Cancel"></a></td>
    <td align="center"><input type="image" src="picture/button_continue.gif" border="0" alt="Continue"></td>
  </tr>
</table>

<?php
  reset($_POST);
  while (list($key, $value) = each($_POST)) {
    if (($key != 'x') && ($key != 'y')) {
      if (is_array($value)) {
        for ($i=0; $i<sizeof($value); $i++) {
          echo bigware_fetch_hidden_field($key . '[]', $value[$i]);
        }
      } else {
        echo bigware_fetch_hidden_field($key, $value);
      }
    }
  }

  echo bigware_fetch_hidden_field('install[]', 'configure');
?>

</form>
