some formatting cleanups, introduce some more FIXMEs to look at, plus replace mysql_fetch_array by mysql_fetch_assoc, for great justice

git-svn-id: http://www.observium.org/svn/observer/trunk@2029 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-04-06 13:54:50 +00:00
parent 51e242b896
commit f55a30f744
163 changed files with 476 additions and 460 deletions
+21 -15
View File
@@ -11,7 +11,7 @@ $nodes = array();
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
while ($device = mysql_fetch_array($sql))
while ($device = mysql_fetch_assoc($sql))
{
unset($already);
$i = 0;
@@ -28,7 +28,7 @@ while ($device = mysql_fetch_array($sql))
}
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -39,7 +39,7 @@ while ($device = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql)){
while ($interface = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
@@ -51,7 +51,7 @@ while ($interface = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)){
while ($service = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
@@ -63,7 +63,7 @@ while ($service = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id");
while ($peer = mysql_fetch_array($sql)){
while ($peer = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
<center><strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
@@ -75,7 +75,7 @@ while ($peer = mysql_fetch_array($sql)){
}
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'");
while ($device = mysql_fetch_array($sql)){
while ($device = mysql_fetch_assoc($sql)){
echo("<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>
<center><strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
@@ -96,7 +96,7 @@ echo("
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
echo("</table>");
@@ -108,13 +108,14 @@ echo("</div>
/// this stuff can be customised to show whatever you want....
if ($_SESSION['userlevel'] >= '5') {
if ($_SESSION['userlevel'] >= '5')
{
$sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['l2tp'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
@@ -123,7 +124,8 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['transit'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
@@ -132,12 +134,14 @@ if ($_SESSION['userlevel'] >= '5') {
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
$query = mysql_query($sql);
unset ($seperator);
while ($interface = mysql_fetch_array($query)) {
while ($interface = mysql_fetch_assoc($query))
{
$ports['voip'] .= $seperator . $interface['interface_id'];
$seperator = ",";
}
if ($ports['transit']) {
if ($ports['transit'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['transit'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
@@ -145,7 +149,8 @@ if ($_SESSION['userlevel'] >= '5') {
"&amp;from=".$day."&amp;to=".$now."&amp;width=200&amp;height=100'></a>");
}
if ($ports['l2tp']) {
if ($ports['l2tp'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['l2tp'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>".
@@ -153,7 +158,8 @@ if ($_SESSION['userlevel'] >= '5') {
"&amp;from=".$day."&amp;to=".$now."&amp;width=200&amp;height=100'></a>");
}
if ($ports['voip']) {
if ($ports['voip'])
{
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&amp;ports=".$ports['voip'].
"&amp;from=".$day."&amp;to=".$now."&amp;width=400&amp;height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
"<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".