diff --git a/html/index.php b/html/index.php index 4351af2da..2b90769c5 100755 --- a/html/index.php +++ b/html/index.php @@ -205,9 +205,20 @@ if ($_SESSION['authenticated']) } } else { - // Not Authenticated. Print login. - include("pages/logon.inc.php"); - + // Not Authenticated. Show status page if enabled + if ( $config['public_status'] ) + { + if (isset($vars['page']) && strstr("login", $vars['page'])) + { + include("pages/logon.inc.php"); + } else { + include("pages/public.inc.php"); + } + } + else + { + include("pages/logon.inc.php"); + } exit; } ?> diff --git a/html/pages/public.inc.php b/html/pages/public.inc.php new file mode 100644 index 000000000..ae70f8a9b --- /dev/null +++ b/html/pages/public.inc.php @@ -0,0 +1,116 @@ +

System Status

'; + +$query = "SELECT * FROM `devices` WHERE 1 ".$where." ORDER BY hostname"; + +list($format, $subformat) = explode("_", $vars['format']); + +if($format == "graph") +{ + $row = 1; + foreach (dbFetchRows($query, $sql_param) as $device) + { + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + + if (device_permitted($device['device_id'])) + { + if (!$location_filter || ((get_dev_attrib($device,'override_sysLocation_bool') && get_dev_attrib($device,'override_sysLocation_string') == $location_filter) + || $device['location'] == $location_filter)) + { + $graph_type = "device_".$subformat; + + if ($_SESSION['widescreen']) { $width=270; } else { $width=315; } + + echo("
+ ".$device['hostname']." - ".$interface['ifDescr']."
\ + \ + ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". + " + + "); + } + } + } + +} else { + + echo('
+
+ '); + if ($subformat == "detail" || $subformat == "basic") + { + echo(' + + + + + + + + '); + } + + foreach (dbFetchRows($query, $sql_param) as $device) + { + if (!device_permitted($device['device_id'])) + { + include("includes/hostbox-basic.inc.php"); + } + } + echo("
DevicePlatformOperating SystemUptime/Location
"); + echo('
'); + echo('
'); +} + +?> + diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index a0e0ad167..60bb9a7c9 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -118,6 +118,7 @@ $config['page_title_suffix'] = $config['project_name']; $config['timestamp_format'] = 'd-m-Y H:i:s'; $config['page_gen'] = 0; # display MySqL & PHP stats in footer? $config['login_message'] = "Unauthorised access or use shall render the user liable to criminal and/or civil prosecution."; +$config['public_status'] = false; // Enable public accessable status page $config['old_graphs'] = 1; // RRDfiles from before the great rra reform. This is default for a while.