From 2e272f91b070da8c5cbc4f475838bedfe3128ff1 Mon Sep 17 00:00:00 2001
From: redray <redray@ispconfig3>
Date: Tue, 02 Dec 2008 06:18:08 -0500
Subject: [PATCH] some css enhancements for the sysmonitor

---
 install/lib/installer_base.lib.php |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index e9a8dd8..4c9c20c 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -119,7 +119,7 @@
 		
 		$cf = $conf['mysql']; // make $conf['mysql'] more accessible
 		//** Create the database
-		if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$cf['database'])) {
+		if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$cf['database'].' DEFAULT CHARACTER SET '.$cf['charset'])) {
 			$this->error('Unable to create MySQL database: '.$cf['database'].'.');
 		}
 		
@@ -132,10 +132,10 @@
 			$this->error('Stopped: Database already contains some tables.');
 		} else {
 			if($cf['admin_password'] == '') {
-				caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
+				caselog("mysql --default-character-set=".$cf['charset']." -h '".$cf['host']."' -u '".$cf['admin_user']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
                         __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			} else {
-				caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' -p'".$cf['admin_password']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
+				caselog("mysql --default-character-set=".$cf['charset']." -h '".$cf['host']."' -u '".$cf['admin_user']."' -p'".$cf['admin_password']."' '".$cf['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null", 
                         __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			}
 			$db_tables = $this->db->getTables();
@@ -832,12 +832,20 @@
          
         $content = rf("tpl/apache_ispconfig.vhost.master");
 		$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
+		
+		// comment out the listen directive if port is 80 or 443
+		if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
+			$content = str_replace('{vhost_port_listen}', '#', $content);
+		} else {
+			$content = str_replace('{vhost_port_listen}', '', $content);
+		}
+		
 		wf("$vhost_conf_dir/ispconfig.vhost", $content);
 		
 		//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 		//* and create the symlink
 		if($this->install_ispconfig_interface == true) {
-			if(!@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
+			if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
 			if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
 				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
 			}
@@ -863,6 +871,7 @@
 		
 		//* Create the ispconfig log directory
 		if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
+		if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
 		
 		
 	}
@@ -918,25 +927,27 @@
 		unlink('crontab.txt');
 		
 		//* Getmail crontab
-        $cf = $conf['getmail'];
-		exec('crontab -u getmail -l > crontab.txt');
-		$existing_cron_jobs = file('crontab.txt');
+		if(is_user('getmail')) {
+        	$cf = $conf['getmail'];
+			exec('crontab -u getmail -l > crontab.txt');
+			$existing_cron_jobs = file('crontab.txt');
 		
-		$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null');
+			$cron_jobs = array('*/5 * * * * '.$cf['program'].' -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null');
 		
-		// remove existing ispconfig cronjobs, in case the syntax has changed
-		foreach($cron_jobs as $key => $val) {
-			if(stristr($val,$cf['program'])) unset($cron_jobs[$key]);
-		}
-		
-		foreach($cron_jobs as $cron_job) {
-			if(!in_array($cron_job."\n", $existing_cron_jobs)) {
-				$existing_cron_jobs[] = $cron_job."\n";
+			// remove existing ispconfig cronjobs, in case the syntax has changed
+			foreach($cron_jobs as $key => $val) {
+				if(stristr($val,$cf['program'])) unset($cron_jobs[$key]);
 			}
+		
+			foreach($cron_jobs as $cron_job) {
+				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
+					$existing_cron_jobs[] = $cron_job."\n";
+				}
+			}
+			file_put_contents('crontab.txt', $existing_cron_jobs);
+			exec('crontab -u getmail crontab.txt &> /dev/null');
+			unlink('crontab.txt');
 		}
-		file_put_contents('crontab.txt', $existing_cron_jobs);
-		exec('crontab -u getmail crontab.txt &> /dev/null');
-		unlink('crontab.txt');
 	}
 	
 }

--
Gitblit v1.9.1