From 286d1bf1b746b49e43fd674bbc47afd25adfbedb Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Sun, 31 Jan 2010 12:33:18 -0500 Subject: [PATCH] Fixed: FS#1053 - Syntax Error in form_list.php --- interface/web/monitor/tools.inc.php | 134 +++++++++++++++++++++++++++----------------- 1 files changed, 83 insertions(+), 51 deletions(-) diff --git a/interface/web/monitor/tools.inc.php b/interface/web/monitor/tools.inc.php index 0348461..8bee86c 100644 --- a/interface/web/monitor/tools.inc.php +++ b/interface/web/monitor/tools.inc.php @@ -38,6 +38,7 @@ /* Format the data */ + if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes']; $html = '<div class="systemmonitor-state state-'.$record['state'].'"> <div class="systemmonitor-content icons32 ico-'.$record['state'].'"> @@ -89,12 +90,13 @@ <div class="systemmonitor-content icons32 ico-'.$record['state'].'"> <table> <tr> - <td>Filesystem</td> - <td>1K-blocks</td> - <td>Used</td> - <td>Available</td> - <td>Use%</td> - <td>Mounted on</td> + <td>'.$app->lng("monitor_diskusage_filesystem_txt").'</td> + <td>'.$app->lng("monitor_diskusage_type_txt").'</td> + <td>'.$app->lng("monitor_diskusage_size_txt").'</td> + <td>'.$app->lng("monitor_diskusage_used_txt").'</td> + <td>'.$app->lng("monitor_diskusage_available_txt").'</td> + <td>'.$app->lng("monitor_diskusage_usage_txt").'</td> + <td>'.$app->lng("monitor_diskusage_mounted_txt").'</td> </tr>'; foreach($data as $line) { $html .= '<tr>'; @@ -113,9 +115,7 @@ return $html; } - -function showMemUsage () -{ +function showMemUsage () { global $app; /* fetch the Data from the DB */ @@ -150,8 +150,7 @@ return $html; } -function showCpuInfo () -{ +function showCpuInfo () { global $app; /* fetch the Data from the DB */ @@ -184,8 +183,7 @@ return $html; } -function showServices () -{ +function showServices () { global $app; /* fetch the Data from the DB */ @@ -204,12 +202,12 @@ if($data['webserver'] != -1) { if($data['webserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>Web-Server:</td> + <td>'.$app->lng("monitor_services_web_txt").'</td> <td>'.$status.'</td> </tr>'; } @@ -217,72 +215,72 @@ if($data['ftpserver'] != -1) { if($data['ftpserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>FTP-Server:</td> + <td>'.$app->lng("monitor_services_ftp_txt").'</td> <td>'.$status.'</td> </tr>'; } if($data['smtpserver'] != -1) { if($data['smtpserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>SMTP-Server:</td> + <td>'.$app->lng("monitor_services_smtp_txt").'</td> <td>'.$status.'</td> </tr>'; } if($data['pop3server'] != -1) { if($data['pop3server'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>POP3-Server:</td> + <td>'.$app->lng("monitor_services_pop_txt").'</td> <td>'.$status.'</td> </tr>'; } if($data['imapserver'] != -1) { if($data['imapserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>IMAP-Server:</td> + <td>'.$app->lng("monitor_services_imap_txt").'</td> <td>'.$status.'</td> </tr>'; } if($data['bindserver'] != -1) { if($data['bindserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>DNS-Server:</td> + <td>'.$app->lng("monitor_services_mydns_txt").'</td> <td>'.$status.'</td> </tr>'; } if($data['mysqlserver'] != -1) { if($data['mysqlserver'] == 1) { - $status = '<span class="online">Online</span>'; + $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>'; } else { - $status = '<span class="offline">Offline</span>'; + $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>'; } $html .= '<tr> - <td>mySQL-Server:</td> + <td>'.$app->lng("monitor_services_mysql_txt").'</td> <td>'.$status.'</td> </tr>'; } @@ -297,8 +295,7 @@ return $html; } -function showSystemUpdate() -{ +function showSystemUpdate() { global $app; /* fetch the Data from the DB */ @@ -313,7 +310,7 @@ * If not (because the destribution is not supported) show this. */ if ($record['state'] == 'no_state'){ - $html .= "Your distribution is not supported for this monitoring"; + $html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>'; } else { $data = unserialize($record['data']); @@ -321,14 +318,13 @@ } $html .= '</div></div>'; } else { - $html = '<p>' . "No Update-Data available" . '</p>'; + $html = '<p>'.$app->lng("no_data_updates_txt").'</p>'; } return $html; } -function showRaidState() -{ +function showRaidState() { global $app; /* fetch the Data from the DB */ @@ -344,7 +340,7 @@ * If not (because the destribution is not supported) show this. */ if ($record['state'] == 'no_state'){ - $html .= '<p>' . "mdadm ist not installed or your Server has no supported RAID" . '</p>'; + $html .= '<p>'.$app->lng("monitor_nomdadm_txt").'</p>'; } else { $data = unserialize($record['data']); @@ -353,14 +349,13 @@ $html .= '</div></div>'; } else { - $html = '<p>' . "No RAID-Data available" . '</p>'; + $html = '<p>'.$app->lng("no_data_raid_txt").'</p>'; } return $html; } -function showRKHunter() -{ +function showRKHunter() { global $app; /* fetch the Data from the DB */ @@ -373,11 +368,11 @@ /* * First, we have to detect, if there is any monitoring-data. - * If not (because the destribution is not supported) show this. + * If not (because rkhunter is not installed) show this. */ $data = unserialize($record['data']); if ($data['output'] == ''){ - $html .= '<p>' . "rkhunter ist not installed, so there is no log data" . '</p>'; + $html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>'; } else { $html .= nl2br($data['output']); @@ -385,14 +380,47 @@ $html .= '</div></div>'; } else { - $html = '<p>' . "No RKHunter-Data available" . '</p>'; + $html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>'; } return $html; } -function showMailq() -{ +function showFail2ban() { + global $app; + + /* fetch the Data from the DB */ + $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' 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 fail2ban is not installed) show this. + */ + $data = unserialize($record['data']); + if ($data == ''){ + $html .= '<p>'. + 'fail2ban 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 showMailq() { global $app; /* fetch the Data from the DB */ @@ -402,7 +430,7 @@ $data = unserialize($record['data']); $html = nl2br($data['output']); } else { - $html = '<p>' . "No Mailq-Data available" . '</p>'; + $html = '<p>'.$app->lng("no_data_mailq_txt").'</p>'; } return $html; @@ -414,8 +442,12 @@ /* fetch the Data from the DB */ $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc"); + /* TODO: datetimeformat should be set somewhat other way */ + $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt"); + if(isset($record['created'])) { - $res = date('Y-m-d H:i', $record['created']); +// $res = date('Y-m-d H:i', $record['created']); + $res = date($dateTimeFormat, $record['created']); } else { $res = '????-??-?? ??:??'; } -- Gitblit v1.9.1