From 37b29231e47a0c4458dc1c15d98588f16f07e1e2 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 06 Aug 2015 03:18:44 -0400
Subject: [PATCH] - don't set password via remoting if field is empty

---
 server/lib/classes/monitor_tools.inc.php |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 50eb45b..ce3d4bb 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -62,6 +62,9 @@
 				$mainver = array_filter($mainver);
 				$mainver = current($mainver).'.'.next($mainver);
 				switch ($mainver){
+				case "15.04":
+					$relname = "(Vivid Vervet)";
+					break;
 				case "14.10":
 					$relname = "(Utopic Unicorn)";
 					break;
@@ -147,6 +150,11 @@
 			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 				$distname = 'Debian';
 				$distver = 'Wheezy/Sid';
+				$distid = 'debian60';
+				$distbaseid = 'debian';
+			} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') {
+				$distname = 'Debian';
+				$distver = 'Jessie';
 				$distid = 'debian60';
 				$distbaseid = 'debian';
 			} else {
@@ -259,7 +267,7 @@
 		$server_id = intval($conf['server_id']);
 
 		/**  get the "active" Services of the server from the DB */
-		$services = $app->db->queryOneRecord('SELECT * FROM server WHERE server_id = ' . $server_id);
+		$services = $app->db->queryOneRecord('SELECT * FROM server WHERE server_id = ?', $server_id);
 		/*
 		 * If the DB is down, we have to set the db to "yes".
 		 * If we don't do this, then the monitor will NOT monitor, that the db is down and so the
@@ -658,7 +666,7 @@
 
 		// $now = time();
 		// $old = $now - (4 * 60); // 4 minutes
-		$old = 'UNIX_TIMESTAMP() - 240';
+		$old = 240; //seconds
 
 		/*
 		 * ATTENTION if i do NOT pay attention of the server id, i delete all data (of the type)
@@ -668,14 +676,8 @@
 		 * even though it is the NEWEST data of this server. To avoid this i HAVE to include
 		 * the server-id!
 		 */
-		$sql = 'DELETE FROM monitor_data ' .
-			'WHERE ' .
-			'  type =' . "'" . $app->dbmaster->quote($type) . "' " .
-			'AND ' .
-			'  created < ' . $old . ' ' .
-			'AND ' .
-			'  server_id = ' . $serverId;
-		$app->dbmaster->query($sql);
+		$sql = 'DELETE FROM `monitor_data` WHERE `type` = ? AND `created` < UNIX_TIMESTAMP() - ? AND `server_id` = ?';
+		$app->dbmaster->query($sql, $type, $old, $serverId);
 	}
 
 	public function send_notification_email($template, $placeholders, $recipients) {

--
Gitblit v1.9.1