code cleanups

git-svn-id: http://www.observium.org/svn/observer/trunk@753 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-01-31 17:30:16 +00:00
parent 20ddcab9c1
commit 7bea8d4941
5 changed files with 10 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ while ($service = mysql_fetch_array($query)) {
unset($check, $service_status, $time, $status);
$service_status = $service['service_status'];
$service_type = strtolower($service[service_type]);
$service_type = strtolower($service['service_type']);
$service_param = $service['service_param'];
$checker_script = "includes/services/" . $service_type . "/check.inc";
if(is_file($checker_script)) {

View File

@@ -50,7 +50,7 @@ $query = "SELECT * FROM interfaces AS I, devices as D
WHERE I.device_id = D.device_id AND D.status = '1'";
$data = mysql_query($query);
while($row = mysql_fetch_array($data)) {
$index = $row[ifIndex];
$index = $row['ifIndex'];
$hostname = $row['hostname'];
$community = $row['community'];
$port = $row['port'];

View File

@@ -1,6 +1,6 @@
<?php
if($_SESSION[userlevel] < '5') {
if($_SESSION['userlevel'] < '5') {
print_error("Insufficient Privileges");
} else {

View File

@@ -6,6 +6,7 @@ if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device[
$file = $config['rancid_configs'] . $device['hostname'];
$fh = fopen($file, 'r') or die("Can't open file");
$text = fread($fh, filesize($file));
fclose($fh);
if ($config['rancid_ignorecomments'])
{
$lines = split("\n",$text);
@@ -20,11 +21,9 @@ if($_SESSION['userlevel'] >= "5" && is_file($config['rancid_configs'] . $device[
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
$geshi->set_overall_style('color: black;');
# $geshi->set_line_style('color: #999999');
echo $geshi->parse_code();
fclose($fh);
echo $geshi->parse_code();
} else {
print_error("Error : Insufficient access.");
}
?>

10
map.php
View File

@@ -44,7 +44,7 @@ while($loc_data = mysql_fetch_array($loc_result)) {
if(strpos($host, "vax")) { $hostinfo = "shape=rect style=filled fillcolor=skyblue"; }
if(strpos($host, "vsx")) { $hostinfo = "shape=box3d style=filled fillcolor=skyblue"; }
$host = $dev_data[hostname];
$host = $dev_data['hostname'];
$host = str_replace("." . $config['mydomain'],"", $host);
echo("\"$host\" [$hostinfo]
");
@@ -94,18 +94,18 @@ while($link_data = mysql_fetch_array($links_result)) {
$i = 0;
while ($i < count($linkdone)) {
$thislink = "$dst $link_data[dif] $src $link_data[sif]";
$thislink = "$dst ".$link_data['dif']." $src ".$link_data['sif'];
if ($linkdone[$i] == $thislink) { $die = "yes"; }
$i++;
}
$sif = makeshortif($link_data[sif]);
$dif = makeshortif($link_data[dif]);
$sif = makeshortif($link_data['sif']);
$dif = makeshortif($link_data['dif']);
if(!$die){
echo("\"$src\" -> \"$dst\" [taillabel=\"$dif\" headlabel=\"$sif\" arrowhead=dot arrowtail=dot $info];\n");
# echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
$linkdone[] = "$src $link_data[sif] $dst $link_data[dif]";
$linkdone[] = "$src ".$link_data['sif']." $dst ".$link_data['dif'];
$x++;
}
}