From c6428480bc6a052dbef9c22fc85f78e66b8aee08 Mon Sep 17 00:00:00 2001
From: Tom Laermans
Date: Sat, 12 Mar 2011 08:50:47 +0000
Subject: [PATCH] remove dead map.php code, rename some .inc to .inc.php files,
general trailing space cleanup part 1, some reindent. No expected
functionality change whatsoever ;)
git-svn-id: http://www.observium.org/svn/observer/trunk@1824 61d68cd4-352d-0410-923a-c4978735b2b8
---
README | 2 +-
check-services.php | 81 ++++++------
.../includes/authentication/http-auth.inc.php | 18 +--
html/includes/authentication/ldap.inc.php | 4 +-
html/includes/authentication/mysql.inc.php | 12 +-
html/includes/graphs/device/bits.inc.php | 31 +++--
html/includes/graphs/device/current.inc.php | 28 ++---
html/includes/graphs/device/fanspeeds.inc.php | 26 ++--
.../graphs/device/frequencies.inc.php | 28 ++---
html/includes/graphs/device/humidity.inc.php | 28 ++---
.../graphs/device/temperatures.inc.php | 28 ++---
html/includes/graphs/device/toner.inc.php | 32 ++---
html/includes/graphs/device/voltages.inc.php | 28 ++---
.../graphs/generic_multi_seperated.inc.php | 92 +++++++-------
.../includes/{hostbox.inc => hostbox.inc.php} | 0
html/includes/ifbox.inc | 38 +++---
html/includes/print-menubar.php | 4 +-
.../{print-vlan.inc => print-vlan.inc.php} | 30 ++---
html/includes/service-add.inc.php | 2 +-
html/includes/topnav.inc | 6 +-
html/pages/device/vlans.inc.php | 2 +-
html/pages/devices.inc.php | 2 +-
html/pages/list.inc.php | 2 +-
includes/snmp.inc.php | 34 +++---
includes/static-config.php | 10 +-
irc.php | 35 +++---
map.php | 115 ------------------
poll-billing.php | 2 +-
poll-reachability.php | 12 +-
poller.php | 4 +-
renamehost.php | 12 +-
versioncheck.php | 14 +--
32 files changed, 339 insertions(+), 423 deletions(-)
rename html/includes/{hostbox.inc => hostbox.inc.php} (100%)
rename html/includes/{print-vlan.inc => print-vlan.inc.php} (69%)
delete mode 100755 map.php
diff --git a/README b/README
index 95d490567..bcb0c30eb 100644
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ Please see COPYING for usage requirements and restrictions.
Introduction
------------
-Observium is an auto-discovering network monitoring system.
+Observium is an auto-discovering network monitoring system.
It's designed to be an easily-navigable interface to the health of your network.
diff --git a/check-services.php b/check-services.php
index 24fb540e2..bbccd1658 100755
--- a/check-services.php
+++ b/check-services.php
@@ -3,57 +3,66 @@
include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");
-
+
$sql = "SELECT * FROM devices AS D, services AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC";
$query = mysql_query($sql);
-while ($service = mysql_fetch_array($query)) {
+while ($service = mysql_fetch_array($query))
+{
+ if ($service['status'] = "1")
+ {
+ unset($check, $service_status, $time, $status);
+ $service_status = $service['service_status'];
+ $service_type = strtolower($service['service_type']);
+ $service_param = $service['service_param'];
+ $checker_script = $config['install_dir'] . "/includes/services/" . $service_type . "/check.inc";
- if($service['status'] = "1") {
- unset($check, $service_status, $time, $status);
- $service_status = $service['service_status'];
- $service_type = strtolower($service['service_type']);
- $service_param = $service['service_param'];
- $checker_script = $config['install_dir'] . "/includes/services/" . $service_type . "/check.inc";
- if(is_file($checker_script)) {
- include($checker_script);
- } else {
- $status = "2";
- $check = "Error : Script not found ($checker_script)";
- }
- if($service_status != $status) {
- $updated = ", `service_changed` = '" . time() . "' ";
- if($service['sysContact']) { $email = $service['sysContact']; } else { $email = $config['email_default']; }
- if($status == "1") {
+ if (is_file($checker_script))
+ {
+ include($checker_script);
+ }
+ else
+ {
+ $status = "2";
+ $check = "Error : Script not found ($checker_script)";
+ }
+
+ if ($service_status != $status)
+ {
+ $updated = ", `service_changed` = '" . time() . "' ";
+ if ($service['sysContact']) { $email = $service['sysContact']; } else { $email = $config['email_default']; }
+ if ($status == "1")
+ {
$msg = "Service Up: " . $service['service_type'] . " on " . $service['hostname'];
$msg .= " at " . date($config['timestamp_format']);
notify($device, "Service Up: " . $service['service_type'] . " on " . $service['hostname'], $msg);
- } elseif ($status == "0") {
- $msg = "Service Down: " . $service['service_type'] . " on " . $service['hostname'];
+ }
+ elseif ($status == "0")
+ {
+ $msg = "Service Down: " . $service['service_type'] . " on " . $service['hostname'];
$msg .= " at " . date($config['timestamp_format']);
notify($device, "Service Down: " . $service['service_type'] . " on " . $service['hostname'], $msg);
- }
+ }
+ } else { unset($updated); }
+
+ $update_sql = "UPDATE `services` SET `service_status` = '$status', `service_message` = '" . addslashes($check) . "', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '" . $service['service_id']. "'";
+ mysql_query($update_sql);
+ } else {
+ $status = "0";
+ }
- } else { unset($updated); }
- $update_sql = "UPDATE `services` SET `service_status` = '$status', `service_message` = '" . addslashes($check) . "', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '" . $service['service_id']. "'";
- mysql_query($update_sql);
- } else {
- $status = "0";
- }
-
-
$rrd = $config['rrd_dir'] . "/" . $service['hostname'] . "/" . safename("service-" . $service['service_type'] . "-" . $service['service_id'] . ".rrd");
- if (!is_file($rrd)) {
- $create = $config['rrdtool'] . " create $rrd \
- --step 300 \
+ if (!is_file($rrd))
+ {
+ rrdtool_create($rrd,"--step 300 \
DS:status:GAUGE:600:0:1 \
RRA:AVERAGE:0.5:1:1200 \
- RRA:AVERAGE:0.5:12:2400";
- shell_exec($create);
+ RRA:AVERAGE:0.5:12:2400");
}
- if($status == "1" || $status == "0") {
+ if ($status == "1" || $status == "0")
+ {
rrdtool_update($rrd,"N:".$status);
}
-}
+} # while
?>
diff --git a/html/includes/authentication/http-auth.inc.php b/html/includes/authentication/http-auth.inc.php
index d417fdd29..35c32c465 100644
--- a/html/includes/authentication/http-auth.inc.php
+++ b/html/includes/authentication/http-auth.inc.php
@@ -4,18 +4,18 @@ function authenticate($username,$password)
{
global $config;
- if(isset($_SERVER['REMOTE_USER']))
+ if(isset($_SERVER['REMOTE_USER']))
{
$_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
-
+
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";;
$query = mysql_query($sql);
$row = @mysql_fetch_array($query);
- if($row['username'] && $row['username'] == $_SESSION['username'])
+ if($row['username'] && $row['username'] == $_SESSION['username'])
{
return 1;
- }
- else
+ }
+ else
{
$_SESSION['username'] = $config['http_auth_guest'];
return 1;
@@ -33,19 +33,19 @@ function changepassword($username,$newpassword)
{
# Not supported
}
-
+
function auth_usermanagement()
{
return 1;
}
-
+
function adduser($username, $password, $level, $email = "", $realname = "")
{
mysql_query("INSERT INTO `users` (`username`,`password`,`level`, `email`, `realname`) VALUES ('".mres($username)."',MD5('".mres($password)."'),'".mres($level)."','".mres($email)."','".mres($realname)."')");
-
+
return mysql_affected_rows();
}
-
+
function user_exists($username)
{
return mysql_result(mysql_query("SELECT * FROM users WHERE username = '".mres($username)."'"),0);
diff --git a/html/includes/authentication/ldap.inc.php b/html/includes/authentication/ldap.inc.php
index cb178e3f4..597c76ed8 100644
--- a/html/includes/authentication/ldap.inc.php
+++ b/html/includes/authentication/ldap.inc.php
@@ -58,12 +58,12 @@ function adduser($username, $password, $level, $email = "", $realname = "")
# Not supported
return 0;
}
-
+
function user_exists($username)
{
return 0; # FIXME to be implemented
}
-
+
function get_userlevel($username)
{
# FIXME should come from LDAP
diff --git a/html/includes/authentication/mysql.inc.php b/html/includes/authentication/mysql.inc.php
index 151b94510..9885c45fb 100644
--- a/html/includes/authentication/mysql.inc.php
+++ b/html/includes/authentication/mysql.inc.php
@@ -6,7 +6,7 @@ function authenticate($username,$password)
$sql = "SELECT username FROM `users` WHERE `username`='".$username."' AND `password`='".$encrypted."'";
$query = mysql_query($sql);
$row = @mysql_fetch_array($query);
- if($row['username'] && $row['username'] == $username)
+ if($row['username'] && $row['username'] == $username)
{
return 1;
}
@@ -29,11 +29,11 @@ function auth_usermanagement()
{
return 1;
}
-
+
function adduser($username, $password, $level, $email = "", $realname = "")
{
mysql_query("INSERT INTO `users` (`username`,`password`,`level`, `email`, `realname`) VALUES ('".mres($username)."',MD5('".mres($password)."'),'".mres($level)."','".mres($email)."','".mres($realname)."')");
-
+
return mysql_affected_rows();
}
@@ -41,19 +41,19 @@ function user_exists($username)
{
return mysql_result(mysql_query("SELECT * FROM users WHERE username = '".mres($username)."'"),0);
}
-
+
function get_userlevel($username)
{
$sql = "SELECT level FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
return $row['level'];
}
-
+
function get_userid($username)
{
$sql = "SELECT user_id FROM `users` WHERE `username`='".mres($username)."'";
$row = mysql_fetch_array(mysql_query($sql));
return $row['user_id'];
}
-
+
?>
diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php
index 9a5b638d8..0363233a9 100644
--- a/html/includes/graphs/device/bits.inc.php
+++ b/html/includes/graphs/device/bits.inc.php
@@ -5,31 +5,40 @@
$device = device_by_id_cache($id);
$query = mysql_query("SELECT * FROM `ports` WHERE `device_id` = '".$id."'");
-while($int = mysql_fetch_assoc($query)) {
+while ($int = mysql_fetch_assoc($query))
+{
$ignore = 0;
- if(is_array($config['device_traffic_iftype'])) {
- foreach($config['device_traffic_iftype'] as $iftype) {
- if (preg_match($iftype ."i", $int['ifType'])) {
+ if (is_array($config['device_traffic_iftype']))
+ {
+ foreach ($config['device_traffic_iftype'] as $iftype)
+ {
+ if (preg_match($iftype ."i", $int['ifType']))
+ {
$ignore = 1;
- }
+ }
}
}
- if(is_array($config['device_traffic_descr'])) {
- foreach($config['device_traffic_descr'] as $ifdescr) {
- if (preg_match($ifdescr."i", $int['ifDescr']) || preg_match($ifdescr."i", $int['ifName']) || preg_match($ifdescr."i", $int['portName'])) {
+ if (is_array($config['device_traffic_descr']))
+ {
+ foreach ($config['device_traffic_descr'] as $ifdescr)
+ {
+ if (preg_match($ifdescr."i", $int['ifDescr']) || preg_match($ifdescr."i", $int['ifName']) || preg_match($ifdescr."i", $int['portName']))
+ {
$ignore = 1;
}
}
}
- if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")) && $ignore != 1) {
+ if (is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd")) && $ignore != 1)
+ {
$rrd_filenames[] = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($int['ifIndex'] . ".rrd");
}
+
unset($ignore);
}
$rra_in = "INOCTETS";
-$rra_out = "OUTOCTETS";
+$rra_out = "OUTOCTETS";
$colour_line_in = "006600";
$colour_line_out = "000099";
@@ -38,4 +47,4 @@ $colour_area_out = "C3D9FF";
include ("includes/graphs/generic_multi_bits.inc.php");
-?>
+?>
\ No newline at end of file
diff --git a/html/includes/graphs/device/current.inc.php b/html/includes/graphs/device/current.inc.php
index ba115bb28..ac720dffa 100644
--- a/html/includes/graphs/device/current.inc.php
+++ b/html/includes/graphs/device/current.inc.php
@@ -8,37 +8,37 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='current' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
-while($current = mysql_fetch_array($sql))
+while($current = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
$hostname = gethostbyid($current['device_id']);
-
+
$descr = substr(str_pad($current['sensor_descr'], 15),0,15);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("current-" . $current['sensor_descr'] . ".rrd");
diff --git a/html/includes/graphs/device/fanspeeds.inc.php b/html/includes/graphs/device/fanspeeds.inc.php
index 05758be16..238568985 100644
--- a/html/includes/graphs/device/fanspeeds.inc.php
+++ b/html/includes/graphs/device/fanspeeds.inc.php
@@ -9,31 +9,31 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='fanspeed' AND device_id = '$id'");
$rrd_options .= " COMMENT:'RPM Cur Min Max\\n'";
-while($fanspeed = mysql_fetch_array($sql))
+while($fanspeed = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
diff --git a/html/includes/graphs/device/frequencies.inc.php b/html/includes/graphs/device/frequencies.inc.php
index e7a4ea21f..357bc5850 100644
--- a/html/includes/graphs/device/frequencies.inc.php
+++ b/html/includes/graphs/device/frequencies.inc.php
@@ -8,37 +8,37 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='freq' AND device_id = '$id'");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
-while($frequency = mysql_fetch_array($sql))
+while($frequency = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
$hostname = gethostbyid($frequency['device_id']);
-
+
$descr = substr(str_pad($frequency['sensor_descr'], 15),0,15);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("freq-" . $frequency['sensor_descr'] . ".rrd");
$sensor_id = $frequency['sensor_id'];
diff --git a/html/includes/graphs/device/humidity.inc.php b/html/includes/graphs/device/humidity.inc.php
index 1544dd6b0..735cb3e54 100644
--- a/html/includes/graphs/device/humidity.inc.php
+++ b/html/includes/graphs/device/humidity.inc.php
@@ -8,35 +8,35 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='humidity' AND device_id = '$id' ORDER BY sensor_index");
$rrd_options .= " COMMENT:' Cur Min Max\\n'";
-while($humidity = mysql_fetch_array($sql))
+while($humidity = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
-
+
$humidity['sensor_descr_fixed'] = substr(str_pad($humidity['sensor_descr'], 22),0,22);
$humidityrrd = $config['rrd_dir'] . "/".$device['hostname']."/".safename("humidity-" . safename($humidity['sensor_type']."-".$humidity['sensor_index']) . ".rrd");
$rrd_options .= " DEF:sensor" . $humidity['sensor_id'] . "=$humidityrrd:sensor:AVERAGE ";
diff --git a/html/includes/graphs/device/temperatures.inc.php b/html/includes/graphs/device/temperatures.inc.php
index eae9759ea..fe5d93962 100644
--- a/html/includes/graphs/device/temperatures.inc.php
+++ b/html/includes/graphs/device/temperatures.inc.php
@@ -9,35 +9,35 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='temperature' AND device_id = '$id' ORDER BY sensor_index");
$rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\n'";
-while($temperature = mysql_fetch_array($sql))
+while($temperature = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
-
+
$temperature['sensor_descr_fixed'] = substr(str_pad($temperature['sensor_descr'], $descr_len),0,$descr_len);
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/temperature-" . safename($temperature['sensor_type']."-".$temperature['sensor_index']) . ".rrd";
$rrd_options .= " DEF:sensor" . $temperature['sensor_id'] . "=$rrd_file:sensor:AVERAGE ";
diff --git a/html/includes/graphs/device/toner.inc.php b/html/includes/graphs/device/toner.inc.php
index f5098a82b..755b68ce2 100644
--- a/html/includes/graphs/device/toner.inc.php
+++ b/html/includes/graphs/device/toner.inc.php
@@ -8,41 +8,42 @@ $rrd_options .= " -l 0 -E ";
$iter = "1";
$sql = mysql_query("SELECT * FROM toner where device_id = '$id'");
$rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'";
-while($toner = mysql_fetch_array($sql))
+while($toner = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "000000";
- break;
+ $colour= "000000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0000";
+ $colour= "FF0000";
unset($iter);
break;
}
+
if (stripos($toner['toner_descr'],"cyan" ) !== false || substr($toner['toner_descr'],-1) == 'C') { $colour = "55D6D3"; }
if (stripos($toner['toner_descr'],"magenta") !== false || substr($toner['toner_descr'],-1) == 'M') { $colour = "F24AC8"; }
if (stripos($toner['toner_descr'],"yellow" ) !== false || substr($toner['toner_descr'],-1) == 'Y') { $colour = "FFF200"; }
if (stripos($toner['toner_descr'],"black" ) !== false || substr($toner['toner_descr'],-1) == 'K') { $colour = "000000"; }
-
+
$hostname = gethostbyid($toner['device_id']);
-
+
$descr = substr(str_pad($toner['toner_descr'], 16),0,16);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
$toner_id = $toner['toner_id'];
@@ -56,5 +57,4 @@ while($toner = mysql_fetch_array($sql))
$iter++;
}
-
?>
diff --git a/html/includes/graphs/device/voltages.inc.php b/html/includes/graphs/device/voltages.inc.php
index d2d7a9c1b..db1b08fd4 100644
--- a/html/includes/graphs/device/voltages.inc.php
+++ b/html/includes/graphs/device/voltages.inc.php
@@ -10,36 +10,36 @@ $rrd_options .= " COMMENT:'".str_pad('',$descr_len)." Cur Min Max\\
$iter = "1";
$sql = mysql_query("SELECT * FROM sensors WHERE sensor_class='voltage' AND device_id = '$id'");
-while($sensor = mysql_fetch_array($sql))
+while($sensor = mysql_fetch_array($sql))
{
switch ($iter)
{
case "1":
- $colour= "CC0000";
- break;
+ $colour= "CC0000";
+ break;
case "2":
- $colour= "008C00";
- break;
+ $colour= "008C00";
+ break;
case "3":
- $colour= "4096EE";
- break;
+ $colour= "4096EE";
+ break;
case "4":
- $colour= "73880A";
+ $colour= "73880A";
break;
case "5":
- $colour= "D01F3C";
+ $colour= "D01F3C";
break;
case "6":
- $colour= "36393D";
- break;
- case "7":
+ $colour= "36393D";
+ break;
+ case "7":
default:
- $colour= "FF0084";
+ $colour= "FF0084";
unset($iter);
break;
}
-
+
$sensor['sensor_descr_fixed'] = substr(str_pad($sensor['sensor_descr'], $descr_len),0,$descr_len);
$sensor['sensor_descr_fixed'] = str_replace(':','\:',str_replace('\*','*',$sensor['sensor_descr_fixed']));
diff --git a/html/includes/graphs/generic_multi_seperated.inc.php b/html/includes/graphs/generic_multi_seperated.inc.php
index 0e28fbabc..363b3d242 100644
--- a/html/includes/graphs/generic_multi_seperated.inc.php
+++ b/html/includes/graphs/generic_multi_seperated.inc.php
@@ -1,54 +1,60 @@
diff --git a/html/includes/hostbox.inc b/html/includes/hostbox.inc.php
similarity index 100%
rename from html/includes/hostbox.inc
rename to html/includes/hostbox.inc.php
diff --git a/html/includes/ifbox.inc b/html/includes/ifbox.inc
index d5f57cba4..73948f0e1 100644
--- a/html/includes/ifbox.inc
+++ b/html/includes/ifbox.inc
@@ -1,22 +1,32 @@
$inf
");
- if($ifalias && $ifalias != "") { echo("$ifalias
"); }
- if($iftype && $iftype != "") { echo("$iftype ");
- if($mac && $mac != "") { echo("$mac
");
- } else { echo("
"); }
+echo("");
+
+if (isset($ifalias) && $ifalias != "") { echo(''.$ifalias.'
'); }
+if (isset($iftype) && $iftype != "")
+{
+ echo(''.$iftype.' ');
+ if ($mac && $mac != "")
+ {
+ echo("$mac
");
}
-
- if($interface[ifType] != "softwareLoopback") {
- if($speed == '0') { $speed = "0bps"; }
- echo("$speed");
- if($interface[ifDuplex] != unknown) { echo(" / $interface[ifDuplex]-duplex"); }
- if($interface[ifMtu] && $interface[ifMtu] != "") { echo(" / $interface[ifMtu]MTU"); }
- echo("");
+ else
+ {
+ echo("
");
}
+}
- echo("$status");
+if ($interface[ifType] != "softwareLoopback")
+{
+ if ($speed == '0') { $speed = "0bps"; }
+ echo(''.$speed);
+ if ($interface[ifDuplex] != unknown) { echo(" / $interface[ifDuplex]-duplex"); }
+ if ($interface[ifMtu] && $interface[ifMtu] != "") { echo(" / $interface[ifMtu]MTU"); }
+ echo('');
+}
+
+echo(''.$status.'');
?>
diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php
index fbeea38a5..d2621e9db 100644
--- a/html/includes/print-menubar.php
+++ b/html/includes/print-menubar.php
@@ -20,7 +20,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
if ($this_alert) {
$device_alerts++;
$device_alert_sql .= " OR `device_id` = '" . $device['device_id'] . "'";
- }
+ }
}
?>
@@ -272,7 +272,7 @@ echo('
= '10') {
echo('
');
-
+
if (auth_usermanagement())
{
echo('
diff --git a/html/includes/print-vlan.inc b/html/includes/print-vlan.inc.php
similarity index 69%
rename from html/includes/print-vlan.inc
rename to html/includes/print-vlan.inc.php
index fc78ffe86..33d5b8251 100644
--- a/html/includes/print-vlan.inc
+++ b/html/includes/print-vlan.inc.php
@@ -1,6 +1,6 @@
");
@@ -9,13 +9,14 @@ echo("" . $vlan['vlan_descr'] . " | ");
echo("");
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' ");
-while($port = mysql_fetch_array($ports_query)) {
+while($port = mysql_fetch_array($ports_query))
+{
+ if ($_GET['opta'])
+ {
+ $graph_type = $_GET['opta'];
- if($_GET['opta']) {
- $graph_type = $_GET['opta'];
-
- echo("
- ".makeshortif($port['ifDescr'])."
+ echo(" \
".$port['ifAlias']." \
@@ -25,15 +26,14 @@ while($port = mysql_fetch_array($ports_query)) {
".truncate(short_port_descr($port['ifAlias']), 22, '')."
");
-
-
-
- } else {
- echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr'])));
+ }
+ else
+ {
+ echo($vlan['port_sep'] . generate_port_link($port, makeshortif ($port['ifDescr'])));
$vlan['port_sep'] = ", ";
}
}
-echo(" | ");
-echo("");
-?>
+echo('');
+
+?>
\ No newline at end of file
diff --git a/html/includes/service-add.inc.php b/html/includes/service-add.inc.php
index cf7abc41a..71c66b056 100644
--- a/html/includes/service-add.inc.php
+++ b/html/includes/service-add.inc.php
@@ -2,7 +2,7 @@
$updated = '1';
- $sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
+ $sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
VALUES ('" . mres($_POST['device']). "','" . mres($_POST['ip']) . "','" . mres($_POST['type']) . "',
'" . mres($_POST['descr']) . "','" . mres($_POST['params']) . "','0')";
diff --git a/html/includes/topnav.inc b/html/includes/topnav.inc
index f3554a25a..ddd7e98dc 100644
--- a/html/includes/topnav.inc
+++ b/html/includes/topnav.inc
@@ -1,6 +1,6 @@
");
diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php
index c5d8db534..2c8398011 100644
--- a/html/pages/devices.inc.php
+++ b/html/pages/devices.inc.php
@@ -122,7 +122,7 @@ echo('
$device_query = mysql_query($sql);
while ($device = mysql_fetch_array($device_query)) {
if ( device_permitted($device['device_id']) ) {
- include("includes/hostbox.inc");
+ include("includes/hostbox.inc.php");
}
}
diff --git a/html/pages/list.inc.php b/html/pages/list.inc.php
index fba9bf92b..33ef47175 100644
--- a/html/pages/list.inc.php
+++ b/html/pages/list.inc.php
@@ -20,7 +20,7 @@ echo("
while($device = mysql_fetch_array($device_query)) {
- include("includes/hostbox.inc");
+ include("includes/hostbox.inc.php");
}
diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php
index 7784ed935..39a2eb334 100644
--- a/includes/snmp.inc.php
+++ b/includes/snmp.inc.php
@@ -71,7 +71,7 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
-
+
if (strstr($oid,' '))
{
echo "BUG: snmp_get called for multiple OIDs: $oid\n";
@@ -124,7 +124,7 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
{
global $debug,$config,$runtime_stats;
-
+
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
@@ -172,10 +172,10 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
{
global $config;
-
+
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
-
+
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
$snmpcommand = $config['snmpwalk'];
@@ -184,19 +184,19 @@ function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
{
$snmpcommand = $config['snmpbulkwalk'];
}
-
+
$cmd = $snmpcommand . " -O snQ -" . $device['snmpver'] . " -c " . $device['community'] . " ";
if ($mib) { $cmd .= " -m $mib"; }
$cmd .= " -M ".$config['install_dir']."/mibs/";
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
if (isset($retries)) { $cmd .= " -r " . $retries; }
-
+
$cmd .= " ".$device['hostname'].":".$device['port']." ".$oid;
-
+
if (!$debug) { $cmd .= " 2>/dev/null"; }
$data = trim(shell_exec($cmd));
$device_id = $device['device_id'];
-
+
#echo("Caching: $oid\n");
foreach(explode("\n", $data) as $entry)
{
@@ -226,10 +226,10 @@ function snmp_cache_ifIndex($device)
{
// FIXME: this has no internal version, and is not yet using our own snmp_*
global $config;
-
+
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
-
+
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
$snmpcommand = $config['snmpwalk'];
@@ -238,17 +238,17 @@ function snmp_cache_ifIndex($device)
{
$snmpcommand = $config['snmpbulkwalk'];
}
-
+
$cmd = $snmpcommand . " -O Qs -" . $device['snmpver'] . " -c " . $device['community'] . " ";
$cmd .= " -M ".$config['install_dir']."/mibs/";
$cmd .= " -m IF-MIB ifIndex";
-
+
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
if (isset($retries)) { $cmd .= " -r " . $retries; }
if (!$debug) { $cmd .= " 2>/dev/null"; }
$data = trim(shell_exec($cmd));
$device_id = $device['device_id'];
-
+
foreach(explode("\n", $data) as $entry)
{
list ($this_oid, $this_value) = preg_split("/=/", $entry);
@@ -316,7 +316,7 @@ function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir =
function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
{
$data = snmp_walk($device, $oid, "-OQUs", $mib, $mibdir);
-
+
foreach(explode("\n", $data) as $entry)
{
list($oid,$value) = explode("=", $entry);
@@ -354,10 +354,10 @@ function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = NULL, $mibdir =
function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib = 0)
{
global $config;
-
+
if (is_numeric($device['timeout'])) { $timeout = $device['timeout']; } elseif (isset($config['snmp']['timeout'])) { $timeout = $config['snmp']['timeout']; }
if (is_numeric($device['retries'])) { $retries = $device['retries']; } elseif (isset($config['snmp']['retries'])) { $retries = $config['snmp']['retries']; }
-
+
if ($device['snmpver'] == 'v1' || $config['os'][$device['os']]['nobulk'])
{
$snmpcommand = $config['snmpwalk'];
@@ -488,7 +488,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0)
{
$string .= " $oid.$port";
}
-
+
$cmd = $config['snmpget'] . " -O vq -" . $device['snmpver'] . " -c " . $device['community'] . " ";
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
if (isset($retries)) { $cmd .= " -r " . $retries; }
diff --git a/includes/static-config.php b/includes/static-config.php
index 5e0bdeb3c..491cf77dc 100644
--- a/includes/static-config.php
+++ b/includes/static-config.php
@@ -767,18 +767,18 @@ if (isset($config['enable_printers']) && $config['enable_printers'])
$config['version'] = "0.10";
-if(isset($config['rrdgraph_def_text']))
+if(isset($config['rrdgraph_def_text']))
{
$config['rrdgraph_def_text'] = str_replace(" ", " ", $config['rrdgraph_def_text']);
$config['rrd_opts_array'] = explode(" ", trim($config['rrdgraph_def_text']));
}
-if(!isset($config['log_file']))
+if(!isset($config['log_file']))
{
$config['log_file'] = $config['install_dir'] . "/observium.log";
}
-if(!isset($config['mibdir']))
+if(!isset($config['mibdir']))
{
$config['mibdir'] = $config['install_dir']."/mibs/";
}
@@ -794,14 +794,14 @@ $nagios_db = mysql_select_db($config['nagios_db_name'], $nagios_link);
}
# If we're on SSL, let's properly detect it
-if(isset($_SERVER['HTTPS']))
+if(isset($_SERVER['HTTPS']))
{
$config['base_url'] = preg_replace('/^http:/','https:', $config['base_url']);
}
### Connect to database
$observium_link = mysql_pconnect($config['db_host'], $config['db_user'], $config['db_pass']);
-if (!$observium_link)
+if (!$observium_link)
{
echo("Observer MySQL Error
");
echo(mysql_error());
diff --git a/irc.php b/irc.php
index 4a59c2e4f..1ed5a5b82 100755
--- a/irc.php
+++ b/irc.php
@@ -8,42 +8,37 @@ include("includes/discovery/functions.inc.php");
include_once('Net/SmartIRC.php');
-
class observiumbot
{
-
- function device_info (&$irc, &$data)
+ function device_info(&$irc, &$data)
{
- $hostname = $data->messageex[1];
+ $hostname = $data->messageex[1];
- $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
+ $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
- if($device['status'] == 1) { $status = "Up " . formatUptime($device['uptime'] . " "); } else { $status = "Down "; }
- if($device['ignore']) { $status = "*Ignored*"; }
- if($device['disabled']) { $status = "*Disabled*"; }
+ if($device['status'] == 1) { $status = "Up " . formatUptime($device['uptime'] . " "); } else { $status = "Down "; }
+ if($device['ignore']) { $status = "*Ignored*"; }
+ if($device['disabled']) { $status = "*Disabled*"; }
- $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id'.$device['device_id'] . " " . $device['os'] . " " . $device['version'] . " " .
+ $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id'.$device['device_id'] . " " . $device['os'] . " " . $device['version'] . " " .
$device['features'] . " " . $status);
-
}
-
- function port_info (&$irc, &$data)
- {
+ function port_info(&$irc, &$data)
+ {
$hostname = $data->messageex[1];
$ifname = $data->messageex[2];
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
$port = mysql_fetch_Array(mysql_query("SELECT * FROM `ports` WHERE `ifName` = '".$ifname."' OR `ifDescr` = '".$ifname."' AND device_id = '".$device['device_id']."'"));
- $bps_in = formatRates($port['ifInOctets_rate']);
- $bps_out = formatRates($port['ifOutOctets_rate']);
- $pps_in = format_bi($port['ifInUcastPkts_rate']);
- $pps_out = format_bi($port['ifOutUcastPkts_rate']);
+ $bps_in = formatRates($port['ifInOctets_rate']);
+ $bps_out = formatRates($port['ifOutOctets_rate']);
+ $pps_in = format_bi($port['ifInUcastPkts_rate']);
+ $pps_out = format_bi($port['ifOutUcastPkts_rate']);
- $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id' . $port['interface_id'] . " " . $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " .
+ $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id' . $port['interface_id'] . " " . $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " .
$bps_in. " > bps > " . $bps_out . " | " . $pps_in. "pps > PPS > " . $pps_out ."pps");
-
}
}
@@ -65,4 +60,4 @@ $irc->join( array( $chan ) );
$irc->listen( );
$irc->disconnect( );
-?>
+?>
\ No newline at end of file
diff --git a/map.php b/map.php
deleted file mode 100755
index 376644bce..000000000
--- a/map.php
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env php
-= "10000000000") {
- $info .= "color=lightred weight=10 style=\"setlinewidth(8)\"";
- } elseif ($src_speed >= "1000000000") {
- $info .= "color=lightblue weight=5 style=\"setlinewidth(4)\"";
- } elseif ($src_speed >= "100000000") {
- $info .= "color=lightgrey weight=1 style=\"setlinewidth(2)\"";
- } elseif ($src_speed >= "10000000") {
- $info .= "style=\"setlinewidth(1)\" weight=1";
- }
-
- unset($die);
-
- $i = 0;
- while ($i < count($linkdone)) {
- $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']);
-
- 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'];
- $x++;
- }
-}
-
-echo("}");
-
-?>
diff --git a/poll-billing.php b/poll-billing.php
index 555b69635..a5443e458 100644
--- a/poll-billing.php
+++ b/poll-billing.php
@@ -106,7 +106,7 @@ function CollectData($bill_id)
$prev_in_delta = '0';
$prev_out_delta = '0';
}
-
+
if ($delta < '0' )
{
$delta = $prev_delta;
diff --git a/poll-reachability.php b/poll-reachability.php
index 4e87dadcc..1e28a87bf 100755
--- a/poll-reachability.php
+++ b/poll-reachability.php
@@ -15,10 +15,10 @@ while ($device = mysql_fetch_array($device_query)) {
if( isPingable($device['hostname']) ) {
$pos = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
echo($device['protocol'].":".$device['hostname'].":".$device['port']." - ".$device['community']." ".$device['snmpver'].": ");
- if($pos == '') {
+ if($pos == '') {
$status='0';
- } else {
- $status='1';
+ } else {
+ $status='1';
}
} else {
$status='0';
@@ -34,15 +34,15 @@ while ($device = mysql_fetch_array($device_query)) {
if($status != $device['status']) {
mysql_query("UPDATE `devices` SET `status`= '$status' WHERE `device_id` = '" . $device['device_id'] . "'");
- if ($status == '1') {
- $stat = "Up";
+ if ($status == '1') {
+ $stat = "Up";
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is up\n')");
if($config['alerts']['email']['enable'])
{
notify($device, "Device Up: " . $device['hostname'], "Device Up: " . $device['hostname'] . " at " . date($config['timestamp_format']));
}
} else {
- $stat = "Down";
+ $stat = "Down";
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('9', '" . $device['device_id'] . "', 'Device is down\n')");
if($config['alerts']['email']['enable'])
{
diff --git a/poller.php b/poller.php
index 2687f7b35..bc93216af 100755
--- a/poller.php
+++ b/poller.php
@@ -117,10 +117,10 @@ while ($device = mysql_fetch_assoc($device_query))
$graphs = array();
$oldgraphs = array();
-
+
$snmpdata = snmp_get_multi($device, "sysUpTime.0 sysLocation.0 sysContact.0 sysName.0", "-OQUs", "SNMPv2-MIB");
foreach (array_keys($snmpdata[0]) as $key) { $$key = $snmpdata[0][$key]; }
-
+
$sysDescr = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
$sysName = strtolower($sysName);
diff --git a/renamehost.php b/renamehost.php
index b4734ebe1..acb75e986 100755
--- a/renamehost.php
+++ b/renamehost.php
@@ -7,17 +7,21 @@ include("includes/functions.php");
# Remove a host and all related data from the system
-if($argv[1] && $argv[2]) {
+if($argv[1] && $argv[2])
+{
$host = strtolower($argv[1]);
$id = getidbyname($host);
- if($id) {
+ if($id)
+ {
renamehost($id, $argv[2]);
echo("Renamed $host\n");
} else {
echo("Host doesn't exist!\n");
}
-} else {
- echo("Host Rename Tool\nUsage: ./renamehost.php \n");
+}
+else
+{
+ echo("Host Rename Tool\nUsage: ./renamehost.php \n");
}
?>
diff --git a/versioncheck.php b/versioncheck.php
index 833558cc3..770290ca7 100755
--- a/versioncheck.php
+++ b/versioncheck.php
@@ -5,40 +5,38 @@ include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");
-$ports = mysql_result(mysql_query("SELECT count(*) FROM ports"),0);
+$ports = mysql_result(mysql_query("SELECT count(*) FROM ports"),0);
$devices = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
$dataHandle = fopen("http://www.observium.org/latest.php?i=$ports&d=$devices&v=".$config['version'], r);
-if($dataHandle)
+if ($dataHandle)
{
while (!feof($dataHandle))
{
$data.= fread($dataHandle, 4096);
}
- if($data)
+ if ($data)
{
list($major, $minor, $release) = explode(".", $data);
list($cur, $tag) = explode("-", $config['version']);
list($cur_major, $cur_minor, $cur_release) = explode(".", $cur);
- if($argv[1] == "--cron")
+ if ($argv[1] == "--cron")
{
$fd = fopen('vrrd/version.txt','w');
fputs($fd, "$major.$minor.$release");
fclose($fd);
-
} else {
-
echo("Current Version $cur_major.$cur_minor.$cur_release \n");
- if($major > $cur_major) {
+ if ($major > $cur_major) {
echo("New major release : $major.$minor.$release");
} elseif ($major == $cur_major && $minor > $cur_minor) {
echo("New minor release : $major.$minor.$release");
} elseif ($major == $cur_major && $minor == $cur_minor && $release > $cur_release) {
echo("New trivial release : $major.$minor.$release");
- } elseif($major < $cur_major || ($major == $cur_major && $minor < $cur_minor) || ($major == $cur_major && $minor == $cur_minor && $release < $cur_release)) {
+ } elseif ($major < $cur_major || ($major == $cur_major && $minor < $cur_minor) || ($major == $cur_major && $minor == $cur_minor && $release < $cur_release)) {
echo("Your release is newer than the official version!\n");
} else {
echo("Your release is up to date\n");