Resolved a large number index issues and update Console_Color to V2

This commit is contained in:
laf
2015-03-01 17:06:38 +00:00
parent 7dfbfd5c0e
commit c1ef9b6808
18 changed files with 168 additions and 160 deletions

View File

@@ -192,7 +192,7 @@ if (!empty($argv[1]))
}
}
print Console_Color::convert("\n" . $config['project_name_version']." Add Host Tool
print $console_color->convert("\n" . $config['project_name_version']." Add Host Tool
Usage (SNMPv1/2c): ./addhost.php <%Whostname%n> [community] [v1|v2c] [port] [" . implode("|",$config['snmp']['transports']) . "]
Usage (SNMPv3) : Config Defaults : ./addhost.php <%Whostname%n> any v3 [user] [port] [" . implode("|",$config['snmp']['transports']) . "]

View File

@@ -16,7 +16,6 @@ include_once("../includes/defaults.inc.php");
include_once("../config.php");
include_once("../includes/definitions.inc.php");
include_once("../includes/common.php");
include_once("../includes/console_colour.php");
include_once("../includes/dbFacile.php");
include_once("../includes/rewrites.php");
include_once("includes/functions.inc.php");

View File

@@ -54,6 +54,8 @@ include_once("includes/authenticate.inc.php");
include("includes/graphs/graph.inc.php");
$console_color = new Console_Color2();
$end = utime(); $run = $end - $start;;
if($debug) { echo("<br />Runtime ".$run." secs");

View File

@@ -547,7 +547,7 @@ function getlocations()
$ignore_dev_location[$row['device_id']] = 1;
}
# We can do this because of the ORDER BY, "bool" will be handled before "string"
elseif ($row['attrib_type'] == 'override_sysLocation_string' && $ignore_dev_location[$row['device_id']] == 1)
elseif ($row['attrib_type'] == 'override_sysLocation_string' && (isset($ignore_dev_location[$row['device_id']]) && $ignore_dev_location[$row['device_id']] == 1))
{
if (!in_array($row['attrib_value'],$locations)) { $locations[] = $row['attrib_value']; }
}
@@ -564,7 +564,7 @@ function getlocations()
foreach ($rows as $row)
{
# Only add it as a location if it wasn't overridden (and not already there)
if ($row['location'] != '' && !$ignore_dev_location[$row['device_id']])
if ($row['location'] != '' && !isset($ignore_dev_location[$row['device_id']]))
{
if (!in_array($row['location'],$locations)) { $locations[] = $row['location']; }
}

View File

@@ -1,6 +1,6 @@
<?php
if ($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; }
if (isset($bg) && $bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; }
if ($device['status'] == '0')
{

View File

@@ -13,8 +13,6 @@ foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
$device['location'] = get_dev_attrib($device,'override_sysLocation_string');
}
$devices['count']++;
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;

View File

@@ -14,7 +14,6 @@ if (!isset($alert_entry['device'])) {
</td>");
}
echo("<td>".$alert_entry['link']."</td>");
echo("<td>".htmlspecialchars($alert_entry['name']) . "</td>
</tr>");

View File

@@ -165,12 +165,12 @@ if ($_SESSION['userlevel'] >= '10')
<?php
if ($ports['errored'])
if (isset($ports['errored']))
{
echo(' <li><a href="ports/errors=1/"><img src="images/16/chart_curve_error.png" border="0" align="absmiddle" /> Errored ('.$ports['errored'].')</a></li>');
}
if ($ports['ignored'])
if (isset($ports['ignored']))
{
echo(' <li><a href="ports/ignore=1/"><img src="images/16/chart_curve_link.png" border="0" align="absmiddle" /> Ignored ('.$ports['ignored'].')</a></li>');
}
@@ -254,7 +254,7 @@ if ($menu_sensors)
foreach (array('fanspeed','humidity','temperature') as $item)
{
if ($menu_sensors[$item])
if (isset($menu_sensors[$item]))
{
echo(' <li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
unset($menu_sensors[$item]);$sep++;
@@ -269,7 +269,7 @@ if ($sep)
foreach (array('current','frequency','power','voltage') as $item)
{
if ($menu_sensors[$item])
if (isset($menu_sensors[$item]))
{
echo(' <li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
unset($menu_sensors[$item]);$sep++;
@@ -306,10 +306,12 @@ if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0")
$app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`");
foreach ($app_list as $app)
{
$image = $config['html_dir']."/images/icons/".$row['app_type'].".png";
$icon = (file_exists($image) ? $row['app_type'] : "apps");
if (isset($row['app_type'])) {
$image = $config['html_dir']."/images/icons/".$row['app_type'].".png";
$icon = (file_exists($image) ? $row['app_type'] : "apps");
echo('
<li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.nicecase($app['app_type']).' </a></li>');
<li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.nicecase($app['app_type']).' </a></li>');
}
}
?>
</ul>

View File

@@ -132,7 +132,7 @@ if (isset($config['branding']) && is_array($config['branding']))
}
# page_title_prefix is displayed, unless page_title is set
if ($config['page_title']) { $config['page_title_prefix'] = $config['page_title']; }
if (isset($config['page_title'])) { $config['page_title_prefix'] = $config['page_title']; }
?>
<!DOCTYPE HTML>
@@ -185,7 +185,7 @@ if ($config['favicon']) { echo(' <link rel="shortcut icon" href="'.$config['fav
<?php
if (!$vars['bare'] == "yes") {
if ((isset($vars['bare']) && $vars['bare'] != "yes") || !isset($vars['bare'])) {
if ($_SESSION['authenticated'])
{
@@ -213,7 +213,7 @@ if ($_SESSION['authenticated'])
<?php
// To help debug the new URLs :)
if ($devel || $vars['devel'])
if (isset($devel) || isset($vars['devel']))
{
echo("<pre>");
print_r($_GET);
@@ -284,7 +284,7 @@ if ($config['page_gen'])
echo(' <br />Generated in ' . $gentime . ' seconds.');
}
if (is_array($pagetitle))
if (isset($pagetitle) && is_array($pagetitle))
{
# if prefix is set, put it in front
if ($config['page_title_prefix']) { array_unshift($pagetitle,$config['page_title_prefix']); }

View File

@@ -17,20 +17,20 @@ if(isset($vars['state']))
}
}
if ($vars['hostname']) { $where .= " AND hostname LIKE ?"; $sql_param[] = "%".$vars['hostname']."%"; }
if ($vars['os']) { $where .= " AND os = ?"; $sql_param[] = $vars['os']; }
if ($vars['version']) { $where .= " AND version = ?"; $sql_param[] = $vars['version']; }
if ($vars['hardware']) { $where .= " AND hardware = ?"; $sql_param[] = $vars['hardware']; }
if ($vars['features']) { $where .= " AND features = ?"; $sql_param[] = $vars['features']; }
if ($vars['type']) { $where .= " AND type = ?"; $sql_param[] = $vars['type']; }
if ($vars['state']) {
if (isset($vars['hostname'])) { $where .= " AND hostname LIKE ?"; $sql_param[] = "%".$vars['hostname']."%"; }
if (isset($vars['os'])) { $where .= " AND os = ?"; $sql_param[] = $vars['os']; }
if (isset($vars['version'])) { $where .= " AND version = ?"; $sql_param[] = $vars['version']; }
if (isset($vars['hardware'])) { $where .= " AND hardware = ?"; $sql_param[] = $vars['hardware']; }
if (isset($vars['features'])) { $where .= " AND features = ?"; $sql_param[] = $vars['features']; }
if (isset($vars['type'])) { $where .= " AND type = ?"; $sql_param[] = $vars['type']; }
if (isset($vars['state'])) {
$where .= " AND status= ?"; $sql_param[] = $state;
$where .= " AND disabled='0' AND `ignore`='0'"; $sql_param[] = '';
}
if ($vars['disabled']) { $where .= " AND disabled= ?"; $sql_param[] = $vars['disabled']; }
if ($vars['ignore']) { $where .= " AND `ignore`= ?"; $sql_param[] = $vars['ignore']; }
if ($vars['location'] == "Unset") { $location_filter = ''; }
if ($vars['location']) { $location_filter = $vars['location']; }
if (isset($vars['disabled'])) { $where .= " AND disabled= ?"; $sql_param[] = $vars['disabled']; }
if (isset($vars['ignore'])) { $where .= " AND `ignore`= ?"; $sql_param[] = $vars['ignore']; }
if (isset($vars['location']) && $vars['location'] == "Unset") { $location_filter = ''; }
if (isset($vars['location'])) { $location_filter = $vars['location']; }
$pagetitle[] = "Devices";
@@ -94,7 +94,7 @@ foreach ($menu_options as $option => $text)
<?php
if ($vars['searchbar'] == "hide")
if (isset($vars['searchbar']) && $vars['searchbar'] == "hide")
{
echo('<a href="'. generate_url($vars, array('searchbar' => '')).'">Restore Search</a>');
} else {
@@ -103,7 +103,7 @@ foreach ($menu_options as $option => $text)
echo(" | ");
if ($vars['bare'] == "yes")
if (isset($vars['bare']) && $vars['bare'] == "yes")
{
echo('<a href="'. generate_url($vars, array('bare' => '')).'">Restore Header</a>');
} else {
@@ -118,7 +118,7 @@ foreach ($menu_options as $option => $text)
print_optionbar_end();
print_optionbar_start();
if($vars['searchbar'] != "hide")
if(isset($vars['searchbar']) && $vars['searchbar'] != "hide")
{
?>
@@ -235,7 +235,13 @@ foreach (dbFetch('SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDE
print_optionbar_end();
$query = "SELECT * FROM `devices` WHERE 1 ".$where." ORDER BY hostname";
$query = "SELECT * FROM `devices` WHERE 1 ";
if (isset($where)) {
$query .= $where;
}
$query .= " ORDER BY hostname";
list($format, $subformat) = explode("_", $vars['format']);
@@ -291,7 +297,7 @@ if($format == "graph")
{
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)
if (!isset($location_filter) || ((get_dev_attrib($device,'override_sysLocation_bool') && get_dev_attrib($device,'override_sysLocation_string') == $location_filter)
|| $device['location'] == $location_filter))
{
$cell_click = 'onclick="location.href=\'device/device='.$device['device_id'].'/\'" style="cursor: pointer;"';

View File

@@ -63,7 +63,7 @@ echo('<div style="float: right;">');
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> |
<?php
if ($vars['searchbar'] == "hide")
if (isset($vars['searchbar']) && $vars['searchbar'] == "hide")
{
echo('<a href="'. generate_url($vars, array('searchbar' => '')).'">Search</a>');
} else {
@@ -72,7 +72,7 @@ echo('<div style="float: right;">');
echo(" | ");
if ($vars['bare'] == "yes")
if (isset($vars['bare']) && $vars['bare'] == "yes")
{
echo('<a href="'. generate_url($vars, array('bare' => '')).'">Header</a>');
} else {
@@ -84,7 +84,7 @@ echo('</div>');
print_optionbar_end();
print_optionbar_start();
if($vars['searchbar'] != "hide")
if(isset($vars['searchbar']) && $vars['searchbar'] != "hide")
{
?>

View File

@@ -15,7 +15,7 @@ $cols = array('device' => 'Device',
foreach ($cols as $sort => $col)
{
if ($vars['sort'] == $sort)
if (isset($vars['sort']) && $vars['sort'] == $sort)
{
echo('<th>'.$col.' *</th>');
} else {
@@ -42,7 +42,7 @@ foreach ($ports as $port)
$type = humanmedia($port['ifType']);
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($port['in_errors'] > 0 || $port['out_errors'] > 0)
if ((isset($port['in_errors']) && $port['in_errors'] > 0) || (isset($ports['out_errors']) && $port['out_errors'] > 0))
{
$error_img = generate_port_link($port,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }

View File

@@ -59,9 +59,10 @@ function isCli()
function print_error($text)
{
global $console_color;
if (isCli())
{
print Console_Color::convert("%r".$text."%n\n", false);
print $console_color->convert("%r".$text."%n\n", false);
} else {
echo('<div class="alert alert-danger"><img src="/images/16/exclamation.png" align="absmiddle"> '.$text.'</div>');
}
@@ -71,7 +72,7 @@ function print_message($text)
{
if (isCli())
{
print Console_Color::convert("%g".$text."%n\n", false);
print Console_Color2::convert("%g".$text."%n\n", false);
} else {
echo('<div class="alert alert-success"><img src="/images/16/tick.png" align="absmiddle"> '.$text.'</div>');
}

View File

@@ -2,7 +2,7 @@
/**
* Color.php
*
* PHP version 4
* PHP version 5
*
* Copyright (c) 2007 Stefan Walk
*
@@ -25,47 +25,13 @@
* IN THE SOFTWARE.
*
* @category Console
* @package Console_Color
* @package Console_Color2
* @author Stefan Walk <et@php.net>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @link http://pear.php.net/package/Console_Color
* @link http://pear.php.net/package/Console_Color2
*/
$GLOBALS['_CONSOLE_COLOR_CODES'] = array (
'color' => array(
'black' => 30,
'red' => 31,
'green' => 32,
'brown' => 33,
'blue' => 34,
'purple' => 35,
'cyan' => 36,
'grey' => 37,
'yellow' => 33
),
'style' => array(
'normal' => 0,
'bold' => 1,
'light' => 1,
'underscore' => 4,
'underline' => 4,
'blink' => 5,
'inverse' => 6,
'hidden' => 8,
'concealed' => 8
),
'background' => array(
'black' => 40,
'red' => 41,
'green' => 42,
'brown' => 43,
'yellow' => 43,
'blue' => 44,
'purple' => 45,
'cyan' => 46,
'grey' => 47
)
);
/**
* A simple class to use ANSI Colorcodes.
@@ -80,9 +46,60 @@ $GLOBALS['_CONSOLE_COLOR_CODES'] = array (
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @link http://pear.php.net/package/Console_Color
*/
class Console_Color
class Console_Color2
{
protected $color_codes;
public function __construct() {
$this->setColorCodes(array(
'color' => array(
'black' => 30,
'red' => 31,
'green' => 32,
'brown' => 33,
'blue' => 34,
'purple' => 35,
'cyan' => 36,
'grey' => 37,
'yellow' => 33
),
'style' => array(
'normal' => 0,
'bold' => 1,
'light' => 1,
'underscore' => 4,
'underline' => 4,
'blink' => 5,
'inverse' => 6,
'hidden' => 8,
'concealed' => 8
),
'background' => array(
'black' => 40,
'red' => 41,
'green' => 42,
'brown' => 43,
'yellow' => 43,
'blue' => 44,
'purple' => 45,
'cyan' => 46,
'grey' => 47
)
)
);
}
public function setColorCodes($color_codes)
{
$this->color_codes = $color_codes;
}
public function getColorCodes()
{
return $this->color_codes;
}
/**
* Returns an ANSI-Controlcode
*
@@ -98,16 +115,15 @@ class Console_Color
* @param string $style Optional name of the style
* @param string $background Optional name of the background color
*
* @access public
* @return string
*/
function color($color = null, $style = null, $background = null) // {{{
public function color($color = null, $style = null, $background = null) // {{{
{
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
$colors = $this->getColorCodes();
if (is_array($color)) {
$style = @$color['style'];
$background = @$color['background'];
$color = @$color['color'];
$style = isset($color['style']) ? $color['style'] : null;
$background = isset($color['background']) ? $color['background'] : null;
$color = isset($color['color']) ? $color['color'] : null;
}
if ($color == 'reset') {
@@ -115,14 +131,14 @@ class Console_Color
}
$code = array();
if (isset($color)) {
$code[] = $colors['color'][$color];
}
if (isset($style)) {
$code[] = $colors['style'][$style];
}
if (isset($color)) {
$code[] = $colors['color'][$color];
}
if (isset($background)) {
$code[] = $colors['background'][$background];
}
@@ -140,12 +156,12 @@ class Console_Color
*
* @param string $name Name of controlcode
*
* @access public
* @return string
*/
function fgcolor($name)
public function fgcolor($name)
{
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
$colors = $this->getColorCodes();
return "\033[".$colors['color'][$name].'m';
}
@@ -154,26 +170,11 @@ class Console_Color
*
* @param string $name Name of controlcode
*
* @access public
* @return string
*/
function style($name)
{
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
return "\033[".$colors['style'][$name].'m';
}
/**
* Returns a BG color controlcode
*
* @param string $name Name of controlcode
*
* @access public
* @return string
*/
function bgcolor($name)
{
$colors = &$GLOBALS['_CONSOLE_COLOR_CODES'];
$colors = $this->getColorCodes();
return "\033[".$colors['background'][$name].'m';
}
@@ -209,23 +210,22 @@ class Console_Color
* @param string $string String to convert
* @param bool $colored Should the string be colored?
*
* @access public
* @return string
*/
function convert($string, $colored = true)
public function convert($string, $colored = true)
{
static $conversions = array ( // static so the array doesn't get built
// everytime
// %y - yellow, and so on... {{{
'%y' => array('color' => 'yellow'),
'%g' => array('color' => 'green' ),
'%b' => array('color' => 'blue' ),
'%r' => array('color' => 'red' ),
'%p' => array('color' => 'purple'),
'%m' => array('color' => 'purple'),
'%c' => array('color' => 'cyan' ),
'%w' => array('color' => 'grey' ),
'%k' => array('color' => 'black' ),
'%y' => array('color' => 'yellow', 'style' => 'normal'),
'%g' => array('color' => 'green', 'style' => 'normal'),
'%b' => array('color' => 'blue', 'style' => 'normal'),
'%r' => array('color' => 'red', 'style' => 'normal'),
'%p' => array('color' => 'purple', 'style' => 'normal'),
'%m' => array('color' => 'purple', 'style' => 'normal'),
'%c' => array('color' => 'cyan', 'style' => 'normal'),
'%w' => array('color' => 'grey', 'style' => 'normal'),
'%k' => array('color' => 'black', 'style' => 'normal'),
'%n' => array('color' => 'reset' ),
'%Y' => array('color' => 'yellow', 'style' => 'light'),
'%G' => array('color' => 'green', 'style' => 'light'),
@@ -257,7 +257,7 @@ class Console_Color
if ($colored) {
$string = str_replace('%%', '% ', $string);
foreach ($conversions as $key => $value) {
$string = str_replace($key, Console_Color::color($value),
$string = str_replace($key, $this->color($value),
$string);
}
$string = str_replace('% ', '%', $string);
@@ -274,10 +274,9 @@ class Console_Color
*
* @param string $string String to escape
*
* @access public
* @return string
*/
function escape($string)
public function escape($string)
{
return str_replace('%', '%%', $string);
}
@@ -290,10 +289,9 @@ class Console_Color
* @acess public
* @return string
*/
function strip($string)
public function strip($string)
{
return preg_replace('/\033\[[\d;]+m/', '', $string);
}
}
?>

View File

@@ -22,16 +22,15 @@ Usage
* Used by the other _query functions.
* */
function dbQuery($sql, $parameters = array()) {
global $fullSql, $debug, $sql_debug;
global $fullSql, $debug, $sql_debug, $console_color;
$fullSql = dbMakeQuery($sql, $parameters);
if($debug) {
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
print Console_Color::convert("\nSQL[%y".$fullSql."%n] ");
print $console_color->convert("\nSQL[%y".$fullSql."%n] ");
} else {
$sql_debug[] = $fullSql;
}
#echo("\nSQL[".$fullSql."] ");
}
}
/*
if($this->logFile)

View File

@@ -30,6 +30,8 @@ include_once($config['install_dir'] . "/includes/services.inc.php");
include_once($config['install_dir'] . "/includes/dbFacile.php");
include_once($config['install_dir'] . "/includes/console_colour.php");
$console_color = new Console_Color2();
if ($config['alerts']['email']['enable'])
{
include_once($config['install_dir'] . "/includes/phpmailer/class.phpmailer.php");
@@ -161,7 +163,7 @@ function getImage($device)
{
$image = '<img src="' . $config['base_url'] . '/images/os/' . $device['icon'] . '.png" />';
}
elseif ($config['os'][$device['os']]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$device['os']]['icon'] . ".png"))
elseif (isset($config['os'][$device['os']]['icon']) && $config['os'][$device['os']]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$device['os']]['icon'] . ".png"))
{
$image = '<img src="' . $config['base_url'] . '/images/os/' . $config['os'][$device['os']]['icon'] . '.png" />';
} else {

View File

@@ -148,7 +148,7 @@ function rrdtool_graph($graph_file, $options)
function rrdtool($command, $filename, $options)
{
global $config, $debug, $rrd_pipes;
global $config, $debug, $rrd_pipes, $console_color;
$cmd = "$command $filename $options";
if ($command != "create" && $config['rrdcached'])
@@ -158,7 +158,7 @@ function rrdtool($command, $filename, $options)
if ($config['norrd'])
{
print Console_Color::convert("[%rRRD Disabled%n]");
print $console_color->convert("[%rRRD Disabled%n]");
} else {
fwrite($rrd_pipes[0], $cmd."\n");
}
@@ -166,7 +166,7 @@ function rrdtool($command, $filename, $options)
{
echo stream_get_contents($rrd_pipes[1]);
echo stream_get_contents($rrd_pipes[2]);
print Console_Color::convert("RRD[%g".$cmd."%n] ");
print $console_color->convert("RRD[%g".$cmd."%n] ");
} else {
$tmp = stream_get_contents($rrd_pipes[1]).stream_get_contents($rrd_pipes[2]);
}
@@ -182,15 +182,15 @@ function rrdtool($command, $filename, $options)
function rrdtool_create($filename, $options)
{
global $config, $debug;
global $config, $debug, $console_color;
if ($config['norrd'])
{
print Console_Color::convert("[%gRRD Disabled%n] ", false);
print $console_color->convert("[%gRRD Disabled%n] ", false);
} else {
$command = $config['rrdtool'] . " create $filename $options";
}
if ($debug) { print Console_Color::convert("RRD[%g".$command."%n] "); }
if ($debug) { print $console_color->convert("RRD[%g".$command."%n] "); }
return shell_exec($command);
}

View File

@@ -9,6 +9,8 @@ include_once("../includes/definitions.inc.php");
include("../includes/functions.php");
include("../html/includes/functions.inc.php");
$console_color = new Console_Color2();
$long_opts = array('list::','device-stats');
$options = getopt("l:d:",$long_opts);
@@ -36,9 +38,9 @@ while($end == 0)
// Include the required SQL queries to get our data
require('../includes/db/status_count.inc.php');
$tbl->addRow(array('Devices ('.$devices['count'].')',Console_Color::convert("%g".$devices['up']." Up%n"),Console_Color::convert("%r".$devices['down']." Down%n"),Console_Color::convert("%y".$devices['ignored']." Ignored%n"),Console_Color::convert("%p".$devices['disabled']." Disabled%n")));
$tbl->addRow(array('Ports ('.$ports['count'].')',Console_Color::convert("%g".$ports['up']." Up%n"),Console_Color::convert("%r".$ports['down']." Down%n"),Console_Color::convert("%y".$ports['ignored']." Ignored%n"),Console_Color::convert("%p".$ports['shutdown']." Shutdown%n")));
$tbl->addRow(array('Services ('.$services['count'].')',Console_Color::convert("%g".$services['up']." Up%n"),Console_Color::convert("%r".$services['down']." Down%n"),Console_Color::convert("%y".$services['ignored']." Ignored%n"),Console_Color::convert("%p".$services['disabled']." Shutdown%n")));
$tbl->addRow(array('Devices ('.$devices['count'].')',print $console_color->convert("%g".$devices['up']." Up%n"),print $console_color->convert("%r".$devices['down']." Down%n"),print $console_color->convert("%y".$devices['ignored']." Ignored%n"),print $console_color->convert("%p".$devices['disabled']." Disabled%n")));
$tbl->addRow(array('Ports ('.$ports['count'].')',print $console_color->convert("%g".$ports['up']." Up%n"),print $console_color->convert("%r".$ports['down']." Down%n"),print $console_color->convert("%y".$ports['ignored']." Ignored%n"),print $console_color->convert("%p".$ports['shutdown']." Shutdown%n")));
$tbl->addRow(array('Services ('.$services['count'].')',print $console_color->convert("%g".$services['up']." Up%n"),print $console_color->convert("%r".$services['down']." Down%n"),print $console_color->convert("%y".$services['ignored']." Ignored%n"),print $console_color->convert("%p".$services['disabled']." Shutdown%n")));
echo $tbl->getTable();
@@ -129,7 +131,7 @@ while($end == 0)
");
exit;
}
echo(Console_Color::convert("%rLast update at ". date("Y-m-d h:i:s")."%n\n\n"));
echo(print $console_color->convert("%rLast update at ". date("Y-m-d h:i:s")."%n\n\n"));
sleep(5);
}