From b5a0dc34a3bebd221fe8a564595d4c644122e11d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 16 Dec 2010 17:21:13 -0500
Subject: [PATCH] Merged revisions 2144-2150 from stable branch.

---
 install/lib/installer_base.lib.php |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 4626c22..9edc4a1 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -292,6 +292,8 @@
 		 *   1) it is a single server
 		 *   2) it is the MASTER of n clients
 		*/
+		$hosts = array();
+		
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			/*
 			 * it is a master-slave - Setup so the slave has to grant its rights in the master
@@ -326,7 +328,7 @@
 			}
 		}
 		
-		if(is_array($hosts)) {
+		if(count($hosts) > 0) {
 		foreach($hosts as $host => $value) {
 			/*
 			 * If a pwd exists, this means, we have to add the new user (and his pwd).
@@ -711,11 +713,11 @@
 		$config_dir = $conf['dovecot']['config_dir'];
 
 		//* Configure master.cf and add a line for deliver
-		if(is_file($config_dir.'/master.cf')) {
-			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
+		if(is_file($conf['postfix']['config_dir'].'/master.cf')) {
+			copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~2');
 		}
-		if(is_file($config_dir.'/master.cf~')) {
-			chmod($config_dir.'/master.cf~2', 0400);
+		if(is_file($conf['postfix']['config_dir'].'/master.cf~')) {
+			chmod($conf['postfix']['config_dir'].'/master.cf~2', 0400);
 		}
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
 		// Only add the content if we had not addded it before
@@ -1008,7 +1010,7 @@
 		// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 
 		$content = rf('tpl/apache_ispconfig.conf.master');
-		$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
+		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
 		if(is_array($records) && count($records) > 0) {
 			foreach($records as $rec) {
 				$content .= 'NameVirtualHost '.$rec['ip_address'].":80\n";
@@ -1034,6 +1036,10 @@
 			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
 			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
 		}
+		
+		// Check the awsatst script
+		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
 
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
@@ -1058,7 +1064,7 @@
 		$tcp_public_services = '';
 		$udp_public_services = '';
 
-		$row = $this->db->queryOneRecord('SELECT * FROM firewall WHERE server_id = '.intval($conf['server_id']));
+		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
 
 		if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') {
 			$tcp_public_services = trim(str_replace(',',' ',$row['tcp_port']));

--
Gitblit v1.9.1