Fixed errors

This commit is contained in:
Alejandro Gallardo Escobar 2015-01-19 16:52:32 +01:00
parent eb0a093525
commit 9fa010c8ac
2 changed files with 10 additions and 10 deletions

View File

@ -621,6 +621,10 @@ class Tree {
else else
$parent = $this->root; $parent = $this->root;
function cmpSortNames($a, $b) {
return strcmp($a["name"], $b["name"]);
}
// Get all groups // Get all groups
if (empty($parent)) { if (empty($parent)) {
require_once($config['homedir']."/include/functions_groups.php"); require_once($config['homedir']."/include/functions_groups.php");
@ -801,13 +805,13 @@ class Tree {
// Add the resulting item // Add the resulting item
$mergedItems[] = $resultItem; $mergedItems[] = $resultItem;
} }
usort($mergedItems, "cmpSortNames");
return $mergedItems; return $mergedItems;
} }
$items = __getMergedItems($item_list); $items = __getMergedItems($item_list);
html_debug_print($items, true);
} }
if (empty($items)) if (empty($items))
@ -821,10 +825,6 @@ class Tree {
$this->tree = $this->getAgents($parent, $this->type); $this->tree = $this->getAgents($parent, $this->type);
} }
else { else {
function cmpSortAgentNames($a, $b) {
return strcmp($a["name"], $b["name"]);
}
$agents = array(); $agents = array();
foreach ($parent as $server_id => $group_id) { foreach ($parent as $server_id => $group_id) {
$server = metaconsole_get_servers($server_id); $server = metaconsole_get_servers($server_id);
@ -839,7 +839,7 @@ class Tree {
} }
} }
if (!empty($agents)) if (!empty($agents))
usort($agents, "cmpSortAgentNames"); usort($agents, "cmpSortNames");
$this->tree = $agents; $this->tree = $agents;
} }

View File

@ -2019,7 +2019,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
} }
} }
if ($mode == 'group' || $mode == 'tree') { if ($mode == 'group') {
if (! defined ('METACONSOLE')) { if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]); unset($list[$i]);
@ -2123,7 +2123,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
} }
} }
if ($mode == 'group' || $mode == 'tree') { if ($mode == 'group') {
if (! defined ('METACONSOLE')) { if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]); unset($list[$i]);
@ -2180,7 +2180,7 @@ function group_get_data ($id_user = false, $user_strict = false, $acltags, $retu
} }
} }
if ($mode == 'group' || $mode == 'tree') { if ($mode == 'group') {
if (! defined ('METACONSOLE')) { if (! defined ('METACONSOLE')) {
if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) && ($list[$i]['_monitors_unknown_'] == 0) && ($list[$i]['_monitors_not_init_'] == 0) && ($list[$i]['_agents_not_init_'] == 0)) {
unset($list[$i]); unset($list[$i]);