From 334a9f66939fe7462357504fbfc2c712c52f7f7f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 09 Jul 2008 15:02:29 -0400
Subject: [PATCH] 

---
 install/install.php |   87 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 11 deletions(-)

diff --git a/install/install.php b/install/install.php
index 8384d41..2c82e7d 100644
--- a/install/install.php
+++ b/install/install.php
@@ -81,6 +81,10 @@
     die("ERROR: Cannot write to the directory ".dirname(ISPC_LOG_FILE).". Are you root or sudo ?\n\n");
 }
 
+if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) {
+	die('This software can not be installed on a server wich runs ISPConfig 2.x.');
+}
+
 //** Select the language
 $conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
 
@@ -124,9 +128,16 @@
 	
 	//* Create the mysql database
 	$inst->configure_database();
+	
+	//* Insert the Server record into the database
+	$inst->add_database_server_record();
 
 	//* Configure postfix
 	$inst->configure_postfix();
+	
+	//* Configure postfix
+	swriteln('Configuring Jailkit');
+	$inst->configure_jailkit();
 
 	//* Configure saslauthd
 	swriteln('Configuring SASL');
@@ -164,10 +175,22 @@
 	//* Configure Apache
 	swriteln('Configuring Apache');
 	$inst->configure_apache();
+	
+	//* Configure Firewall
+	swriteln('Configuring Firewall');
+	$inst->configure_firewall();
 
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig');
+	
+	//** Customise the port ISPConfig runs on
+	$inst->conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
+
 	$inst->install_ispconfig();
+	
+	//* Configure DBServer
+	swriteln('Configuring DBServer');
+	$inst->configure_dbserver();
 
 	//* Configure ISPConfig
 	swriteln('Installing Crontab');
@@ -191,13 +214,20 @@
 }else{
 
 	//** Get Server ID
-	$conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
+	// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
+	// Server ID is an autoInc value of the mysql database now
 	
-	if(strtolower($inst->simple_query('Create Database',array('y','n'),'y')) == 'y') {
+	if(strtolower($inst->simple_query('Create a new database? (We do not want to join a existing ISPConfig server setup)',array('y','n'),'y')) == 'y') {
 		//* Create the mysql database
 		$inst->configure_database();
 		system('/etc/init.d/mysql restart');
 	}
+		
+	//* Insert the Server record into the database
+	swriteln('Adding ISPConfig server record to database.');
+	swriteln('');
+	$inst->add_database_server_record();
+
 	
 	if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') {
 		
@@ -256,17 +286,52 @@
 		$inst->configure_apache();
 	}
 	
-	//** Configure ISPConfig :-)
-	if(strtolower($inst->simple_query('Install ISPConfig',array('y','n'),'y')) == 'y') {
-		swriteln('Installing ISPConfig');
-		$inst->install_ispconfig();
-		
-		//* Configure ISPConfig
-		swriteln('Installing Crontab');
-		$inst->install_crontab();
-		system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');	
+	//** Configure Firewall
+	if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {	
+		swriteln('Configuring Firewall');
+		$inst->configure_firewall();
 	}
 	
+	//** Configure ISPConfig :-)
+	if(strtolower($inst->simple_query('Install ISPConfig Web-Interface',array('y','n'),'y')) == 'y') {
+		swriteln('Installing ISPConfig');
+		
+		//** We want to check if the server is a module or cgi based php enabled server
+		//** TODO: Don't always ask for this somehow ?
+		/*
+		$fast_cgi = $inst->simple_query('CGI PHP Enabled Server?', array('yes','no'),'no');
+
+		if($fast_cgi == 'yes') {
+	 		$alias = $inst->free_query('Script Alias', '/php/');
+	 		$path = $inst->free_query('Script Alias Path', '/path/to/cgi/bin');
+	 		$inst->conf['apache']['vhost_cgi_alias'] = sprintf('ScriptAlias %s %s', $alias, $path);
+		} else {
+	 		$inst->conf['apache']['vhost_cgi_alias'] = "";
+		}
+		*/
+
+		//** Customise the port ISPConfig runs on
+		$inst->conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', '8080');
+		
+		$inst->install_ispconfig_interface = true;
+			
+	} else {
+		$inst->install_ispconfig_interface = false;
+	}
+	
+	$inst->install_ispconfig();
+	
+	//* Configure DBServer
+	swriteln('Configuring DBServer');
+	$inst->configure_dbserver();
+		
+	//* Configure ISPConfig
+	swriteln('Installing Crontab');
+	$inst->install_crontab();
+	system($conf['init_scripts'].'/'.$conf['apache']['init_script'].' restart');
+	
+	
+	
 } //* << $install_mode / 'Standard' or Genius
 
 

--
Gitblit v1.9.1