From bfcdef6bc91753cb2044e3626f522b5b1aec129f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 14 Nov 2012 05:34:56 -0500
Subject: [PATCH] Merged revisions 3596-3670 from 3.0.5 stable branch.

---
 server/mods-available/monitor_core_module.inc.php |   54 +++++++++++++++++++++++++++---------------------------
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index 099b89a..63a813c 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -138,7 +138,7 @@
         /*
          * Insert the data into the database
          */
-        $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
                 'VALUES (' .
                 $res['server_id'] . ', ' .
                 "'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -163,7 +163,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -188,7 +188,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -213,7 +213,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -238,7 +238,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -263,7 +263,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -287,7 +287,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -311,7 +311,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -336,7 +336,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -361,7 +361,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -386,7 +386,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -424,7 +424,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -449,7 +449,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -474,7 +474,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -509,7 +509,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -534,7 +534,7 @@
         /*
          * Insert the data into the database
          */
-        $sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
                 'VALUES (' .
                 $res['server_id'] . ', ' .
                 "'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -560,7 +560,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -585,7 +585,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -610,7 +610,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -635,7 +635,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -660,7 +660,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -685,7 +685,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -708,12 +708,12 @@
 		$res = $this->_tools->monitorISPCCronLog();
 		
 		//* Ensure that output is encoded so that it does not break the serialize
-		$res['data'] = htmlentities($res['data']);
+		if(is_array($res) && isset($res['data'])) $res['data'] = htmlentities($res['data']);
 
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -738,7 +738,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -763,7 +763,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .
@@ -788,7 +788,7 @@
 		/*
 		 * Insert the data into the database
 		 */
-		$sql = 'INSERT INTO monitor_data (server_id, type, created, data, state) ' .
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
 				'VALUES (' .
 				$res['server_id'] . ', ' .
 				"'" . $app->dbmaster->quote($res['type']) . "', " .

--
Gitblit v1.9.1