cleanups code, YAY COMMIT 1000

git-svn-id: http://www.observium.org/svn/observer/trunk@1000 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans 2010-03-07 22:22:29 +00:00
parent 82674df959
commit a549e37fff
3 changed files with 71 additions and 56 deletions

View File

@ -46,7 +46,7 @@ if (isset($_SESSION['username']))
if (authenticate($_SESSION['username'],$_SESSION['password']))
{
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
$_SESSION['user_id'] = get_userid($_SESSION['username']);;
$_SESSION['user_id'] = get_userid($_SESSION['username']);
if(!$_SESSION['authenticated'])
{
$_SESSION['authenticated'] = true;

View File

@ -1,54 +1,73 @@
<?php
if ($config['overview_show_sysDescr']) {
echo("<div style='font-family: courier, serif; margin: 10px';><strong>" . $device['sysDescr'] . "</strong></div>");
if ($config['overview_show_sysDescr'])
{
echo('<div style="font-family: courier, serif; margin: 10px";><strong>' . $device['sysDescr'] . "</strong></div>");
}
# $uptime = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0);
$uptime = $device['uptime'];
if(is_file("images/devices/" . $device['hardware'] . ".gif")) {
if(is_file("images/devices/" . $device['hardware'] . ".gif"))
{
$dev_img = "<div style='float: left;'><img src='images/devices/" . $device['hardware'] . ".gif' align=absmiddle></img></div>";
} elseif (is_file("images/devices/" . $device['hardware'] . ".jpg")) {
}
elseif (is_file("images/devices/" . $device['hardware'] . ".jpg"))
{
$dev_img = "<div style='float: left;'><img src='images/devices/" . $device['hardware'] . ".jpg' align=absmiddle></img></div>";
} else { unset($dev_img); }
}
elseif (is_file("images/devices/" . $device['hardware'] . ".png"))
{
$dev_img = "<div style='float: left;'><img src='images/devices/" . $device['hardware'] . ".png' align=absmiddle></img></div>";
}
else
{
$dev_img = '';
}
if ($device['os'] == "ios") { formatCiscoHardware($device); }
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
$device['os_text'] = $os_text[$device['os']];
if ($device['os'] == "ios") { formatCiscoHardware($device); }
if ($device['features']) { $device['features'] = "(".$device['features'].")"; }
$device['os_text'] = $os_text[$device[os]];
echo($dev_img . '
<table width="100%">');
echo("$ddev_img
<table width=100%>");
if($device['hardware'])
{
echo('<tr>
<td class="list-bold">Hardware</td>
<td>' . $device['hardware']. '</td>
</tr>');
}
if($device['hardware']) {echo("<tr>
<td class=list-bold>Hardware</td>
<td>" . $device['hardware']. "</td>
</tr>"); }
echo('<tr>
<td class="list-bold">Operating System</td>
<td>' . $device['os_text'] . ' ' . $device['version'] . ' ' . $device['features'] . ' </td>
</tr>');
echo("<tr>
<td class=list-bold>Operating System</td>
<td>" . $device['os_text'] . " " . $device['version'] . " " . $device['features'] . " </td>
</tr>");
if($device['sysContact'])
{
echo('<tr>
<td class="list-bold">Contact</td>
<td>' . htmlspecialchars($device['sysContact']). '</td>
</tr>');
}
if($device['sysContact']) {echo("<tr>
<td class=list-bold>Contact</td>
<td>" . htmlspecialchars($device['sysContact']). "</td>
</tr>"); }
if($device['location'])
{
echo('<tr>
<td class="list-bold">Location</td>
<td>' . $device['location']. '</td>
</tr>');
}
if($device['location']) {echo("<tr>
<td class=list-bold>Location</td>
<td>" . $device['location']. "</td>
</tr>"); }
if($uptime) { echo("<tr>
<td class=list-bold>Uptime</td>
<td>" . formatUptime($uptime) . "</td>
</tr>"); }
echo("
</table>");
if($uptime)
{
echo('<tr>
<td class="list-bold">Uptime</td>
<td>' . formatUptime($uptime) . '</td>
</tr>');
}
echo('
</table>');
?>

View File

@ -1,24 +1,24 @@
<?php
if($ports['total']) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "");
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">
' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s'));
echo(' <div style="height: 5px;"></div>');
echo("<div style='height: 5px;'></div>");
echo(' <table class="tablehead" cellpadding="2" cellspacing="0" width="100%">
<tr bgcolor="' . $ports_colour . '" align="center"><td></td>
<td width="25%"><img src="images/16/connect.png" align="absmiddle"> ' . $ports['total'] . '</td>
<td width="25%" class="green"><img src="images/16/if-connect.png" align="absmiddle"> ' . $ports['up'] . '</td>
<td width="25%" class="red"><img src="images/16/if-disconnect.png" align="absmiddle"> ' . $ports['down'] . '</td>
<td width="25%" class="grey"><img src="images/16/if-disable.png" align="absmiddle"> ' . $ports['disabled'] . '</td>
</tr>
</table>');
echo("
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor=$ports_colour align=center><td></td>
<td width=25%><img src='images/16/connect.png' align=absmiddle> $ports[total]</td>
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $ports[up]</td>
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $ports[down]</td>
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $ports[disabled]</td></tr>
</table>");
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
echo(' <div style="margin: 8px; font-size: 11px; font-weight: bold;">');
$sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
$query = mysql_query($sql);
$ifsep = "";
while($data = mysql_fetch_array($query)) {
$data = ifNameDescr($data);
$data['hostname'] = $device['hostname'];
@ -26,11 +26,7 @@ echo("
$ifsep = ", ";
}
unset($ifsep);
echo(" </div>");
echo("</div>");
echo("</div>");
}
?>