From ce6f0ed6878e07ff0ac71fc706bc26ad8008ac91 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 18 Jan 2012 05:16:01 -0500
Subject: [PATCH] Fixed a sql query in software_update_list.php

---
 server/plugins-available/nginx_plugin.inc.php |   34 ++++++++++++----------------------
 1 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index b04cfbb..79fa68d 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -198,7 +198,17 @@
 			if(trim($data["new"]["ssl_request"]) != '') file_put_contents($csr_file,$data["new"]["ssl_request"]);
 			if(trim($data["new"]["ssl_cert"]) != '') file_put_contents($crt_file,$data["new"]["ssl_cert"]);
 			// for nginx, bundle files have to be appended to the certificate file
-			if(trim($data["new"]["ssl_bundle"]) != '') file_put_contents($crt_file,$data["new"]["ssl_bundle"], FILE_APPEND);
+			if(trim($data["new"]["ssl_bundle"]) != ''){				
+				if(file_exists($crt_file)){
+					$crt_file_contents = trim(file_get_contents($crt_file));
+				} else {
+					$crt_file_contents = '';
+				}
+				if($crt_file_contents != '') $crt_file_contents .= "\n";
+				$crt_file_contents .= $data["new"]["ssl_bundle"];
+				file_put_contents($crt_file,$app->file->unix_nl($crt_file_contents));
+				unset($crt_file_contents);
+			}
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
 			/* Update also the master-DB of the Server-Farm */
@@ -1109,27 +1119,7 @@
 
 	//* This function is called when a IP on the server is inserted, updated or deleted
 	function server_ip($event_name,$data) {
-		global $app, $conf;
-
-		// load the server configuration options
-		$app->uses('getconf');
-		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-
-		$app->load('tpl');
-
-		$tpl = new tpl();
-		$tpl->newTemplate('apache_ispconfig.conf.master');
-		$records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
-
-		if(count($records) > 0) {
-			$tpl->setLoop('ip_adresses',$records);
-		}
-
-		$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/ispconfig.conf');
-		file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the conf file: '.$vhost_file,LOGLEVEL_DEBUG);
-		unset($tpl);
-
+		return;
 	}
 	
 	//* Create or update the .htaccess folder protection

--
Gitblit v1.9.1