[Vtigercrm-commits] [vtiger-commits] r3937 - in /vtigercrm/branches/4.2/install: 2setConfig.php 4createConfigFile.php config.template.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sun Feb 26 11:49:32 EST 2006


Author: fathi
Date: Sun Feb 26 09:49:19 2006
New Revision: 3937

Log:
installer use template file

Modified:
    vtigercrm/branches/4.2/install/2setConfig.php
    vtigercrm/branches/4.2/install/4createConfigFile.php
    vtigercrm/branches/4.2/install/config.template.php

Modified: vtigercrm/branches/4.2/install/2setConfig.php
==============================================================================
--- vtigercrm/branches/4.2/install/2setConfig.php (original)
+++ vtigercrm/branches/4.2/install/2setConfig.php Sun Feb 26 09:49:19 2006
@@ -17,361 +17,383 @@
  * Description:  Executes a step in the installation process.
  ********************************************************************************/
 
-require_once("connection.php");
-
-$web_root = $_SERVER['SERVER_NAME']. ":" .$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
+// TODO: deprecate connection.php file
+//require_once("connection.php");
+
+// TODO: introduce MySQL port as parameters to use non-default value 3306
+//$sock_path=":" .$mysql_port;
+$hostname = $_SERVER['SERVER_NAME'];
+
+// TODO: introduce Apache port as parameters to use non-default value 80
+//$web_root = $_SERVER['SERVER_NAME']. ":" .$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
+$web_root = $hostname.$_SERVER['PHP_SELF'];
 $web_root = str_replace("/install.php", "", $web_root);
-$web_root = "http://$web_root";
+$web_root = "http://".$web_root;
+
 $current_dir = pathinfo(dirname(__FILE__));
-$current_dir=$current_dir['dirname']."/";
+$current_dir = $current_dir['dirname']."/";
 $cache_dir = "cache/";
 
-// To make MySQL run in desired port
-$sock_path=":" .$mysql_port;
-$H_NAME=gethostbyaddr($_SERVER['SERVER_ADDR']);
-
 if (is_file("config.php")) {
-	require_once("config.php");
-	session_start();
-
-	if(isset($upload_maxsize))
-		$_SESSION['upload_maxsize'] = $upload_maxsize;
-
-	if(isset($allow_exports))
-		$_SESSION['allow_exports'] = $allow_exports;
-
-	if(isset($disable_persistent_connections))
-		$_SESSION['disable_persistent_connections'] = $disable_persistent_connections;
-
-	if(isset($default_language))
-		$_SESSION['default_language'] = $default_language;
-
-	if(isset($translation_string_prefix))
-		$_SESSION['translation_string_prefix'] = $translation_string_prefix;
-
-	if(isset($default_charset))
-		$_SESSION['default_charset'] = $default_charset;
-
-	if(isset($languages)) {
-		// We need to encode the languages in a way that can be retrieved later
-		$language_keys = Array();
-		$language_values = Array();
-
-		foreach($languages as $key=>$value) {
-			$language_keys[] = $key;
-			$language_values[] = $value;
-		}
-
-		$_SESSION['language_keys'] = urlencode(implode(",",$language_keys));
-		$_SESSION['language_values'] = urlencode(implode(",",$language_values));
-	}
-
-	global $dbconfig;
-
-	if (isset($_REQUEST['db_hostname']))
-		$db_hostname = $_REQUEST['db_hostname'];
-	elseif (isset($dbconfig['db_hostname']))
-		$db_hostname = $dbconfig['db_hostname'];
-	else
-		$db_hostname = $H_NAME.$sock_path;
-
-	if (isset($_REQUEST['db_username']))
-		$db_username = $_REQUEST['db_username'];
-	elseif (isset($dbconfig['db_username']))
-		$db_username = $dbconfig['db_username'];
-	else
-		$db_username = $mysql_username;
-
-	if (isset($_REQUEST['db_password']))
-		$db_password = $_REQUEST['db_password'];
-	elseif (isset($dbconfig['db_password']))
-		$db_password = $dbconfig['db_password'];
-	else
-		$db_password = $mysql_password;
-
-	if (isset($_REQUEST['db_name']))
-		$db_name = $_REQUEST['db_name'];
-	elseif (isset($dbconfig['db_name']))
-		$db_name = $dbconfig['db_name'];
-	else
-		$db_name = 'vtigercrm';
-
-	!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
-
-	if (isset($_REQUEST['host_name'])) $host_name = $_REQUEST['host_name'];
-		else $host_name = $_SERVER['SERVER_NAME'];
-
-	if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
-		else $site_URL = $web_root;
-
-	if (isset($_REQUEST['root_directory'])) $root_directory = stripslashes($_REQUEST['root_directory']);
-		else $root_directory = $current_dir;
-
-	if (isset($_REQUEST['cache_dir']))
-		$cache_dir= $_REQUEST['cache_dir'];
-
-	if (isset($_REQUEST['mail_server']))
-		$mail_server= $_REQUEST['mail_server'];
-
-	if (isset($_REQUEST['mail_server_username']))
-		$mail_server_username= $_REQUEST['mail_server_username'];
-
-	if (isset($_REQUEST['mail_server_password']))
-		$mail_server_password= $_REQUEST['mail_server_password'];
-
-	if (isset($_REQUEST['admin_email']))
-		$admin_email = $_REQUEST['admin_email'];
-
-	if (isset($_REQUEST['admin_password']))
-		$admin_password = $_REQUEST['admin_password'];
+  require_once("config.php");
+  session_start();
+
+  if(isset($upload_maxsize))
+    $_SESSION['upload_maxsize'] = $upload_maxsize;
+
+  if(isset($allow_exports))
+    $_SESSION['allow_exports'] = $allow_exports;
+
+  if(isset($disable_persistent_connections))
+    $_SESSION['disable_persistent_connections'] = $disable_persistent_connections;
+
+  if(isset($default_language))
+    $_SESSION['default_language'] = $default_language;
+
+  if(isset($translation_string_prefix))
+    $_SESSION['translation_string_prefix'] = $translation_string_prefix;
+
+  if(isset($default_charset))
+    $_SESSION['default_charset'] = $default_charset;
+
+  if(isset($languages)) {
+    // need to encode the languages in a way that can be retrieved later
+    $language_keys = Array();
+    $language_values = Array();
+
+    foreach($languages as $key=>$value) {
+      $language_keys[] = $key;
+      $language_values[] = $value;
+    }
+
+    $_SESSION['language_keys'] = urlencode(implode(",",$language_keys));
+    $_SESSION['language_values'] = urlencode(implode(",",$language_values));
+  }
+
+  global $dbconfig;
+
+  if (isset($_REQUEST['db_hostname']))
+    $db_hostname = $_REQUEST['db_hostname'];
+  elseif (isset($dbconfig['db_hostname']))
+    $db_hostname = $dbconfig['db_hostname'];
+  else
+    $db_hostname = $hostname;
+// TODO: introduce MySQL port as parameters to use non-default value 3306
+//  else
+//    $db_hostname = $hostname.$sock_path;
+
+  if (isset($_REQUEST['db_username']))
+    $db_username = $_REQUEST['db_username'];
+  elseif (isset($dbconfig['db_username']))
+    $db_username = $dbconfig['db_username'];
+// TODO: deprecate connection.php file parameters
+//  else
+//    $db_username = $mysql_username;
+
+  if (isset($_REQUEST['db_password']))
+    $db_password = $_REQUEST['db_password'];
+  elseif (isset($dbconfig['db_password']))
+    $db_password = $dbconfig['db_password'];
+// TODO: deprecate connection.php file parameters
+//  else
+//    $db_password = $mysql_password;
+
+  if (isset($_REQUEST['db_name']))
+    $db_name = $_REQUEST['db_name'];
+  elseif (isset($dbconfig['db_name']))
+    $db_name = $dbconfig['db_name'];
+  else
+    $db_name = 'vtigercrm';
+
+  !isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
+
+  if (isset($_REQUEST['host_name'])) $host_name = $_REQUEST['host_name'];
+    else $host_name = $hostname;
+
+  if (isset($_REQUEST['site_URL'])) $site_URL = $_REQUEST['site_URL'];
+    else $site_URL = $web_root;
+
+  if (isset($_REQUEST['root_directory'])) $root_directory = stripslashes($_REQUEST['root_directory']);
+    else $root_directory = $current_dir;
+
+  if (isset($_REQUEST['cache_dir']))
+    $cache_dir= $_REQUEST['cache_dir'];
+
+  if (isset($_REQUEST['mail_server']))
+    $mail_server= $_REQUEST['mail_server'];
+
+  if (isset($_REQUEST['mail_server_username']))
+    $mail_server_username= $_REQUEST['mail_server_username'];
+
+  if (isset($_REQUEST['mail_server_password']))
+    $mail_server_password= $_REQUEST['mail_server_password'];
+
+  if (isset($_REQUEST['admin_email']))
+    $admin_email = $_REQUEST['admin_email'];
+
+  if (isset($_REQUEST['admin_password']))
+    $admin_password = $_REQUEST['admin_password'];
 }
 else {
-	!isset($_REQUEST['db_hostname']) ? $db_hostname = $H_NAME.$sock_path : $db_hostname = $_REQUEST['db_hostname'];
-	!isset($_REQUEST['db_username']) ? $db_username = $mysql_username : $db_username = $_REQUEST['db_username'];
-	!isset($_REQUEST['db_password']) ? $db_password= $mysql_password : $db_password = $_REQUEST['db_password'];
-	!isset($_REQUEST['db_name']) ? $db_name = "vtigercrm" : $db_name = $_REQUEST['db_name'];
-	!isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
-	!isset($_REQUEST['host_name']) ? $host_name= $_SERVER['SERVER_NAME'] : $host_name= $_REQUEST['host_name'];
-	!isset($_REQUEST['site_URL']) ? $site_URL = $web_root : $site_URL = $_REQUEST['site_URL'];
-	!isset($_REQUEST['root_directory']) ? $root_directory = $current_dir : $root_directory = stripslashes($_REQUEST['root_directory']);
-	!isset($_REQUEST['cache_dir']) ? $cache_dir = $cache_dir : $cache_dir = stripslashes($_REQUEST['cache_dir']);
-	!isset($_REQUEST['mail_server']) ? $mail_server = $mail_server : $mail_server = stripslashes($_REQUEST['mail_server']);
-	!isset($_REQUEST['mail_server_username']) ? $mail_server_username = $mail_server_username : $mail_server_username = stripslashes($_REQUEST['mail_server_username']);
-	!isset($_REQUEST['mail_server_password']) ? $mail_server_password = $mail_server_password : $mail_server_password = stripslashes($_REQUEST['mail_server_password']);
-	!isset($_REQUEST['admin_email']) ? $admin_email = "" : $admin_email = $_REQUEST['admin_email'];
+  !isset($_REQUEST['db_hostname']) ? $db_hostname = $hostname: $db_hostname = $_REQUEST['db_hostname'];
+  /*
+  TODO: introduce MySQL port as parameters to use non-default value 3306
+  TODO: deprecate connection.php file parameters
+  !isset($_REQUEST['db_hostname']) ? $db_hostname = $hostname.$sock_path : $db_hostname = $_REQUEST['db_hostname'];
+  !isset($_REQUEST['db_username']) ? $db_username = $mysql_username : $db_username = $_REQUEST['db_username'];
+  !isset($_REQUEST['db_password']) ? $db_password= $mysql_password : $db_password = $_REQUEST['db_password'];
+  */
+  !isset($_REQUEST['db_name']) ? $db_name = "vtigercrm" : $db_name = $_REQUEST['db_name'];
+  !isset($_REQUEST['db_drop_tables']) ? $db_drop_tables = "0" : $db_drop_tables = $_REQUEST['db_drop_tables'];
+  !isset($_REQUEST['host_name']) ? $host_name= $hostname : $host_name= $_REQUEST['host_name'];
+  !isset($_REQUEST['site_URL']) ? $site_URL = $web_root : $site_URL = $_REQUEST['site_URL'];
+  !isset($_REQUEST['root_directory']) ? $root_directory = $current_dir : $root_directory = stripslashes($_REQUEST['root_directory']);
+  !isset($_REQUEST['cache_dir']) ? $cache_dir = $cache_dir : $cache_dir = stripslashes($_REQUEST['cache_dir']);
+  !isset($_REQUEST['mail_server']) ? $mail_server = $mail_server : $mail_server = stripslashes($_REQUEST['mail_server']);
+  !isset($_REQUEST['mail_server_username']) ? $mail_server_username = $mail_server_username : $mail_server_username = stripslashes($_REQUEST['mail_server_username']);
+  !isset($_REQUEST['mail_server_password']) ? $mail_server_password = $mail_server_password : $mail_server_password = stripslashes($_REQUEST['mail_server_password']);
+  !isset($_REQUEST['admin_email']) ? $admin_email = "" : $admin_email = $_REQUEST['admin_email'];
 }
 
 ?>
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML>
-<HEAD>
+<head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>vtigerCRM 4.x Installer: Step 2</title>
-<link rel="stylesheet" href="install/install.css" type="text/css" />
+  <title>vtigerCRM 4.x Installer: Step 2</title>
+  <link rel="stylesheet" href="install/install.css" type="text/css" />
 </head>
 <body leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
 
 <script type="text/javascript" language="Javascript">
 <!--  to hide script contents from old browsers
 function trim(s) {
-	while (s.substring(0,1) == " ") {
-		s = s.substring(1, s.length);
-	}
-	while (s.substring(s.length-1, s.length) == ' ') {
-		s = s.substring(0,s.length-1);
-	}
-
-	return s;
+  while (s.substring(0,1) == " ") {
+    s = s.substring(1, s.length);
+  }
+  while (s.substring(s.length-1, s.length) == ' ') {
+    s = s.substring(0,s.length-1);
+  }
+
+  return s;
 }
 
 function verify_data(form) {
-	var isError = false;
-	var errorMessage = "";
-
-	// Here we decide whether to submit the form.
-	if (trim(form.db_hostname.value) =='') {
-		isError = true;
-		errorMessage += "\n database host name";
-		form.db_hostname.focus();
-	}
-
-	if (trim(form.db_username.value) =='') {
-		isError = true;
-		errorMessage += "\n database user name";
-		form.db_username.focus();
-	}
-
-	if (trim(form.db_name.value) =='') {
-		isError = true;
-		errorMessage += "\n database name";
-		form.db_name.focus();
-	}
-
-	if (trim(form.site_URL.value) =='') {
-		isError = true;
-		errorMessage += "\n site url";
-		form.site_URL.focus();
-	}
-
-	if (trim(form.root_directory.value) =='') {
-		isError = true;
-		errorMessage += "\n path";
-		form.root_directory.focus();
-	}
-/*
-	 if (trim(form.admin_email.value) =='') {
-		isError = true;
-		errorMessage += "\n admin email";
-		form.admin_email.focus();
+  var isError = false;
+  var errorMessage = "";
+
+  // decide whether to submit the form
+  if (trim(form.db_hostname.value) =='') {
+    isError = true;
+    errorMessage += "\n database host name";
+    form.db_hostname.focus();
+  }
+
+  if (trim(form.db_username.value) =='') {
+    isError = true;
+    errorMessage += "\n database user name";
+    form.db_username.focus();
+  }
+
+  if (trim(form.db_name.value) =='') {
+    isError = true;
+    errorMessage += "\n database name";
+    form.db_name.focus();
+  }
+
+  if (trim(form.site_URL.value) =='') {
+    isError = true;
+    errorMessage += "\n site url";
+    form.site_URL.focus();
+  }
+
+  if (trim(form.root_directory.value) =='') {
+    isError = true;
+    errorMessage += "\n path";
+    form.root_directory.focus();
+  }
+/* TODO: add comments or cleanup
+   if (trim(form.admin_email.value) =='') {
+    isError = true;
+    errorMessage += "\n admin email";
+    form.admin_email.focus();
         }
 */
-	if (trim(form.admin_password.value) =='') {
-		isError = true;
-		errorMessage += "\n admin password";
-		form.admin_password.focus();
-	}
-
-	if (trim(form.cache_dir.value) =='') {
-		isError = true;
-		errorMessage += "\n temp directory path";
-		form.root_directory.focus();
+  if (trim(form.admin_password.value) =='') {
+    isError = true;
+    errorMessage += "\n admin password";
+    form.admin_password.focus();
+  }
+
+  if (trim(form.cache_dir.value) =='') {
+    isError = true;
+    errorMessage += "\n temp directory path";
+    form.root_directory.focus();
         }
-/*
-	if (trim(form.mail_server.value) =='') {
-		isError = true;
-		errorMessage += "\n mail server name";
-		form.mail_server.focus();
-	}
-
-	if (trim(form.mail_server_username.value) =='') {
-		isError = true;
-		errorMessage += "\n mail server username";
-		form.mail_server_username.focus();
-	}
-
-	if (trim(form.mail_server_password.value) =='') {
-		isError = true;
-		errorMessage += "\n mail server password";
-		form.mail_server_password.focus();
-	}
+/* TODO: add comments or cleanup
+  if (trim(form.mail_server.value) =='') {
+    isError = true;
+    errorMessage += "\n mail server name";
+    form.mail_server.focus();
+  }
+
+  if (trim(form.mail_server_username.value) =='') {
+    isError = true;
+    errorMessage += "\n mail server username";
+    form.mail_server_username.focus();
+  }
+
+  if (trim(form.mail_server_password.value) =='') {
+    isError = true;
+    errorMessage += "\n mail server password";
+    form.mail_server_password.focus();
+  }
 */
-	// Here we decide whether to submit the form.
-	if (isError == true) {
-		alert("Missing required fields: " + errorMessage);
-		return false;
-	}
-
-	return true;
+  // decide whether to submit the form
+  if (isError == true) {
+    alert("Missing required fields: " + errorMessage);
+    return false;
+  }
+
+  return true;
 }
 // end hiding contents from old browsers  -->
 </script>
 
-<table width="75%" border="0" cellpadding="3" cellspacing="0" align="center" style="border-bottom: 1px dotted #CCCCCC;"><tbody>
-  <tr>
+<table width="75%" border="0" cellpadding="3" cellspacing="0" align="center" style="border-bottom: 1px dotted #CCCCCC;">
+  <tbody>
+    <tr>
       <td align="left"><a href="http://www.vtiger.com" target="_blank" title="vtigerCRM"><IMG alt="vtigerCRM" border="0" src="include/images/vtiger_crmlogo.gif"/></a></td>
       <td align="right"><h2>Step 2 of 5</h2></td>
       <td align="right"><IMG alt="vtigerCRM" border="0" src="include/images/spacer.gif" width="10" height="1"/></td>
     </tr>
-</tbody></table>
-
-<table width="75%" align="center" border="0" cellpadding="10" cellspacing="0" border="0"><tbody>
-   <tr>
+  </tbody>
+</table>
+
+<table width="75%" align="center" border="0" cellpadding="10" cellspacing="0" border="0">
+  <tbody>
+    <tr>
       <td width="100%">
-		<table cellpadding="0" cellspacing="0" border="0" width="100%"><tbody><tr>
-			  <td>
-			   <table cellpadding="0" cellspacing="0" border="0" width="100%"><tbody><tr>
-
-				<td nowrap><h3>System Configuration</h3></td>
-				<td width="80%"><hr width="100%"></td>
-
-				</tr></tbody></table>
-			  </td>
-			   </tr>
-		</tbody></table>
-	  </td>
-          </tr>
-          <tr>
-            <td>
-          <P><b>Please enter your database configuration information below...</b> <P>
-
-		  If you do not have root access to your database (for example you are installing in a virtual
-		  hosting environment), you will need to have your database created for you before you proceed.
-		  However, this installer will still be able to create the necessary database tables.<P>
-
-		  <p>If you unsure of your database host, username or password, we suggest that you use the default
-		  values below. </P>
-		  </td>
-          </tr>
-		  <tr>
-		    <td align="center">
-			<form action="install.php" method="post" onsubmit="return verify_data(setConfig);" name="setConfig" id="form">
-			<input type="hidden" name="file" value="3confirmConfig.php">
-			<div align="left" width="70%"><font color=red>* Required field</font></div>
-			<table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;"><tbody>
-              <tr>
-			<td bgcolor="#EEEEEE"><h4>Database Configuration</h4></td>
-              </tr>
-              </table>
-			<table width="80%" cellpadding="5"  cellspacing="1" border="0" style="border: 1px dotted #666666;"><tbody>
-			<tr>
-               <td nowrap bgcolor="#F5F5F5" width="40%"><strong>Host Name</strong> <sup><font color=red>*</font></sup></td>
-               <td align="left"><input type="text" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>User Name</strong> <sup><font color=red>*</font></sup></td>
-               <td align="left"><input type="text" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>Password</strong> <sup><font color=red>*</font></sup></td>
-               <td align="left"><input type="password" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" /></td>
-              </tr>
-              <tr>
-               <td nowrap bgcolor="#F5F5F5"><strong>Database Name</strong> <sup><font color=red>*</font></sup></td>
-               <td align="left"><input type="text" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" /></td>
-
-		<input type="hidden" name="dbtype" value="<?php
+        <table cellpadding="0" cellspacing="0" border="0" width="100%">
+          <tbody>
+            <tr>
+              <td>
+                <table cellpadding="0" cellspacing="0" border="0" width="100%">
+                  <tbody>
+                    <tr>
+                      <td nowrap><h3>System Configuration</h3></td>
+                      <td width="80%"><hr width="100%"></td>
+                    </tr>
+                  </tbody>
+                </table>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      </td>
+     </tr>
+     <tr>
+       <td>
+         <P><b>Please enter your database configuration information below...</b></p>
+         <P>
+           If you do not have root access to your database (for example you are installing in a virtual hosting environment),<br>
+           you will need to have your database created for you before you proceed.<br>
+           However, this installer will still be able to create the necessary database tables.
+         </P>
+         <p>If you unsure of your database host, username or password, we suggest that you use the default values below.</P>
+       </td>
+     </tr>
+     <tr>
+        <td align="center">
+        <form action="install.php" method="post" onsubmit="return verify_data(setConfig);" name="setConfig" id="form">
+        <input type="hidden" name="file" value="3confirmConfig.php">
+        <div align="left" width="70%"><font color=red>* Required field</font></div>
+        <table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;">
+          <tbody>
+            <tr>
+              <td bgcolor="#EEEEEE"><h4>Database Configuration</h4></td>
+            </tr>
+        </table>
+        <table width="80%" cellpadding="5" cellspacing="1" border="0" style="border: 1px dotted #666666;">
+          <tbody>
+            <tr>
+              <td nowrap bgcolor="#F5F5F5" width="40%"><strong>Host Name</strong> <sup><font color=red>*</font></sup></td>
+              <td align="left">
+              <input type="text" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" /></td>
+            </tr>
+            <tr>
+              <td nowrap bgcolor="#F5F5F5"><strong>User Name</strong> <sup><font color=red>*</font></sup></td>
+              <td align="left">
+              <input type="text" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" /></td>
+            </tr>
+            <tr>
+              <td nowrap bgcolor="#F5F5F5"><strong>Password</strong> <sup><font color=red>*</font></sup></td>
+              <td align="left">
+              <input type="password" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" /></td>
+            </tr>
+            <tr>
+              <td nowrap bgcolor="#F5F5F5"><strong>Database Name</strong> <sup><font color=red>*</font></sup></td>
+              <td align="left"><input type="text" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" /></td>
+              <input type="hidden" name="dbtype" value="
+              <?php
                 if(isset($dbconfig['db_type']) && $dbconfig['db_type'] != '')
-                {
                         echo $dbconfig['db_type'];
-                }
                 elseif(isset($databasetype) && $databasetype != '')
-                {
                         echo $databasetype;
-
-                } ?>">
-              </tr>
-              </table>
+              ?>">
+            </tr>
+          </table>
               <!-- tr>
                <td></td><td nowrap><strong>Drop Existing Tables?</strong></td>
                <td align="left"><input type="checkbox" name="db_drop_tables"
-			   <?php if (isset($db_drop_tables) && $db_drop_tables==true) echo "checked "; ?> value="$db_drop_tables"/></td>
+         <?php if (isset($db_drop_tables) && $db_drop_tables==true) echo "checked "; ?> value="$db_drop_tables"/></td>
               </tr -->
-			<br><table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;"><tbody>
-			              <tr>
-						<td bgcolor="#EEEEEE"><h4>Site Configuration</h4></td>
-			              </tr>
+      <br><table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;"><tbody>
+                    <tr>
+            <td bgcolor="#EEEEEE"><h4>Site Configuration</h4></td>
+                    </tr>
               </table>
             <table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;">
             <tr>
-			<td bgcolor="#F5F5F5" width="40%"><strong>URL</strong> <sup><font color=red>*</font></sup></td>
+      <td bgcolor="#F5F5F5" width="40%"><strong>URL</strong> <sup><font color=red>*</font></sup></td>
             <td align="left"><input class="dataInput" type="text" name="site_URL"
-			value="<?php if (isset($site_URL)) echo $site_URL; ?>" size="40" />
-		  	</td>
+      value="<?php if (isset($site_URL)) echo $site_URL; ?>" size="40" />
+        </td>
           </tr><tr>
             <td bgcolor="#F5F5F5"><strong>Path</strong> <sup><font color=red>*</font></sup></td>
             <td align="left"><input class="dataInput" type="text" name="root_directory" value="<?php if (isset($root_directory)) echo "$root_directory"; ?>" size="40" /> </td>
-	  </tr><tr valign="top">
+    </tr><tr valign="top">
             <td bgcolor="#F5F5F5"><strong>Path to Cache Directory  <sup><font color=red>*</font></sup><br>(must be writable)</td>
             <td align="left"><?php echo $root_directory; ?><input class="dataInput" type="text" name="cache_dir" size='14' value="<?php if (isset($cache_dir)) echo $cache_dir; ?>" size="40" /> </td>
           </tr>
           </table><br>
             <table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;">
-		<tr>
-			<td bgcolor="#EEEEEE"><h4>Admin Configuration</h4></td>
+    <tr>
+      <td bgcolor="#EEEEEE"><h4>Admin Configuration</h4></td>
               </tr>
               </table>
-	<table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;">
-	<tr>
+  <table width="80%" cellpadding="5" border="0" style="border: 1px dotted #666666;">
+  <tr>
 
             <td nowrap bgcolor="#F5F5F5" width="40%"><strong>username</strong></td>
             <td align="left">admin</td>
           </tr>
 
-	<tr><td bgcolor="#F5F5F5" nowrap><strong>password</strong><sup><font color=red>*</font></sup></td>
+  <tr><td bgcolor="#F5F5F5" nowrap><strong>password</strong><sup><font color=red>*</font></sup></td>
         <td align="left"><input class="dataInput" type="password" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; else echo "admin"; ?>"></td>
           </tr>
-	<tr>
-	<td colspan="2"><font color=blue> <b>Note:</b> The default password is 'admin'. You can change the password if necessary now or else you can change it later in vtigerCRM </font></td>
+  <tr>
+  <td colspan="2"><font color=blue> <b>Note:</b> The default password is 'admin'. You can change the password if necessary now or else you can change it later in vtigerCRM </font></td>
 
         </tr>
-		</table>
+    </table>
 
 <table width="70%" cellpadding="5" border="0">
           <tr>
-			<td align="right"><br /> <input class="button" type="submit" name="next" value="Next >" /></td>
+      <td align="right"><br /> <input class="button" type="submit" name="next" value="Next >" /></td>
           </tr>
-	</tbody></table>
+  </tbody></table>
 
 </form>
 </body>

Modified: vtigercrm/branches/4.2/install/4createConfigFile.php
==============================================================================
--- vtigercrm/branches/4.2/install/4createConfigFile.php (original)
+++ vtigercrm/branches/4.2/install/4createConfigFile.php Sun Feb 26 09:49:19 2006
@@ -28,52 +28,52 @@
 $release_date = "23 December 2005";
 
 if (isset($_REQUEST['db_hostname']))
-	$db_hostname =	$_REQUEST['db_hostname'];
+  $db_hostname = $_REQUEST['db_hostname'];
 
 if (isset($_REQUEST['db_username']))
-	$db_username =	$_REQUEST['db_username'];
+  $db_username = $_REQUEST['db_username'];
 
 if (isset($_REQUEST['db_password']))
-	$db_password = $_REQUEST['db_password'];
+  $db_password = $_REQUEST['db_password'];
 
 if (isset($_REQUEST['db_name']))
-	$db_name = $_REQUEST['db_name'];
+  $db_name = $_REQUEST['db_name'];
 
 if (isset($_REQUEST['db_drop_tables']))
-	$db_drop_tables = $_REQUEST['db_drop_tables'];
+  $db_drop_tables = $_REQUEST['db_drop_tables'];
 
 if (isset($_REQUEST['db_create']))
-	$db_create = $_REQUEST['db_create'];
+  $db_create = $_REQUEST['db_create'];
 
 if (isset($_REQUEST['db_populate']))
-	$db_populate = $_REQUEST['db_populate'];
+  $db_populate = $_REQUEST['db_populate'];
 
 if (isset($_REQUEST['site_URL']))
-	$site_URL = $_REQUEST['site_URL'];
+  $site_URL = $_REQUEST['site_URL'];
  
 if (isset($_REQUEST['admin_email']))
-	$admin_email = $_REQUEST['admin_email'];
+  $admin_email = $_REQUEST['admin_email'];
 
 if (isset($_REQUEST['admin_password']))
-	$admin_password = $_REQUEST['admin_password'];
+  $admin_password = $_REQUEST['admin_password'];
 
 if (isset($_REQUEST['mail_server']))
-	$mail_server = $_REQUEST['mail_server'];
+  $mail_server = $_REQUEST['mail_server'];
 
 if (isset($_REQUEST['mail_server_username']))
-	$mail_server_username =	$_REQUEST['mail_server_username'];
+  $mail_server_username = $_REQUEST['mail_server_username'];
 
 if (isset($_REQUEST['mail_server_password']))
-	$mail_server_password =	$_REQUEST['mail_server_password'];
+  $mail_server_password = $_REQUEST['mail_server_password'];
 
 if (isset($_REQUEST['ftpserver']))
-	$ftpserver = $_REQUEST['ftpserver'];
+  $ftpserver = $_REQUEST['ftpserver'];
 
 if (isset($_REQUEST['ftpuser']))
-	$ftpuser = $_REQUEST['ftpuser'];
+  $ftpuser = $_REQUEST['ftpuser'];
 
 if (isset($_REQUEST['ftppassword']))
-	$ftppassword = $_REQUEST['ftppassword'];
+  $ftppassword = $_REQUEST['ftppassword'];
 
 $cache_dir = 'cache/';
 
@@ -81,276 +81,139 @@
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML>
-<HEAD>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-<title>vtigerCRM 4.x Installer: Step 4</title>
-<link rel="stylesheet" href="install/install.css" type="text/css" />
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <title>vtigerCRM 4.x Installer: Step 4</title>
+  <link rel="stylesheet" href="install/install.css" type="text/css" />
 </head>
 <body leftMargin="0" topMargin="0" marginheight="0" marginwidth="0">
-<table width="75%" border="0" cellpadding="3" cellspacing="0" align="center" style="border-bottom: 1px dotted #CCCCCC;"><tbody>
-  <tr>
-      <td align="left"><a href="http://www.vtiger.com" target="_blank" title="vtigerCRM"><IMG alt="vtigerCRM" border="0" src="include/images/vtiger_crmlogo.gif"/></a></td>
-      <td align="right"><h2>Step 4 of 5</h2></td>
-      <td align="right"><IMG alt="vtigerCRM" border="0" src="include/images/spacer.gif" width="10" height="1"/></td>
+  <table width="75%" border="0" cellpadding="3" cellspacing="0" align="center" style="border-bottom: 1px dotted #CCCCCC;">
+    <tbody>
+      <tr>
+        <td align="left"><a href="http://www.vtiger.com" target="_blank" title="vtigerCRM"><IMG alt="vtigerCRM" border="0" src="include/images/vtiger_crmlogo.gif"/></a></td>
+        <td align="right"><h2>Step 4 of 5</h2></td>
+        <td align="right"><IMG alt="vtigerCRM" border="0" src="include/images/spacer.gif" width="10" height="1"/></td>
+      </tr>
+    </tbody>
+  </table>
+  <table width="75%" align="center" cellpadding="10" cellspacing="0" border="0">
+  <tbody>
+    <tr>
+      <td>
+        <table width=100% cellpadding="0" cellspacing="0" border="0">
+          <tbody>
+            <tr>
+              <td>
+                <table width=100% cellpadding="0" cellspacing="0" border="0">
+                  <tbody>
+                    <tr>
+                      <td><h3>Create configuration file</h3></td>
+                      <td width="80%"><hr width="100%"></td>
+                    </tr>
+                  </tbody>
+                </table>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      </td>
     </tr>
-</tbody></table>
-<table width="75%" align="center" cellpadding="10" cellspacing="0" border="0"><tbody>
-   <tr>
-      <td>
-		<table width=100% cellpadding="0" cellspacing="0" border="0"><tbody><tr>
-			  <td>
-			   <table width=100% cellpadding="0" cellspacing="0" border="0"><tbody><tr>
-				<td><h3>Create Config File</h3></td>
-				<td width="80%"><hr width="100%"></td>
-				</tr></tbody></table>
-			  </td></tr>
-		</tbody></table>
-	  </td>
-          </tr>
-	         <tr>
-            <td width="100%">
+    <tr>
+    <td width="100%">
 <?php
 
 if (isset($_REQUEST['root_directory']))
-	$root_directory = $_REQUEST['root_directory'];
+  $root_directory = $_REQUEST['root_directory'];
 
 if (is_file('config.php'))
-	$is_writable = is_writable('config.php');
+  $is_writable = is_writable('config.php');
 else
-	$is_writable = is_writable('.');
-
-$config = "<?php \n";
-$config .= "/*********************************************************************************\n";
-$config .= " * The contents of this file are subject to the SugarCRM Public License Version 1.1.2\n";
-$config .= " * (\"License\"); You may not use this file except in compliance with the \n";
-$config .= " * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL\n";
-$config .= " * Software distributed under the License is distributed on an  \"AS IS\"  basis,\n";
-$config .= " * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for\n";
-$config .= " * the specific language governing rights and limitations under the License.\n";
-$config .= " * The Original Code is:  SugarCRM Open Source\n";
-$config .= " * The Initial Developer of the Original Code is SugarCRM, Inc.\n";
-$config .= " * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;\n";
-$config .= " * All Rights Reserved.\n";
-$config .= " * Contributor(s): ______________________________________.\n";
-$config .= "********************************************************************************/\n";
-$config .= "\n";
-$config .= "\$vtiger_version = '".$vtiger_version."';\n";
-$config .= "\$release_date = '".$release_date."';\n";
-$config .= "\n";
-$config .= "// more than 8MB memory needed for graphs\n";
-$config .= "// memory limit default value = 16M\n";
-$config .= "ini_set('memory_limit','16M');\n";
-$config .= "\n";
-$config .= "// show or hide world clock and calculator\n";
-$config .= "// world_clock_display default value = true\n";
-$config .= "// calculator_clock_display default value = true\n";
-$config .= "\$WORLD_CLOCK_DISPLAY = 'true';\n";
-$config .= "\$CALCULATOR_DISPLAY = 'true';\n";
-$config .= "\n";
-$config .= "// url for customer portal (Example: http://vtiger.com/portal)\n";
-$config .= "\$PORTAL_URL = 'http://your-domain.com/customerportal';\n";
-$config .= "\n";
-$config .= "// helpdesk support email id and support name (Example: 'support at vtiger.com' and 'vtiger support')\n";
-$config .= "\$HELPDESK_SUPPORT_EMAIL_ID = 'support at your-domain.com';\n";
-$config .= "\$HELPDESK_SUPPORT_NAME = 'your-domain name';\n";
-$config .= "\n";
-$config .= "/* database configuration\n";
-$config .= "      db_hostname:MySQL Database Hostname\n";
-$config .= "      db_username:MySQL Username\n";
-$config .= "      db_password:MySQL Password\n";
-$config .= "      db_name:MySQL Database Name\n";
-$config .= "*/\n";
-$config .= "\$dbconfig['db_hostname'] = '".$db_hostname."';\n";
-$config .= "\$dbconfig['db_username'] = '".$db_username."';\n";
-$config .= "\$dbconfig['db_password'] =	'".$db_password."';\n";
-$config .= "\$dbconfig['db_name'] = '".$db_name."';\n";
-$config .= "\n";
-$config .= "// db_type default value = mysql\n";
-$config .= "\$dbconfig['db_type'] = 'mysql';\n";
-$config .= "\n";
-$config .= "// log_sql default value = false\n";
-$config .= "\$dbconfig['log_sql'] = false;\n";
-$config .= "\n";
-$config .= "// persistent default value = true\n";
-$config .= "\$dbconfigoption['persistent'] = true;\n";
-$config .= "\n";
-$config .= "// autofree default value = false\n";
-$config .= "\$dbconfigoption['autofree'] = false;\n";
-$config .= "\n";
-$config .= "// debug default value = 0\n";
-$config .= "\$dbconfigoption['debug'] = 0;\n";
-$config .= "\n";
-$config .= "// seqname_format default value = '%s_seq'\n";
-$config .= "\$dbconfigoption['seqname_format'] = '%s_seq';\n";
-$config .= "\n";
-$config .= "// portability default value = 0\n";
-$config .= "\$dbconfigoption['portability'] = 0;\n";
-$config .= "\n";
-$config .= "// ssl default value = false\n";
-$config .= "\$dbconfigoption['ssl'] = false;\n";
-$config .= "\n";
-$config .= "\$host_name = '".$db_hostname."';\n";
-$config .= "\$site_URL = '".$site_URL."';\n";
-$config .= "\$root_directory = '".$root_directory."';\n";
-$config .= "\$cache_dir = '$cache_dir';\n";
-$config .= "\$mail_server = '$mail_server';\n";
-$config .= "\$mail_server_username = '$mail_server_username';\n";
-$config .= "\$mail_server_password = '$mail_server_password';\n";
-//$config .= "\$ftpserver = '$ftpserver';\n";
-//$config .= "\$ftpuser = '$ftpuser';\n";
-//$config .= "\$ftppassword = '$ftppassword';\n";
-$config .= "\n";
-$config .= "// tmp_dir default value prepended by cache_dir = images/\n";
-$config .= "\$tmp_dir = '" . ($cache_dir . "images/") . "';\n";
-$config .= "\n";
-$config .= "//  import_dir default value prepended by cache_dir = import/\n";
-$config .= "\$import_dir = '" . ($cache_dir . "import/") . "';\n";
-$config .= "\n";
-$config .= "// upload_dir default value prepended by cache_dir = upload/\n";
-$config .= "\$upload_dir = '" . ($cache_dir . "upload/") . "';\n";
-$config .= "\n";
-$config .= "// maximum file size for uploaded files in bytes also used when uploading import files\n";
-$config .= "// upload_maxsize default value = 3000000\n";
-$config .= "\$upload_maxsize = ".return_session_value_or_default('upload_maxsize', '3000000').";\n";
-$config .= "\n";
-$config .= "// flag to allow export functionality\n";
-$config .= "// 'all' to allow anyone to use exports \n";
-$config .= "// 'admin' to only allow admins to export \n";
-$config .= "// 'none' to block exports completely \n";
-$config .= "// allow_exports default value = all\n";
-$config .= "\$allow_exports = '".return_session_value_or_default('allow_exports', 'all')."';\n";
-$config .= "\n";
-$config .= "// files with one of these extensions will have '.txt' appended to their filename on upload\n";
-$config .= "// upload_badext default value = php, php3, php4, php5, pl, cgi, py, asp, cfm, js, vbs, html, htm\n";
-$config .= "\$upload_badext = array('php', 'php3', 'php4', 'php5', 'pl', 'cgi', 'py', 'asp', 'cfm', 'js', 'vbs', 'html', 'htm');\n";
-$config .= "\n";
-$config .= "// full path to include directory including the trailing slash\n";
-$config .= "// includeDirectory default value = $root_directory.'include/\n";
-$config .= "\$includeDirectory = \$root_directory.'include/';\n";
-$config .= "\n";
-$config .= "// list_max_entries_per_page default value = 20\n";
-$config .= "\$list_max_entries_per_page = '20';\n";
-$config .= "\n";
-$config .= "// history_max_viewed default value = 5\n";
-$config .= "\$history_max_viewed = '5';\n";
-$config .= "\n";
-$config .= "// define list of menu tabs\n";
-$config .= "//\$moduleList = Array('Home', 'Dashboard', 'Contacts', 'Accounts', 'Opportunities', 'Cases', 'Notes', 'Calls', 'Emails', 'Meetings', 'Tasks','MessageBoard');\n";
-$config .= "\n";
-$config .= "// map sugar language codes to jscalendar language codes\n";
-$config .= "// unimplemented until jscalendar language files are fixed\n";
-$config .= "// \$cal_codes = array('en_us'=>'en', 'ja'=>'jp', 'sp_ve'=>'sp', 'it_it'=>'it', 'tw_zh'=>'zh', 'pt_br'=>'pt', 'se'=>'sv', 'cn_zh'=>'zh', 'ge_ge'=>'de', 'ge_ch'=>'de', 'fr'=>'fr');\n";
-$config .= "\n";
-$config .= "// default_module default value = Home\n";
-$config .= "\$default_module = 'Home';\n";
-$config .= "\n";
-$config .= "// default_action default value = index\n";
-$config .= "\$default_action = 'index';\n";
-$config .= "\n";
-$config .= "// set default theme\n";
-$config .= "// default_theme default value = blue\n";
-$config .= "\$default_theme = 'blue';\n";
-$config .= "\n";
-$config .= "// show or hide time to compose each page\n";
-$config .= "// calculate_response_time default value = true\n";
-$config .= "\$calculate_response_time = true;\n";
-$config .= "\n";
-$config .= "// default text that is placed initially in the login form for user name\n";
-$config .= "// no default_user_name default value\n";
-$config .= "\$default_user_name = '';\n";
-$config .= "\n";
-$config .= "// default text that is placed initially in the login form for password\n";
-$config .= "// no default_password default value\n";
-$config .= "\$default_password = '';\n";
-$config .= "\n";
-$config .= "// create user with default username and password\n";
-$config .= "// create_default_user default value = false\n";
-$config .= "\$create_default_user = false;\n";
-$config .= "// default_user_is_admin default value = false\n";
-$config .= "\$default_user_is_admin = false;\n";
-$config .= "\n";
-$config .= "// if your MySQL/PHP configuration does not support persistent connections set this to true to avoid a large performance slowdown\n";
-$config .= "// disable_persistent_connections default value = false\n";
-$config .= "\$disable_persistent_connections = ".return_session_value_or_default('disable_persistent_connections', 'false').";\n";
-$config .= "\n";
-$config .= "// defined languages available. the key must be the language file prefix. (Example 'en_us' is the prefix for every 'en_us.lang.php' file)\n";
-$config .= "// languages default value = en_us=>US English\n";
-
-$language_value = "Array('en_us'=>'US English',)";
-
-if(isset($_SESSION['language_keys']) && isset($_SESSION['language_values'])) {
-	$language_value = 'Array(';
-	$language_keys = explode(',', urldecode($_SESSION['language_keys']));
-	$language_values = explode(',', urldecode($_SESSION['language_values']));
-	$size = count($language_keys);
-
-	for($i = 0; $i < $size; $i+=1)
-		$language_value .= "'$language_keys[$i]'=>'$language_values[$i]',";
-
-	$language_value .= ')';
+  $is_writable = is_writable('.');
+
+/* open template configuration file read only */
+$templateFilename = $root_directory."install/config.template.php";
+$templateHandle = fopen($templateFilename, "r");
+if($templateHandle) {
+  /* open include configuration file write only */
+  $includeFilename = $root_directory."config.php";
+  $includeHandle = fopen($includeFilename, "w");
+  if($includeHandle) {
+    while (!feof($templateHandle)) {
+      $buffer = fgets($templateHandle);
+      /* TODO: add missing parameters
+      $vtiger_version = '".$vtiger_version."';\n";
+      $release_date = '".$release_date."';\n";
+      $dbconfig['db_hostname'] = '".$db_hostname."';\n";
+      $dbconfig['db_username'] = '".$db_username."';\n";
+      $dbconfig['db_password'] =  '".$db_password."';\n";
+      $dbconfig['db_name'] = '".$db_name."';\n";
+      $host_name = '".$db_hostname."';\n";
+      $site_URL = '".$site_URL."';\n";
+      $root_directory = '".$root_directory."';\n";
+      $cache_dir = '$cache_dir';\n";
+      $mail_server = '$mail_server';\n";
+      $mail_server_username = '$mail_server_username';\n";
+      $mail_server_password = '$mail_server_password';\n";
+      $tmp_dir = '" . ($cache_dir . "images/") . "';\n";
+      $import_dir = '" . ($cache_dir . "import/") . "';\n";
+      $upload_dir = '" . ($cache_dir . "upload/") . "';\n";
+      // includeDirectory default value = $root_directory.'include/\n";
+      $languages = $language_value;\n";
+      */
+      /* replace _DBC_ variable */
+      $buffer = str_replace( "_DBC_SERVER_", $db_hostname, $buffer);
+      $buffer = str_replace( "_DBC_PORT_", "3306", $buffer);
+      $buffer = str_replace( "_DBC_USER_", $db_username, $buffer);
+      $buffer = str_replace( "_DBC_PASS_", $db_password, $buffer);
+      $buffer = str_replace( "_DBC_NAME_", $db_name, $buffer);
+      $buffer = str_replace( "_DBC_TYPE_", "mysql", $buffer);
+
+      fwrite($includeHandle, $buffer);
+    }
+
+    fclose($includeHandle);
+  }
+
+  fclose($templateHandle);
 }
 
-$config .= "\$languages = $language_value;\n";
-$config .= "\n";
-$config .= "// default charset\n";
-$config .= "// default charset default value = ISO-8859-1\n";
-$config .= "\$default_charset = '".return_session_value_or_default('default_charset','ISO-8859-1')."';\n";
-$config .= "\n";
-$config .= "// default language\n";
-$config .= "// default_language default value = en_us\n";
-$config .= "\$default_language = '".return_session_value_or_default('default_language','en_us')."';\n";
-$config .= "\n";
-$config .= "// add the language pack name to every translation string in the display.\n";
-$config .= "// translation_string_prefix default value = false\n";
-$config .= "\$translation_string_prefix = ".return_session_value_or_default('translation_string_prefix','false').";\n";
-$config .= "\n";
-//$config .= "// forum configurations\n";
-//$config .= "\$dbms = 'mysql';\n";
-//$config .= "\$dbhost = '".$db_hostname."';\n\n";
-//$config .= "\$dbuser = '".$db_username."';\n\n";
-//$config .= "\$dbpasswd = '".$db_password."';\n\n";
-//$config .= "\$dbname= '".$db_name."';\n\n";
-//$config .= "\$table_prefix = 'phpbb_';\n";
-//$config .= "define('PHPBB_INSTALLED', true);\n";
-$config .= "?>";
-
-if ($is_writable && ($config_file = @ fopen("config.php", "w"))) {
-	fputs($config_file, $config, strlen($config));
-	fclose($config_file);
-
-	echo "<br><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\"><tbody><tr><td align=\"left\">";
-	echo "<h4>Successfully created config file (<b>config.php</b>) in :</h4></td>";
-        echo "<td align=\"left\"><font color=\"00CC00\">".$root_directory."</font>\n";
-	echo "</td></tr></table>";
+if ($templateHandle && $includeHandle) {
+  echo "<br><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\"><tbody><tr><td align=\"left\">";
+  echo "<h4>Successfully created configuration file (<b>config.php</b>) in :</h4></td>";
+  echo "<td align=\"left\"><font color=\"00CC00\">".$root_directory."</font>\n";
+  echo "</td></tr></table>";
 }
 else {
-	echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody><tr><td align=\"left\">";
-	echo "Cannot write to config.php file in the directory <font color=red>".$root_directory."</font> file.\n";
-	echo "<P>You can continue this installation by manually creating the config.php file and pasting the configuration information below into the config.php file.  However, you <strong>must </strong>create the config.php file before you continue to the next step.<P>\n";
-	echo  "<TEXTAREA class=\"dataInput\" rows=\"15\" cols=\"80\">".$config."</TEXTAREA>";
-	echo "<P>Did you remember to create the config.php file?</td></tr>";
+  echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody><tr><td align=\"left\">";
+  echo "Cannot write configuration file (config.php ) in the directory <font color=red>".$root_directory."</font>.\n";
+  echo "<P>You can continue this installation by manually creating the config.php file and pasting the configuration information below inside.However, you <strong>must</strong> create the configuration file before you continue to the next step.<P>\n";
+  echo  "<TEXTAREA class=\"dataInput\" rows=\"15\" cols=\"80\">".$config."</TEXTAREA>";
+  echo "<P>Did you remember to create the config.php file?</td></tr>";
 }
 
 ?>
-	<tr><td>&nbsp;</td></tr>
-	<tr><td colspan="2" align="right">
-	<form action="install.php" method="post" name="form" id="form">
-	<input type="hidden" name="file" value="5createTables.php">
-
-	<input type="hidden" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" />
-	<input type="hidden" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" />
-	<input type="hidden" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" />
-	<input type="hidden" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />
-	<input type="hidden" class="dataInput" name="db_drop_tables" value="<?php if (isset($db_drop_tables)) echo "$db_drop_tables"; ?>" />
-	<input type="hidden" class="dataInput" name="db_create" value="<?php if (isset($db_create)) echo "$db_create"; ?>" />
-	<input type="hidden" class="dataInput" name="db_populate" value="<?php if (isset($db_populate)) echo "$db_populate"; ?>" />
-	<input type="hidden" class="dataInput" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; ?>" />
-	<input type="hidden" class="dataInput" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; ?>" />
-
-	<input class="button" type="submit" name="next" value="Next" />
-	</form>
-	</td></tr>
-	</tbody></table>
-</body>
+
+      <tr><td>&nbsp;</td></tr>
+        <tr>
+          <td colspan="2" align="right">
+            <form action="install.php" method="post" name="form" id="form">
+              <input type="hidden" name="file" value="5createTables.php">
+
+              <input type="hidden" class="dataInput" name="db_hostname" value="<?php if (isset($db_hostname)) echo "$db_hostname"; ?>" />
+              <input type="hidden" class="dataInput" name="db_username" value="<?php if (isset($db_username)) echo "$db_username"; ?>" />
+              <input type="hidden" class="dataInput" name="db_password" value="<?php if (isset($db_password)) echo "$db_password"; ?>" />
+              <input type="hidden" class="dataInput" name="db_name" value="<?php if (isset($db_name)) echo "$db_name"; ?>" />
+              <input type="hidden" class="dataInput" name="db_drop_tables" value="<?php if (isset($db_drop_tables)) echo "$db_drop_tables"; ?>" />
+              <input type="hidden" class="dataInput" name="db_create" value="<?php if (isset($db_create)) echo "$db_create"; ?>" />
+              <input type="hidden" class="dataInput" name="db_populate" value="<?php if (isset($db_populate)) echo "$db_populate"; ?>" />
+              <input type="hidden" class="dataInput" name="admin_email" value="<?php if (isset($admin_email)) echo "$admin_email"; ?>" />
+              <input type="hidden" class="dataInput" name="admin_password" value="<?php if (isset($admin_password)) echo "$admin_password"; ?>" />
+
+              <input class="button" type="submit" name="next" value="Next" />
+            </form>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+  </body>
 </html>
-

Modified: vtigercrm/branches/4.2/install/config.template.php
==============================================================================
--- vtigercrm/branches/4.2/install/config.template.php (original)
+++ vtigercrm/branches/4.2/install/config.template.php Sun Feb 26 09:49:19 2006
@@ -43,7 +43,7 @@
 */
 
 $dbconfig['db_server'] = '_DBC_SERVER_';
-// TODO test if port is empty
+// TODO: test if port is empty
 $dbconfig['db_port'] = ':_DBC_PORT_';
 $dbconfig['db_hostname'] = $dbconfig['db_server'].$dbconfig['db_port'];
 $dbconfig['db_username'] = '_DBC_USER_';
@@ -51,7 +51,7 @@
 $dbconfig['db_name'] = '_DBC_NAME_';
 
 // db_type default value = mysql
-$dbconfig['db_type'] = '_DBC_TYPE';
+$dbconfig['db_type'] = '_DBC_TYPE_';
 
 // log_sql default value = false
 $dbconfig['log_sql'] = false;





More information about the vtigercrm-commits mailing list