diff --git a/html/includes/print-event.inc b/html/includes/print-event.inc
index 288128a1c4..7279cfa65b 100644
--- a/html/includes/print-event.inc
+++ b/html/includes/print-event.inc
@@ -1,7 +1,7 @@
' . $entry['datetime'] . '
');
- if(!$_GET[id] && !$overview) {
+ if(!isset($_GET['id']) && (!isset($overview) || $overview == 0)) {
$dev['device_id'] = $entry['host'];
$dev['hostname'] = $hostname;
echo("
diff --git a/html/index.php b/html/index.php
index c27fea80da..b8ca03c083 100755
--- a/html/index.php
+++ b/html/index.php
@@ -82,7 +82,7 @@ function popUp(URL) {
$data = trim(shell_exec("cat " . $config['install_dir'] . "/rrd/version.txt"));
list($major, $minor, $release) = explode(".", $data);
- list($cur, $tag) = explode("-", $config['version']);
+ if (strstr('-',$config['version'])) { list($cur, $tag) = explode("-", $config['version']); } else { $cur = $config['version']; }
list($cur_major, $cur_minor, $cur_release) = explode(".", $cur);
if($major > $cur_major) {
@@ -118,7 +118,7 @@ function popUp(URL) {
if($_SESSION['authenticated']) {
include("includes/warn-deleted-interfaces.inc.php");
## Authenticated. Print a page.
- if($_GET['page'] && !strstr("..", $_GET['page']) && is_file("pages/" . $_GET['page'] . ".php")) {
+ if(isset($_GET['page']) && !strstr("..", $_GET['page']) && is_file("pages/" . $_GET['page'] . ".php")) {
include("pages/" . $_GET['page'] . ".php");
} else {
if($config['front_page']) {
diff --git a/html/pages/front/default.php b/html/pages/front/default.php
index 3b27e57490..57e51fb980 100644
--- a/html/pages/front/default.php
+++ b/html/pages/front/default.php
@@ -92,7 +92,7 @@ while($device = mysql_fetch_array($sql)){
}
-if($config['frontpage_display'] == 'syslog') {
+if($config['enable_syslog']) {
## Open Syslog Div
echo("
diff --git a/includes/collectd/config.php b/includes/collectd/config.php
index 5982c652b4..1cbb0b57e1 100644
--- a/includes/collectd/config.php
+++ b/includes/collectd/config.php
@@ -6,13 +6,13 @@
// Array of paths when collectd's rrdtool plugin writes RRDs
$config['datadirs'] = array('/var/lib/collectd/rrd/');
// Width of graph to be generated by rrdgraph
-if($_GET['width']) {
+if(isset($_GET['width'])) {
$config['rrd_width'] = $_GET['width'];
} else {
$config['rrd_width'] = 270;
}
// Height of graph to be generated by rrdgraph
-if($_GET['height']) {
+if(isset($_GET['height'])) {
$config['rrd_height'] = $_GET['height'];
} else {
$config['rrd_height'] = 120;
@@ -29,7 +29,7 @@ $config['rrd_interval'] = 10;
// Average rows/rra (currently ignored)
$config['rrd_rows'] = 2400;
// Additional options to pass to rrdgraph
-$config['rrd_opts'] = $config['rrdgraph_defaults'];
+$config['rrd_opts'] = (isset($config['rrdgraph_defaults']) ? $config['rrdgraph_defaults'] : '');
#$config['rrd_opts'] = array('-E', "-c", "SHADEA#a5a5a5", "-c", "SHADEB#a5a5a5", "-c", "FONT#000000", "-c", "CANVAS#FFFFFF", "-c", "GRID#aaaaaa",
# "-c", "MGRID#FFAAAA", "-c", "FRAME#3e3e3e", "-c", "ARROW#5e5e5e", "-R", "normal");
// Predefined set of colors for use by collectd_draw_rrd()
diff --git a/includes/functions.php b/includes/functions.php
index dce9efb9cb..5c85d91f42 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -72,19 +72,13 @@ function write_dev_attrib($device_id, $attrib_type, $attrib_value) {
}
function shorthost($hostname, $len=16) {
- list ($first, $second, $third, $fourth, $fifth) = explode(".", $hostname);
- $shorthost = $first;
- if(strlen($first.".".$second) < $len && $second) {
- $shorthost = $first.".".$second;
- if(strlen($shorthost.".".$third) < $len && $third) {
- $shorthost = $shorthost.".".$third;
- if(strlen($shorthost.".".$fourth) < $len && $fourth) {
- $shorthost = $shorthost.".".$fourth;
- if(strlen($shorthost.".".$fifth) < $len && $fifth) {
- $shorthost = $shorthost.".".$fifth;
- }
- }
- }
+ $parts = explode(".", $hostname);
+ $shorthost = $parts[0];
+ $i=1;
+ while ($i < count($parts) && strlen($shorthost.'.'.$parts[$i]) < $len)
+ {
+ $shorthost = $shorthost.'.'.$parts[$i];
+ $i++;
}
return ($shorthost);
}
@@ -281,12 +275,12 @@ function geteventicon ($message)
if($icon) { return $icon; } else { return false; }
}
-function generateiflink($interface, $text=0,$type)
+function generateiflink($interface, $text=0, $type = '')
{
global $twoday; global $now; global $config; global $day; global $month;
$interface = ifNameDescr($interface);
if(!$text) { $text = fixIfName($interface['label']); }
- if($type) { $interface['graph_type'] = $type; }
+ if(isset($type)) { $interface['graph_type'] = $type; }
if(!$interface['graph_type']) { $interface['graph_type'] = 'port_bits'; }
$class = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
$graph_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&from=$day&to=$now&width=400&height=100&type=" . $interface['graph_type'];
@@ -325,10 +319,10 @@ function device_traffic_image($device, $width, $height, $from, $to)
function devclass($device)
{
- if ($device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
- if ($device['ignore'] == '1') {
+ if (isset($device['status']) && $device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
+ if (isset($device['ignore']) &&$device['ignore'] == '1') {
$class = "list-device-ignored";
- if ($device['status'] == '1') { $class = "list-device-ignored-up"; }
+ if (isset($device['status']) && $device['status'] == '1') { $class = "list-device-ignored-up"; }
}
return $class;
}
diff --git a/includes/rewrites.php b/includes/rewrites.php
index fc0a96e02b..f739ab75e4 100644
--- a/includes/rewrites.php
+++ b/includes/rewrites.php
@@ -10,7 +10,7 @@ function ifNameDescr ($interface, $device = NULL) {
global $config;
if(!$device) { $device = device_array($interface['device_id']); }
$os = strtolower($device['os']);
- if($config['ifname'][$os]) {
+ if(isset($config['ifname'][$os])) {
$interface['label'] = $interface['ifDescr'];
} else {
$interface['label'] = $interface['ifName'];
|