From ccbf1497dde4aef031a39544235a284641e694de Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Tue, 04 Mar 2014 16:18:36 -0500
Subject: [PATCH] - Added templating library to installer. - Added function to detect the apache version to installer. - Added support for apache 2.4 to vhots templates for ispconfig vhost and apps vhost in installer.

---
 install/dist/lib/gentoo.lib.php |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index a47f0d0..a2f3c3d 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -495,6 +495,7 @@
 
 
 		//* Copy the ISPConfig configuration include
+		/*
 		$content = $this->get_template_file('apache_ispconfig.conf', true);
 
 		$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
@@ -507,6 +508,35 @@
 		}
 
 		$this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
+		*/
+		
+		$tpl = new tpl('apache_ispconfig.conf.master');
+		$tpl->setVar('apache_version',getapacheversion());
+		
+		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
+		$ip_addresses = array();
+		
+		if(is_array($records) && count($records) > 0) {
+			foreach($records as $rec) {
+				if($rec['ip_type'] == 'IPv6') {
+					$ip_address = '['.$rec['ip_address'].']';
+				} else {
+					$ip_address = $rec['ip_address'];
+				}
+				$ports = explode(',', $rec['virtualhost_port']);
+				if(is_array($ports)) {
+					foreach($ports as $port) {
+						$port = intval($port);
+						if($port > 0 && $port < 65536 && $ip_address != '') {
+							$ip_addresses[] = array('ip_address' => $ip_address, 'port' => $port);
+						}
+					}
+				}
+			}
+		}
+
+		wf($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $tpl->grab());
+		unset($tpl);
 
 		//* Gentoo by default does not include .vhost files. Add include line to config file.
 		$content = rf($conf['apache']['config_file']);

--
Gitblit v1.9.1