From cab7ea5faaa2f3510c8488e7d19d083fc05ac6ca Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 18 Sep 2013 04:17:27 -0400
Subject: [PATCH] - Fixed missing global $app in new _decode function

---
 interface/lib/classes/tools_monitor.inc.php |   74 ++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 1 deletions(-)

diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php
index b0b4664..cb389c8 100644
--- a/interface/lib/classes/tools_monitor.inc.php
+++ b/interface/lib/classes/tools_monitor.inc.php
@@ -118,6 +118,44 @@
         return $html;
     }
 
+    function showDatabaseSize () {
+	global $app;
+	/* fetch the Data from the DB */
+	$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'database_size' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+	if(isset($record['data'])) {
+		$data = unserialize($record['data']);
+		/*
+            	Format the data
+            	*/
+            	$html =
+        	       '<div class="systemmonitor-state state-'.$record['state'].'">
+	                <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
+                	<table>
+	                <thead>
+        	        <tr>
+                	<td>'.$app->lng("monitor_database_name_txt").'</td>
+	                <td>'.$app->lng("monitor_database_size_txt").'</td>
+        	        <td>'.$app->lng("monitor_database_client_txt").'</td>
+                	</tr>';
+            	foreach($data as $line) {
+                	$html .= '<tr>';
+	                if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']);
+        	        $t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']);
+	                $line['client_id']=$t['username'];
+        	        unset($t);
+                	foreach ($line as $item) {
+				$html .= '<td>' . $item . '</td>';
+	                }
+        	        $html .= '</tr></tmpl loop>';
+            	}
+            	$html .= '</tbody></table>';
+            	$html .= '</div></div>';
+        } else {
+            	$html = '<p>'.$app->lng("no_data_database_size_txt").'</p>';
+        }
+        return $html;
+    }
+
     function showMemUsage () {
         global $app;
 
@@ -453,6 +491,40 @@
         return $html;
     }
 
+    function showMongoDB() {
+        global $app;
+
+        /* fetch the Data from the DB */
+        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+        if(isset($record['data'])) {
+            $html =
+                    '<div class="systemmonitor-state state-'.$record['state'].'">
+                <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
+
+            /*
+             * First, we have to detect, if there is any monitoring-data.
+             * If not (because mongodb is not installed) show this.
+            */
+            $data = unserialize($record['data']);
+            if ($data == '') {
+                $html .= '<p>'.
+                        'MongoDB is not installed at this server.<br />' .
+                        'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
+                        '</p>';
+            }
+            else {
+                $html .= nl2br($data);
+            }
+            $html .= '</div></div>';
+
+        } else {
+            $html = '<p>There is no data available at the moment.</p>';
+        }
+
+        return $html;
+    }
+
     function showIPTables() {
         global $app;
         $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
@@ -465,7 +537,7 @@
                 $html .= '<p>Problem, there are no rules listed for the server</p>';
             }
             else {
-                $html = nl2br($data['output']);
+                $html .= nl2br($data['output']);
             }
             $html .= '</div></div>';
         } else {

--
Gitblit v1.9.1